forked from TheCBProject/DiffPatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
155 lines (136 loc) · 4.41 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
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group 'codechicken'
archivesBaseName = 'DiffPatch'
version '1.2.5'
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()
mavenCentral()
}
sourceSets {
create('gradle')
main
}
configurations {
shadow
implementation.extendsFrom shadow
gradleImplementation.extendsFrom implementation
}
dependencies {
gradleImplementation sourceSets.main.output
gradleCompileOnly gradleApi()
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
java {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
test {
useJUnitPlatform()
}
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 'org.apache', 'codechicken.repack.org.apache'
}
tasks.register('srcJar', Jar) {
archiveClassifier = '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:git@github.com: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'
}
}
}
}
}
}