This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
generated from GregTech-Intergalactical/ExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
142 lines (116 loc) · 4.17 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
import org.gradle.api.tasks.compile.JavaCompile
plugins {
id "maven-publish"
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply(false)
id "com.github.johnrengelman.shadow" version "7.0.0" apply(false)
}
architectury {
minecraft = rootProject.minecraft_version
}
//Print out JVM information so that we know what version is running. Extreamly useful for people to know when helping you.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")
def gitHash() {
String hash = System.getenv("GITHUB_SHA")
if (hash != null) return hash.substring(0,8)
return ""
}
allprojects {
apply plugin: "maven-publish"
apply plugin: "java"
apply plugin: "architectury-plugin"
group = rootProject.maven_group
apply from: 'https://raw.githubusercontent.com/GregTech-Intergalactical/GradleSripts/main/repositories.gradle'
java {
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
}
if (isCI) {
if (!isRELEASE){
version = version + "-" + gitHash()
println("Not in CI Release mode")
}
println("In CI mode")
}
}
subprojects {
apply plugin: "dev.architectury.loom"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
if (!project.path.contains("common")){
apply plugin: "com.github.johnrengelman.shadow"
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
if (project.path.contains("forge")){
developmentForge.extendsFrom common
} else{
developmentFabric.extendsFrom common
}
}
shadowJar {
configurations = [project.configurations.shadowCommon]
archiveClassifier.set "dev-shadow"
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set null
}
jar {
archiveClassifier.set "dev"
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
}
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.mappings_version}@zip")
}
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.17.1+build.32:v2"
}
publishing {
publications {
mavenJava(org.gradle.api.publish.maven.MavenPublication) {
artifactId = "gtrubber-" + project.name
artifact(sourcesJar) {
builtBy remapSourcesJar
}
afterEvaluate {
artifact remapJar
if (project.name != "common"){
artifact shadowJar
}
}
}
}
repositories {
if (isCI && isRELEASE) {
maven {
url = "https://repo.repsy.io/mvn/trinsdar/gregtech-intergalactical/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
} else {
maven { url "file:///${project.projectDir}/mcmodsrepo"}
}
}
}
}