Skip to content
Snippets Groups Projects
build.gradle 5.5 KiB
Newer Older
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
apply plugin: 'application'
apply plugin: 'eclipse'

mainClassName = 'kieker.diagnosis.Main'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
version = '1.0-SNAPSHOT'

sourceCompatibility = '1.7'
targetCompatibility = '1.7'

repositories {
	mavenCentral()
	maven { url 'https://swt-repo.googlecode.com/svn/repo/' }
	maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } 
buildscript {
	repositories {
		mavenCentral()
	}

	dependencies {
		classpath 'de.aaschmid.gradle.plugins:gradle-cpd-plugin:0.1'
	}
}

Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
configurations { 
	windowsX86Runtime
	windowsX64Runtime
	linuxX86Runtime
	linuxX64Runtime
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

dependencies {
	// One of the runtime dependencies has to be used during the compilation. Modify this entry for Eclipse depending on your development JRE.
	if (System.properties['os.name'].toLowerCase().contains('windows')) {
	    providedCompile 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:4.4'
	} else {
	    providedCompile 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:4.4'
	}
	
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	windowsX86Runtime 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86:4.4'
	windowsX64Runtime 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:4.4'
	linuxX86Runtime 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:4.4'
	linuxX64Runtime 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:4.4'
	compile 'net.sourceforge.teetime:teetime:1.1-SNAPSHOT'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	compile 'net.sourceforge.teetime-stages:teetime-stages:1.0-SNAPSHOT'
	compile 'net.kieker-monitoring:kieker:1.11-SNAPSHOT'
	compile 'org.eclipse:jface:3.2.1-M20060908-1000'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	testCompile 'org.hamcrest:hamcrest-core:1.3'
	testCompile 'org.hamcrest:hamcrest-library:1.3'
	testCompile 'junit:junit:4.12'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

// Add the provided-scoped dependencies to the classpaths
sourceSets.main.compileClasspath += configurations.providedCompile
eclipse.classpath.plusConfigurations += [configurations.providedCompile]

Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
apply plugin: 'pmd'
pmd { 
	ignoreFailures = true

	ruleSets = []
	ruleSetFiles = files('config/pmd/ruleset.xml')
apply plugin: 'cpd'
tasks.cpd {
	source = sourceSets.main.allJava
  
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	reports.xml.destination = file('build/reports/cpd/main.xml')
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
apply plugin: 'checkstyle'
checkstyle {
	ignoreFailures = true
	showViolations = false
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

apply plugin: 'findbugs'
findbugs { 
	ignoreFailures = true 
	effort = "max"
	reportLevel = "low"

	excludeFilter = file('config/findbugs/excludeFilter.xml')
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
def commonStartScriptConfiguration = {
	mainClassName = project.mainClassName
	applicationName = 'start' 
	outputDir = new File(project.buildDir, 'scripts')
	classpath = jar.outputs.files + project.configurations.runtime 
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task createStartScriptWinX86(type: CreateStartScripts) {
	configure commonStartScriptConfiguration
	classpath += project.configurations.windowsX86Runtime
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task createStartScriptWinX64(type: CreateStartScripts) {
	configure commonStartScriptConfiguration
	classpath += project.configurations.windowsX64Runtime
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task createStartScriptLinuxX86(type: CreateStartScripts) {
	configure commonStartScriptConfiguration
	classpath += project.configurations.linuxX86Runtime 
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task createStartScriptLinuxX64(type: CreateStartScripts) {
	configure commonStartScriptConfiguration
	classpath += project.configurations.linuxX64Runtime
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

def commonDistBinConfiguration = {
	into('lib') {
		from configurations.runtime
		from jar.archivePath 
	}
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task distBinWinX86(type: Zip, dependsOn: [jar, createStartScriptWinX86]) {
	description = 'Bundles the project as a JVM application with OS specific libs and script for Windows x86.'
	classifier = 'windows_x86'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	configure commonDistBinConfiguration
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	into ('bin') {
		from createStartScriptWinX86.getWindowsScript()
	}

	into('lib') {
		from configurations.windowsX86Runtime
	}
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task distBinWinX64(type: Zip, dependsOn: [jar, createStartScriptWinX64]) {
	description = 'Bundles the project as a JVM application with OS specific libs and script for Windows x64.'
	classifier = 'windows_x64'
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	configure commonDistBinConfiguration
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	into ('bin') {
		from createStartScriptWinX64.getWindowsScript()
	}

	into('lib') {
		from configurations.windowsX64Runtime
	}
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task distBinLinuxX86(type: Tar, dependsOn: [jar, createStartScriptLinuxX86]) {
	description = 'Bundles the project as a JVM application with OS specific libs and script for Linux x86.'
	classifier = 'linux_x86'
	compression = Compression.GZIP
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	configure commonDistBinConfiguration
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	into ('bin') {
		from createStartScriptLinuxX86.getUnixScript()
	}

	into('lib') {
		from configurations.linuxX86Runtime
	}
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task distBinLinuxX64(type: Tar, dependsOn: [jar, createStartScriptLinuxX64]) {
	description = 'Bundles the project as a JVM application with OS specific libs and script for Linux x64.'
	classifier = 'linux_x64'
	compression = Compression.GZIP
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	configure commonDistBinConfiguration
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
	into ('bin') {
		from createStartScriptLinuxX64.getUnixScript()
	}

	into('lib') {
		from configurations.linuxX64Runtime
	}
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
}

task distAllBin(dependsOn: [distBinWinX86, distBinWinX64, distBinLinuxX86, distBinLinuxX64]) {
	description = 'Bundles the project as a JVM application with OS specific libs and scripts for all platforms.'
}

def commonDistSrcConfiguration = {
	classifier 'src'

	into ('src') { from 'src' }
	into ('config') { from 'config' }
	into ('example') { from 'example' }
	from ('.') {
		include 'LICENSE'
		include 'README'
		include 'build.gradle'
	}
}

task distSrcZip(type: Zip) {
	configure commonDistSrcConfiguration
}

task distSrcTar(type: Tar) {
	configure commonDistSrcConfiguration
	compression = Compression.GZIP
}

task distAllSrc(dependsOn: [distSrcZip, distSrcTar]) {
	description = 'Bundles the source files of the project.'