Newer
Older
marking / build.gradle
plugins {
	id 'application'
}

repositories {
	mavenCentral()

	// since the Jasper devs keep using their own custom builds of ancient
	// versions of other projects we need to add a repository for their
	// "special" versions.

	maven {
		url 'https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/'
	}

}

dependencies {
	implementation group: 'com.h2database', name: 'h2', version: '1.4.200'
	implementation group: 'net.sourceforge.dynamicreports', name: 'dynamicreports-core', version: '6.12.1'
	implementation group: 'org.simplejavamail', name: 'simple-java-mail', version: '7.1.1'
	implementation group: 'com.formdev', name: 'flatlaf', version: '2.3'
	implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
	implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
	implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.11'
}

task copyLibs(type: Copy) {
	from configurations.implementation
	into 'libs/'
}

project.configurations.implementation.setCanBeResolved(true)

jar {
	manifest {
		attributes (
			'Main-Class': 'Main',
			'Class-Path':  configurations.implementation.collect { 'lib/' + it.name }.join(' ')
		)
	}
}

task createMissingSourceDirs {
	group = "Directories"
	description = "Create all of the missing source directories for this project."
	doFirst {
		sourceSets.each { def sourceRoot ->
			sourceRoot.allSource.srcDirTrees.each { def sourceDir ->
				if(!sourceDir.dir.exists()) {
					println "Creating ${sourceDir}"
					mkdir sourceDir.dir
				}
			}
		}
	}
}

task deleteEmptySourceDirs {
	group = "Directories"
	description = "Delete all empty source directories."
	doFirst {
		sourceSets.each { def sourceRoot ->
			sourceRoot.allSource.srcDirTrees.each { def sourceDir ->
				if(sourceDir.dir.exists() && sourceDir.dir.isDirectory() && sourceDir.dir.list().length == 0) {
					println "Removing empty ${sourceDir}"
					sourceDir.dir.delete()
				}
			}
		}
	}

}

task openBuildFolder {
	group = "Directories"
	description = "Open the project build directory in the system file manager."
	doFirst {
		println('Opening: ' + file(buildDir))
		java.awt.Desktop.getDesktop().open(file(buildDir));
	}
}

compileJava {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

mainClassName = 'Main'