forked from TheCBProject/DiffPatch
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
191 lines (169 loc) · 5.73 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
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id "net.covers1624.signing" version '1.0.0.2'
}
group 'codechicken'
archivesBaseName = 'DiffPatch'
version '1.5.0'
targetCompatibility = "1.8"
sourceCompatibility = "1.8"
def signProps = [:]
if (System.getenv("KEY_STORE")) {
println "Using Env variables for jar signing."
signProps['keyStore'] = System.getenv("KEY_STORE")
file(System.getenv("KEY_STORE_PROPS")).withReader {
def props = new Properties()
props.load(it)
signProps.putAll(props)
}
} else if (project.hasProperty('keyStore')) {
println "Using Project properties for jar signing."
signProps['keyStore'] = project.getProperty('keyStore')
signProps['storePass'] = project.getProperty('keyStorePass')
signProps['alias'] = project.getProperty('keyStoreAlias')
signProps['keyPass'] = project.getProperty('keyStoreKeyPass')
} else {
println 'No signing secrets found, build will not be signed.'
}
version = "$version." + (System.getenv("BUILD_NUMBER") ?: "1")
println "Starting build of ${archivesBaseName}, Version: ${version}"
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://maven.covers1624.net/' }
}
sourceSets {
create('gradle')
main
}
configurations {
shadow
implementation.extendsFrom shadow
gradleImplementation.extendsFrom implementation
}
dependencies {
shadow 'net.covers1624:Quack:0.4.7.72'
shadow 'it.unimi.dsi:fastutil:8.3.1'
shadow 'org.apache.commons:commons-lang3:3.9'
shadow 'org.apache.commons:commons-compress:1.18'
shadow 'org.tukaani:xz:1.8'
shadow 'net.sf.jopt-simple:jopt-simple:5.0.4'
gradleImplementation sourceSets.main.output
gradleCompileOnly gradleApi()
compileOnly 'org.jetbrains:annotations:23.1.0'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
}
test {
useJUnitPlatform()
}
signing {
if (!signProps.empty) {
jars {
sign jar
sign shadowJar
keyStore = signProps.keyStore
alias = signProps.alias
storePass = signProps.storePass
keyPass = signProps.keyPass
}
}
}
def commonManifest = {
attributes 'Main-Class': 'codechicken.diffpatch.DiffPatch'
}
jar {
manifest commonManifest
from file("LICENSE.txt")
from sourceSets.gradle.output
}
shadowJar {
minimize()
manifest commonManifest
configurations = [project.configurations.shadow]
//Include license, exclude java9 and maven things.
from file("LICENSE.txt")
from sourceSets.gradle.output
exclude 'META-INF/maven/**'
exclude 'module-info.class'
//Relocate all our dependencies into a repack package.
relocate 'net.covers1624.quack', 'codechicken.repack.net.covers1624.quack'
relocate 'it.unimi', 'codechicken.repack.it.unimi'
relocate 'org.apache', 'codechicken.repack.org.apache'
relocate 'org.tukaani', 'codechicken.repack.org.tukaani'
relocate 'joptsimple', 'codechicken.repack.joptsimple'
//Transform joptsimple properties files.
transform(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer) {
paths << "joptsimple/ExceptionMessages.properties"
paths << "joptsimple/HelpFormatterMessages.properties"
keyTransformer = { key ->
key.replaceAll('^(joptsimple\\..*)$', 'codechicken.repack.$1')
}
}
}
task srcJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allSource
from file("LICENSE.txt")
}
publishing {
repositories {
if (System.getenv('MAVEN_PASS')) {
maven {
url "https://nexus.covers1624.net/repository/maven-releases/"
credentials {
username 'covers1624'
password System.getenv('MAVEN_PASS')
}
}
}
}
publications {
DiffPatch(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components['java']
artifact shadowJar
artifact srcJar
pom {
name = archivesBaseName
description = archivesBaseName
//The publish plugin doesnt like GString's here apparently..
url = "https://github.com/TheCBProject/${archivesBaseName}".toString()
scm {
url = "https://github.com/TheCBProject/${archivesBaseName}".toString()
connection = "scm:git:git://github.com/TheCBProject/${archivesBaseName}.git".toString()
connection = "scm:git:[email protected]:TheCBProject/${archivesBaseName}.git".toString()
}
issueManagement {
system = 'github'
url = "https://github.com/TheCBProject/${archivesBaseName}/issues".toString()
}
licenses {
license {
name = "MIT"
url = "https://raw.githubusercontent.com/TheCBProject/DiffPatch/master/LICENSE.txt"
distribution = 'repo'
}
}
developers {
developer {
id = 'covers1624'
name = 'covers1624'
}
}
developers {
developer {
id = 'ChickenBones'
name = 'Chicken Bones'
}
}
}
}
}
}