build.gradle 3.1 KB
Newer Older
S
Skylot 已提交
1
plugins {
2 3 4
	id 'org.sonarqube' version '2.7'
	id 'com.github.ben-manes.versions' version '0.21.0'
	id 'org.ec4j.editorconfig' version '0.0.3'
S
Skylot 已提交
5 6
}

7
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
S
Skylot 已提交
8
version = jadxVersion
9
println("jadx version: ${jadxVersion}")
S
Skylot 已提交
10

11
allprojects {
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
	apply plugin: 'java'
	apply plugin: 'jacoco'

	version = jadxVersion

	tasks.withType(JavaCompile) {
		sourceCompatibility = JavaVersion.VERSION_1_8
		targetCompatibility = JavaVersion.VERSION_1_8

		if (!"$it".contains(':jadx-samples:')) {
			options.compilerArgs << '-Xlint' << '-Xlint:unchecked' << '-Xlint:deprecation'
		}
	}

	compileJava {
		options.encoding = "UTF-8"
	}

	jar {
		version = jadxVersion
		manifest {
			mainAttributes('jadx-version': jadxVersion)
		}
	}

	dependencies {
		compile 'org.slf4j:slf4j-api:1.7.26'

		testCompile 'ch.qos.logback:logback-classic:1.2.3'
		testCompile 'org.hamcrest:hamcrest-library:2.1'
		testCompile 'org.mockito:mockito-core:2.25.1'

		testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.1'
		testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.1'
46 47

		testCompile 'org.eclipse.jdt.core.compiler:ecj:4.6.1'
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
	}

	test {
		useJUnitPlatform()
	}

	repositories {
		mavenLocal()
		mavenCentral()
		jcenter()
		google()
	}

	jacoco {
		toolVersion = "0.8.2"
	}
	jacocoTestReport {
		reports {
			xml.enabled = true
			html.enabled = true
		}
	}
70 71
}

S
Skylot 已提交
72
sonarqube {
73 74 75 76 77 78 79 80 81 82 83 84 85 86
	properties {
		property 'sonar.exclusions', '**/jadx/samples/**/*,**/test-app/**/*'
		property 'sonar.coverage.exclusions', '**/jadx/gui/**/*'
	}
}

editorconfig {
	excludes = ['gradle/'
				, 'jadx-test-app/test-app' // ignore issues in submodule
				, '**/out/' // IntelliJ Idea build dirs
				, '**/certificate-test/' // binary test files (.RSA)
				, '**/*.svg'
				, '**/*.arsc'
	]
S
Skylot 已提交
87 88
}

S
Skylot 已提交
89
dependencyUpdates.resolutionStrategy = {
90 91 92 93 94 95 96 97 98 99
	componentSelection { rules ->
		rules.all { ComponentSelection selection ->
			boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'atlassian'].any { qualifier ->
				selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
			}
			if (rejected) {
				selection.reject('Release candidate')
			}
		}
	}
S
Skylot 已提交
100 101
}

S
Skylot 已提交
102
task copyArtifacts(type: Sync, dependsOn: ['jadx-cli:installDist', 'jadx-gui:installDist']) {
103 104 105 106
	destinationDir file("$buildDir/jadx")
	['jadx-cli', 'jadx-gui'].each {
		from tasks.getByPath(":${it}:installDist").destinationDir
	}
S
Skylot 已提交
107 108
}

S
Skylot 已提交
109
task pack(type: Zip, dependsOn: copyArtifacts) {
110 111 112
	destinationDir buildDir
	archiveName "jadx-${jadxVersion}.zip"
	from copyArtifacts.destinationDir
S
Skylot 已提交
113 114
}

S
Skylot 已提交
115
task copyExe(type: Copy, dependsOn: 'jadx-gui:createExe') {
116 117 118 119 120
	group 'jadx'
	description = 'Copy exe to build dir'
	destinationDir buildDir
	from tasks.getByPath('jadx-gui:createExe').outputs
	include '*.exe'
S
Skylot 已提交
121 122 123
}

task dist(dependsOn: [pack, copyExe]) {
124 125
	group 'jadx'
	description = 'Build jadx distribution zip'
S
Skylot 已提交
126 127
}

S
Skylot 已提交
128
task samples(dependsOn: 'jadx-samples:samples') {
129
	group 'jadx'
S
Skylot 已提交
130 131
}

132
task testAppCheck(dependsOn: 'jadx-test-app:testAppCheck') {
133
	group 'jadx'
134 135
}

S
Skylot 已提交
136
task cleanBuildDir(type: Delete) {
137 138
	group 'jadx'
	delete buildDir
S
Skylot 已提交
139 140
}

141 142 143
check.dependsOn editorconfigCheck

test.dependsOn(samples)
S
Skylot 已提交
144 145 146

clean.dependsOn(cleanBuildDir)