forked from ValkyrienSkies/Valkyrien-Skies-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
203 lines (178 loc) · 6.91 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
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
193
194
195
196
197
198
199
200
201
202
203
buildscript {
// Lock plugin dependencies
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
plugins {
// Needed for Forge+Fabric
id "architectury-plugin" version "3.4.146"
id "dev.architectury.loom" version "1.3.355" apply false
id 'io.github.juuxel.loom-vineflower' version '1.11.0' apply false
// Kotlin
id "org.jetbrains.kotlin.jvm" version "1.9.10" apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.modrinth.minotaur" version "2.4.3" apply false
}
// Determine the version
if (project.hasProperty("CustomReleaseVersion")) {
// Remove release/ from the version if present
version = project.property("CustomReleaseVersion").replaceFirst("^release/", "")
} else {
String gitRevision = "git rev-parse HEAD".execute().text.trim()
version = mod_version + "+" + gitRevision.substring(0, 10)
}
architectury {
minecraft = rootProject.minecraft_version
}
// Lock dependencies
// https://docs.gradle.org/current/userguide/dependency_locking.html
dependencyLocking {
lockAllConfigurations()
}
tasks.register("updateVsCore") {
File versionFile = null
File gradleProperties = file("gradle.properties")
try {
def vsCoreBuild = gradle.includedBuild("vs-core")
versionFile = new File(vsCoreBuild.projectDir, "api-game/build/version.txt")
inputs.file(versionFile)
outputs.file(gradleProperties)
dependsOn(vsCoreBuild.task(":api-game:writeVersion"))
[':impl', ':api', ':api-game', ':util'].each {
dependsOn(vsCoreBuild.task("${it}:publishToMavenLocal"))
}
} catch (UnknownDomainObjectException ignore) {}
onlyIf {
versionFile != null
}
doLast {
def vsCoreVersion = versionFile.text
def newGradleProperties = gradleProperties.text.replaceFirst("(?m)^vs_core_version=.*", "vs_core_version=" + vsCoreVersion)
gradleProperties.write(newGradleProperties)
}
}
subprojects {
apply plugin: "dev.architectury.loom"
// Apply checkstyle and ktlint to check the code style of every sub project
apply plugin: "org.jetbrains.kotlin.jvm"
apply plugin: "io.github.juuxel.loom-vineflower"
configurations.each { it.resolutionStrategy.useGlobalDependencySubstitutionRules.set(false) }
repositories {
try {
def vsCoreBuild = gradle.includedBuild("vs-core")
mavenLocal {
content {
includeGroup("org.valkyrienskies.core")
}
}
[':impl', ':api', ':api-game'].each {
compileJava.dependsOn(vsCoreBuild.task("${it}:publishToMavenLocal"))
}
} catch (UnknownDomainObjectException ignore) {}
mavenCentral()
maven {
url "https://cursemaven.com"
content {
includeModule "curse.maven", "kotlinforforge-351264"
}
}
maven {
name = "Valkyrien Skies Internal"
url = project.vs_maven_url ?: 'https://maven.valkyrienskies.org'
if (project.vs_maven_username && project.vs_maven_password) {
credentials {
username = project.vs_maven_username
password = project.vs_maven_password
}
}
}
if (!project.block_external_repositories) {
mavenLocal()
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
}
maven { url = "https://cursemaven.com" }
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu
maven {
name = 'Kotlin for Forge'
url = 'https://thedarkcolour.github.io/KotlinForForge/'
}
maven {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Suggestion Tweaker
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://mvn.devos.one/snapshots/" } // Fabric Create, Porting Lib, Forge Tags, Milk Lib
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // Forge Config API Port
maven { url = "https://maven.tterrag.com/" } // Registrate, Forge Create and Flywheel
maven { url = "https://maven.cafeteria.dev/releases" } // Fake Player API
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven {
url = "https://maven.realrobotix.me/createbigcannons/" // Create Big Cannons
content {
includeGroup "com.rbasamoyai"
}
}
}
}
// Remove automatically added repos
if (project.block_external_repositories) {
repositories.removeIf {
def url = it.url.toString()
url.contains("maven.minecraftforge.net") ||
url.contains("maven.fabricmc.net") ||
url.contains("maven.architectury.dev")
}
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
// Set the base name, version, and group to the values in the gradle.properties
archivesBaseName = rootProject.archives_base_name
version = rootProject.version
group = rootProject.maven_group
publishing {
repositories {
if (project.vs_maven_username && project.vs_maven_password) {
println "Publishing to VS Maven ($version)"
maven {
name = "VSMaven"
url = project.vs_maven_url
credentials {
username = project.vs_maven_username
password = project.vs_maven_password
}
}
}
if (System.getenv("GITHUB_ACTOR") != null) {
println "Publishing to Github Packages ($version)"
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ValkyrienSkies/Valkyrien-Skies-2")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}
java {
withSourcesJar()
}
}