forked from Guardsquare/proguard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
135 lines (114 loc) · 3.78 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'com.github.johnrengelman.shadow'
id 'java-gradle-plugin'
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'maven-publish'
id 'org.jlleitschuh.gradle.ktlint' version '9.2.1'
}
repositories {
google()
mavenCentral()
}
def agpVersion = '4.1.0'
gradlePlugin {
plugins {
proguardPlugin {
id = 'com.guardsquare.proguard'
implementationClass = 'proguard.gradle.plugin.ProGuardPlugin'
}
}
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
configurations {
fatJar.extendsFrom(compile)
}
dependencies {
api project(':base')
// TODO update to 4.2 or 7.0 API
compileOnly ("com.android.tools.build:gradle:$agpVersion") {
exclude module: 'proguard-gradle'
exclude module: 'proguard-base'
}
implementation 'com.github.zafarkhaja:java-semver:0.9.0'
testCompileOnly ("com.android.tools.build:gradle:$agpVersion") {
exclude module: 'proguard-gradle'
exclude module: 'proguard-base'
}
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.0' // for kotest framework
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.9.0' // for kotest core jvm assertions
testImplementation 'io.kotest:kotest-property-jvm:5.9.0' // for kotest property test
testImplementation 'io.mockk:mockk:1.13.11' // for mocking
testImplementation "commons-io:commons-io:2.8.0"
fatJar project(":base")
// This library is used to parse the android gradle plugin version at runtime.
fatJar 'com.github.zafarkhaja:java-semver:0.9.0'
}
test {
useJUnitPlatform()
}
def localRepo = file("$buildDir/local-repo")
task fatJar(type: ShadowJar) {
destinationDirectory.set(localRepo)
archiveFileName.set("proguard-gradle-${version}.jar")
from sourceSets.main.output
configurations = [project.configurations.fatJar]
manifest {
attributes(
'Main-Class': 'proguard.ProGuard',
'Implementation-Version': archiveVersion.get())
}
}
tasks.withType(Test).configureEach {
dependsOn fatJar
systemProperty "local.repo", localRepo.toURI()
systemProperty "proguard.version", version
systemProperty "agp.version", agpVersion
}
sourceSets.test {
resources {
srcDirs += "$buildDir/fixtures"
}
}
// Copies selected directories from examples into the test resources to compile during an integration test.
def copyExamples = tasks.register('copyExamples', Copy) {
from("$rootProject.rootDir/examples") {
include 'spring-boot/**'
include 'gradle-kotlin-dsl/**'
include 'application/**'
}
into "$buildDir/fixtures"
}
tasks.named('processTestResources', ProcessResources) {
dependsOn copyExamples
}
tasks.withType(Test).configureEach {
dependsOn copyExamples
}
afterEvaluate {
/* This project gets two publications:
- "pluginMaven" is the default from `java-gradle-plugin`
and must not be automatically published.
- "<project.name>" is created by ProGuard custom logic
and should have its artifact ID adjusted.
- we also disable publishing of plugin markers.
*/
tasks.withType(AbstractPublishToMaven).matching { task ->
task.publication.name == 'pluginMaven' ||
task.name =~ /^publish(.*)PluginMarkerMavenPublicationTo(GithubRepository|MavenLocal|SonatypeRepository)$/
} each {task ->
task.enabled = false
}
publishing {
publications.getByName(project.name) {
pom {
description = 'Gradle plugin for ProGuard, the free shrinker, optimizer, obfuscator, and preverifier for Java bytecode'
}
}
}
}