This repository was archived by the owner on Nov 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
133 lines (112 loc) · 3.79 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
import org.ajoberstar.grgit.Tag
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '4.1.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
def privateProps = new Properties()
def privatePropsFile = file("private.properties")
if(privatePropsFile.exists())
privatePropsFile.withInputStream { privateProps.load(it) }
ext {
getHeadId = {
return grgit.head().abbreviatedId
}
getHeadTag = {
def headId = grgit.head().id
def headTag = null
grgit.tag.list().forEach {
def tag = it as Tag
if(tag.commit.id == headId) headTag = tag
}
return headTag
}
PRIVATE = privateProps
}
def getVersion(boolean strict = false) {
def headTag = rootProject.ext.getHeadTag()
def tagName = null
if (headTag != null && (tagName = headTag.name).matches('^v[0-9]+\\.[0-9]+\\.[0-9]+$')) {
return (tagName as String).substring(1)
} else {
if(strict) {
if (headTag == null) throw new IllegalStateException("Commit HEAD is not tagged.")
else throw new IllegalStateException("Commit HEAD tag '${tagName}' does not meet the required versioning scheme.")
} else return "dev-${rootProject.ext.getHeadId()}" as String
}
}
group 'work.lclpnet'
archivesBaseName = 'launcher-logic'
version getVersion()
sourceCompatibility = targetCompatibility = '16'
repositories {
mavenCentral()
}
dependencies {
implementation 'info.picocli:picocli:4.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'org.apache.commons:commons-compress:1.20'
implementation 'org.tukaani:xz:1.8'
implementation 'com.google.code.findbugs:jsr305:3.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
test {
useJUnitPlatform()
}
jar {
manifest.attributes(
'Main-Class': 'work.lclpnet.launcherlogic.LauncherLogic'
)
}
shadowJar {
dependencies {
include(dependency('info.picocli:picocli:.*'))
include(dependency('com.google.code.gson:gson:.*'))
include(dependency('org.jsoup:jsoup:.*'))
include(dependency('org.apache.commons:commons-compress:.*'))
include(dependency('org.tukaani:xz:.*'))
}
// Relocate to prevent conflicts with other mods that include it
relocate 'picocli', 'shadow.picocli'
relocate 'com.google.gson', 'shadow.com.google.gson'
relocate 'org.jsoup', 'shadow.org.jsoup'
relocate 'org.apache.commons.compress', 'shadow.org.apache.commons.compress'
relocate 'org.tukaani.xz', 'shadow.org.tukaani.xz'
archiveClassifier.set('') // Replace the default JAR
}
tasks.build.dependsOn('shadowJar')
tasks.publish.dependsOn({
def versionTest = getVersion(true)
println("Publishing version '${versionTest}'...")
})
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = archivesBaseName
from components.java
pom {
name = 'LauncherLogic'
description = 'A java program to manage some actions from the LCLPLauncher.'
}
}
}
repositories {
maven {
if (privateProps.containsKey('mavenPassword')
&& privateProps.containsKey('mavenHost')
&& privateProps.containsKey('mavenUser')) {
credentials {
username privateProps.getProperty('mavenUser')
password privateProps.getProperty('mavenPassword')
}
url privateProps.getProperty('mavenHost')
} else {
url "file:///${project.projectDir}/repo"
}
}
}
}