build.gradle 2.8 KB
Newer Older
S
Skylot 已提交
1 2
plugins {
    id 'com.github.ksoichiro.console.reporter' version '0.5.0'
S
Skylot 已提交
3 4
    id 'org.sonarqube' version '2.6.2'
    id 'com.github.ben-manes.versions' version '0.17.0'
S
Skylot 已提交
5 6
}

S
Skylot 已提交
7 8 9
ext.jadxVersion = file('version').readLines().get(0)
version = jadxVersion

10
allprojects {
S
Skylot 已提交
11
    apply plugin: 'java'
S
Skylot 已提交
12
    apply plugin: 'groovy'
S
Skylot 已提交
13
    apply plugin: 'jacoco'
S
Skylot 已提交
14
    apply plugin: 'com.github.ksoichiro.console.reporter'
S
Skylot 已提交
15

S
Skylot 已提交
16 17
    version = jadxVersion

S
Skylot 已提交
18
    tasks.withType(JavaCompile) {
S
Skylot 已提交
19 20
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
S
Skylot 已提交
21 22 23

        if (!"$it".contains(':jadx-samples:')) {
            options.compilerArgs << '-Xlint' << '-Xlint:unchecked' << '-Xlint:deprecation'
24
        }
S
Skylot 已提交
25 26
    }

S
Skylot 已提交
27 28 29 30
    compileJava {
        options.encoding = "UTF-8"
    }

S
Skylot 已提交
31 32
    jar {
        version = jadxVersion
S
Skylot 已提交
33
        manifest {
34
            mainAttributes('jadx-version': jadxVersion)
S
Skylot 已提交
35
        }
S
Skylot 已提交
36
    }
S
Skylot 已提交
37

S
Skylot 已提交
38
    dependencies {
S
Skylot 已提交
39
        compile 'org.slf4j:slf4j-api:1.7.25'
S
Skylot 已提交
40

S
Skylot 已提交
41
        testCompile 'ch.qos.logback:logback-classic:1.2.3'
S
Skylot 已提交
42
        testCompile 'junit:junit:4.12'
S
Skylot 已提交
43
        testCompile 'org.hamcrest:hamcrest-library:1.3'
S
Skylot 已提交
44 45 46
        testCompile 'org.mockito:mockito-core:2.15.0'
        testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
        testCompile 'cglib:cglib-nodep:3.2.6'
S
Skylot 已提交
47 48
    }

S
Skylot 已提交
49
    repositories {
S
Skylot 已提交
50
        mavenLocal()
51
        mavenCentral()
S
Skylot 已提交
52
        jcenter()
S
Skylot 已提交
53
    }
54

S
Skylot 已提交
55 56 57
    jacoco {
        toolVersion = "0.8.0"
    }
58 59
    jacocoTestReport {
        reports {
60
            xml.enabled = true
61 62 63 64 65
            html.enabled = true
        }
    }
}

S
Skylot 已提交
66 67 68 69 70 71 72
sonarqube {
    properties {
        property 'sonar.exclusions', '**/jadx/samples/**/*,**/test-app/**/*'
        property 'sonar.coverage.exclusions', '**/jadx/gui/**/*'
    }
}

S
Skylot 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85
dependencyUpdates.resolutionStrategy = {
    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 已提交
86
task copyArtifacts(type: Sync, dependsOn: ['jadx-cli:installDist', 'jadx-gui:installDist']) {
S
Skylot 已提交
87 88
    destinationDir file("$buildDir/jadx")
    ['jadx-cli', 'jadx-gui'].each {
S
Skylot 已提交
89
        from tasks.getByPath(":${it}:installDist").destinationDir
S
Skylot 已提交
90 91 92
    }
}

S
Skylot 已提交
93
task pack(type: Zip, dependsOn: copyArtifacts) {
S
Skylot 已提交
94 95 96 97 98
    destinationDir buildDir
    archiveName "jadx-${jadxVersion}.zip"
    from copyArtifacts.destinationDir
}

S
Skylot 已提交
99
task dist(dependsOn: pack) {
S
Skylot 已提交
100 101 102
    description = 'Build jadx distribution zip'
}

S
Skylot 已提交
103 104 105
task samples(dependsOn: 'jadx-samples:samples') {
}

106 107 108
task testAppCheck(dependsOn: 'jadx-test-app:testAppCheck') {
}

S
Skylot 已提交
109
task cleanBuildDir(type: Delete) {
110
    delete buildDir
S
Skylot 已提交
111 112
}

S
Skylot 已提交
113 114 115 116
build.dependsOn(dist, samples)

clean.dependsOn(cleanBuildDir)