forked from Guardsquare/proguard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
198 lines (188 loc) · 6.86 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
plugins {
id 'com.jfrog.bintray'
id 'distribution'
id 'maven-publish'
id 'signing'
}
allprojects {
group = 'com.guardsquare'
version = proguardVersion
}
wrapper {
gradleVersion = '6.4'
distributionType = Wrapper.DistributionType.ALL
}
task buildDocumentation(type: Exec) {
inputs.dir 'docs/md'
inputs.file 'docs/mkdocs.yml'
outputs.dir 'docs/html'
executable 'sh'
args '-c', "docker run --volume $rootDir/docs:/docs --rm squidfunk/mkdocs-material:5.2.2 build"
}
allprojects { Project project ->
pluginManager.withPlugin('maven-publish') {
configure(project) {
publishing {
publications {
create(project.name, MavenPublication) {
pom {
name = "[$group] $artifactId"
developers {
developer {
id = 'lafortune'
name = 'Eric Lafortune'
url = 'https://www.guardsquare.com/proguard'
organization = 'Guardsquare'
organizationUrl = 'https://www.guardsquare.com/'
roles = ['Project Administrator', 'Developer']
}
}
}
}
}
repositories {
maven {
name = 'Github'
url = uri('https://maven.pkg.github.com/guardsquare/proguard')
credentials {
username = project.findProperty('PROGUARD_GITHUB_USERNAME')
password = project.findProperty('PROGUARD_GITHUB_TOKEN')
}
}
maven {
name = 'Sonatype'
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials(PasswordCredentials) {
username = findProperty('PROGUARD_STAGING_USERNAME')
password = findProperty('PROGUARD_STAGING_PASSWORD')
}
}
}
}
// We use in-memory ascii-armored keys
// See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
signing {
String key = findProperty('PROGUARD_SIGNING_KEY')
String password = findProperty('PROGUARD_SIGNING_PASSWORD')
useInMemoryPgpKeys(key, password)
sign publishing.publications.getByName(project.name)
}
}
}
}
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('java') && pluginManager.hasPlugin('maven-publish')) {
configure(project) {
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
getByName(project.name) {
from components.java
// Do not change artifact ID if already overriden at project level.
if (artifactId == project.name) {
artifactId = "proguard-$project.name"
}
}
}
}
}
}
}
}
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('com.jfrog.bintray') && pluginManager.hasPlugin('maven-publish')) {
configure(project) {
bintray {
Publication rootPub = rootProject.publishing.publications.parent
Publication pub = project.publishing.publications.getByName(project.name)
user = findProperty('PROGUARD_BINTRAY_USER')
key = findProperty('PROGUARD_BINTRAY_KEY')
publications = [project.name]
dryRun = false
override = true
pkg {
repo = 'proguard'
name = "$project.group:$pub.artifactId"
desc = pub.artifactId
licenses = ['GPL-2.0']
websiteUrl = rootPub.pom.url.get()
issueTrackerUrl = rootPub.pom.issueManagement.url.get()
vcsUrl = rootPub.pom.scm.url.get()
version {
name = project.version
gpg.sign = true
released = new Date()
}
}
}
}
}
}
}
publishing {
publications {
parent {
artifactId = "proguard-parent"
pom {
description = 'ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier.'
url = 'https://www.guardsquare.com/proguard'
licenses {
license {
name = 'GNU General Public License, Version 2'
url = 'https://www.gnu.org/licenses/gpl-2.0.txt'
distribution = 'repo'
}
}
issueManagement {
system = 'Github Tracker'
url = 'https://github.com/Guardsquare/proguard/issues'
}
scm {
url = 'https://github.com/Guardsquare/proguard.git'
connection = 'scm:git:https://github.com/Guardsquare/proguard.git'
}
}
}
}
}
distributions {
main {
distributionBaseName.set('proguard')
contents {
into('lib') {
from tasks.getByPath(':base:fatJar').outputs
from tasks.getByPath(':gui:fatJar').outputs
from tasks.getByPath(':retrace:fatJar').outputs
}
into('docs') {
from('docs/md') {
includeEmptyDirs = false
include '**/*.md'
}
}
from(rootDir) {
include 'bin/'
include 'examples/'
include 'LICENSE'
include 'LICENSE_exception.md'
}
}
}
}
distTar {
compression = Compression.GZIP
archiveExtension.set('tar.gz')
}
clean {
delete file("$rootDir/lib")
// TODO docker runs as root, so cannot clean the HTML yet
// delete buildDocumentation.outputs
}