This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
127 lines (104 loc) · 3.13 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
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'com.github.hierynomus.license' version '0.16.1'
id 'net.kyori.blossom' version '1.2.0'
id 'maven-publish'
}
ext.url = 'https://qsml.dualspiral.co.uk'
group 'uk.co.drnaylor'
def artifactName = 'quickstart-moduleloader'
version '0.12.1-SNAPSHOT'
defaultTasks 'licenseFormat'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
api "org.spongepowered:configurate-core:3.7.1"
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
testImplementation "org.spongepowered:configurate-gson:3.7.1"
testImplementation 'junit:junit:4.13.2'
testImplementation "org.mockito:mockito-core:1.10.19"
}
license {
ext.name = 'QuickStart Module Loader'
exclude "**/*.info"
exclude "**/*.json"
exclude "assets/**"
exclude "*.properties"
header file('HEADER.txt')
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
blossom {
def location = 'src/main/java/uk/co/drnaylor/quickstart/Metadata.java'
// replaceToken '@id@', project.name.toLowerCase(), location
replaceToken '@name@', 'QuickStart Module Loader', location
replaceToken '@version@', project.version, location
replaceToken '@informativeVersion@', project.version + "+" + getGitHash(), location
}
jar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': archiveVersion,
'Git-Hash': getGitHash()
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
private String getGitHash() {
def process = 'git rev-parse --short HEAD'.execute();
process.waitFor();
return process.exitValue() ? 'unknown' : process.text.trim();
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = group
artifactId = artifactName
version = version
}
}
repositories {
def githubToken = System.getenv("GITHUB_TOKEN")
if (githubToken != null) {
maven {
name = "GitHubPackages"
url = project.uri(project.property("ghUri") + project.property("ghSlug"))
credentials {
username = System.getenv("GITHUB_ACTOR")
password = githubToken
}
}
}
def artifactoryToken = System.getenv("ARTIFACTORY_TOKEN")
if (artifactoryToken != null) {
maven {
name = "Artifactory"
url = project.uri(System.getenv("ARTIFACTORY_URL"))
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = artifactoryToken
}
}
}
}
}