-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
116 lines (100 loc) · 3.03 KB
/
build.gradle
File metadata and controls
116 lines (100 loc) · 3.03 KB
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
plugins {
id 'java-library'
id 'maven-publish'
}
allprojects {
apply plugin: "java-library"
apply plugin: "maven-publish"
version = project.api_version + (System.getenv("CI") && !project.hasProperty("isRelase") ? ("-" + System.getenv("GITHUB_SHA").substring(0, 8)) : "")
group = project.maven_group
configurations {
library
}
repositories {
mavenCentral()
maven {
name = 'Quantum'
url = 'https://maven.quantumclient.org/snapshots'
}
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name "Quantum-snapshots"
url "https://maven.quantumclient.org/snapshots"
credentials {
username = System.getenv('MAVEN_USERNAME')
password = System.getenv('MAVEN_PASSWORD')
}
authentication {
basic(BasicAuthentication)
}
}
maven {
name "Quantum-releases"
url "https://maven.quantumclient.org/releases"
credentials {
username = System.getenv('MAVEN_USERNAME')
password = System.getenv('MAVEN_PASSWORD')
}
authentication {
basic(BasicAuthentication)
}
ext.releases = true
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/UtilityMods/FriendAPI")
credentials {
username = System.getenv("GH_USERNAME")
password = System.getenv("GH_TOKEN")
}
ext.releases = true
}
}
}
afterEvaluate {
tasks.withType(PublishToMavenRepository).all { publishTask ->
publishTask.onlyIf { task ->
if (task.repository.hasProperty('releases') && !project.hasProperty("isRelase")) {
task.enabled = false
task.group = null
return false
}
return true
}
}
}
jar {
from {
configurations.library.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
}
task buildAll(group: 'build') {
subprojects.forEach {
buildAll.dependsOn(it.tasks.sourcesJar)
buildAll.dependsOn(it.tasks.build)
}
}
task publishAll(group: 'publishing') {
subprojects.forEach(p -> publishAll.dependsOn(p.tasks.publish))
}