-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
192 lines (159 loc) · 5.65 KB
/
build.gradle
File metadata and controls
192 lines (159 loc) · 5.65 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
plugins {
id 'idea'
id 'maven-publish'
id 'me.modmuss50.mod-publish-plugin' version '0.8.4' apply false
id 'net.neoforged.moddev' version '2.0.141' apply false
id 'net.fabricmc.fabric-loom-companion' version '1.14.4' apply false
id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' apply false
}
def javaVersion = 25
def ENV = System.getenv()
version = mod_version
group = mod_group_id
allprojects {
tasks.register('buildAndRelease') {
dependsOn(tasks.build, tasks.publish)
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'me.modmuss50.mod-publish-plugin'
project.group = rootProject.group
project.version = rootProject.version
base {
archivesName.set(mod_id)
}
version = "${rootProject.mod_version}+${rootProject.minecraft_version}"
repositories {
exclusiveContent {
forRepository {
maven {
url = "https://nexus.resourcefulbees.com/repository/telepathicgrunt/"
}
}
filter {
includeGroupAndSubgroups("com.telepathicgrunt")
}
}
}
dependencies {
compileOnly "org.jetbrains:annotations:${jetbrains_annotations_version}"
}
processResources {
filteringCharset "UTF-8"
def expandProps = [
"version" : project.version,
"maven_group_id" : project.mod_group_id,
"mod_id" : project.mod_id,
"mod_display_name" : project.mod_name,
"mod_description" : project.mod_description,
"sources_url" : project.sources_url,
"issues_url" : project.issues_url,
"license_url" : project.license_url,
"homepage_url" : project.homepage_url,
"minecraft_version" : project.minecraft_version,
"neoforge_version" : project.neoforge_version,
"fabric_loader_version": project.fabric_loader_version,
"java_version" : "${javaVersion}",
]
filesMatching(['pack.mcmeta', '*.mod.json', 'META-INF/neoforge.mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}
java {
if (JavaVersion.current() < JavaVersion.toVersion(javaVersion)) {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
}
} else {
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}
withSourcesJar()
// withJavadocJar()
}
javadoc {
// make javadoc not throw on mixin's '@reason'
options.tags = ["reason"]
}
jar {
def licenseFile = rootProject.file("LICENSE.txt")
inputs.file(licenseFile)
from(licenseFile) {
rename { "LICENSE.txt" }
}
}
sourcesJar {
def licenseFile = rootProject.file("LICENSE.txt")
inputs.file(licenseFile)
from(licenseFile) {
rename { "LICENSE.txt" }
}
}
tasks.withType(JavaCompile).configureEach {
options.release.set(javaVersion)
}
project.tasks.publishMods.mustRunAfter project.tasks.publish
project.tasks.buildAndRelease.dependsOn(project.tasks.publish).dependsOn(project.tasks.publishMods)
publishing {
repositories {
if (ENV.MAVEN_USER) {
maven {
url = uri("https://nexus.resourcefulbees.com/repository/telepathicgrunt/")
credentials {
username ENV.MAVEN_USER
password ENV.MAVEN_PASS
}
}
}
}
publications {
"mavenJava${project.name}"(MavenPublication) {
from components.java
artifactId "CommandStructures-${project.name.capitalize()}"
pom {
name = project.mod_name
description = project.mod_description
url = project.sources_url
scm {
connection = "git:${project.sources_url}.git"
developerConnection = "git:${project.sources_url}.git"
url = project.sources_url
}
licenses {
license {
name = 'MIT License'
url = project.license_url
}
}
developers {
developer {
id = 'telepathic_grunt'
name = 'TelepathicGrunt'
email = '[email protected]'
}
}
}
}
}
}
publishMods {
type = STABLE
displayName = "${project.mod_name} v${project.mod_version} (${project.minecraft_version} ${project.name.capitalize()})"
version = project.version
def changeLogFile = project.file("CHANGELOG.md")
changelog = changeLogFile.exists() ? changeLogFile.text : ""
}
}
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}