-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
120 lines (103 loc) · 3.48 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
plugins {
id 'java'
id 'maven-publish'
id 'java-gradle-plugin'
id 'idea'
}
group 'net.legacyfabric'
base.archivesName = project.name
def baseVersion = '1.7'
def ENV = System.getenv()
if (ENV.GITHUB_RUN_NUMBER) {
version = baseVersion + '.' + ENV.GITHUB_RUN_NUMBER
} else {
version = baseVersion + '.local'
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
}
dependencies {
implementation gradleApi()
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.guava:guava:33.0.0-jre")
implementation("net.fabricmc:fabric-loom:${baseVersion}-SNAPSHOT")
// implementation("net.fabricmc:fabric-loom:${baseVersion}.0-alpha.5")
// needed for 'validatePlugins' task, same version as used by fabric-loom
compileOnly("net.fabricmc:mapping-io:0.6.1")
}
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 {
legacyLooming {
id = 'legacy-looming'
implementationClass = 'net.legacyfabric.legacylooming.LegacyLoomingGradlePlugin'
}
}
}
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 'legacy-looming'
artifactId 'legacy-looming.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('net.legacyfabric')
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent('legacy-looming')
Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT')
})
}
}
repositories {
if (ENV.MAVEN_PUBLISH_CREDENTIALS) {
maven {
url "https://repo.legacyfabric.net/repository/legacyfabric"
credentials {
username ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[0]
password ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[1]
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}