-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
122 lines (103 loc) · 3.29 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
plugins {
id("java")
id("maven-publish")
id("java-gradle-plugin")
id("idea")
}
group = "babric"
base.archivesName = project.name
def baseVersion = "1.7"
def ENV = System.getenv()
if (ENV.containsKey("GITHUB_RUN_NUMBER")) {
version = baseVersion + "." + ENV["GITHUB_RUN_NUMBER"]
} else {
version= "${baseVersion}.local"
}
repositories {
maven { url = "https://maven.fabricmc.net/" }
maven {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
}
mavenCentral()
}
dependencies {
implementation(gradleApi())
implementation("net.fabricmc:fabric-loom:${baseVersion}-SNAPSHOT")
compileOnly("net.fabricmc:mapping-io:0.6.1")
api("babric:stitch:0.6.2-babric.1")
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
jar {
manifest {
attributes 'Implementation-Version': project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
}
gradlePlugin {
plugins {
babricLoomExtension {
id = 'babric-loom-extension'
implementationClass = 'babric.BabricLoomPlugin'
}
}
}
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
publishing {
publications {
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'
from components.java
}
// Manually crate the plugin marker for snapshot versions
snapshotPlugin(MavenPublication) { publication ->
groupId 'babric-loom-extension'
artifactId 'babric-loom-extension.gradle.plugin'
version baseVersion + '-SNAPSHOT'
pom.withXml({
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
Element root = asElement()
Document document = root.getOwnerDocument()
Node dependencies = root.appendChild(document.createElement('dependencies'))
Node dependency = dependencies.appendChild(document.createElement('dependency'))
Node groupId = dependency.appendChild(document.createElement('groupId'))
groupId.setTextContent('babric')
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent('babric-loom-extension')
Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT')
})
}
}
repositories {
maven {
if (ENV.MAVEN_URL) {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}