-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
148 lines (129 loc) · 3.79 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
/** The root of the build. Exposed for flexibility, but you shouldn't edit it
unless you have to. Edit project.gradle instead. */
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0' apply false
}
allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
// For some reason this is needed when using Gradle 6.9 (but not if using 4.4.1)
repositories {
mavenCentral()
mavenLocal()
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven/'
}
maven {
url = "https://mvn.falsepattern.com/releases"
}
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
url 'https://jitpack.io'
}
}
apply from: "${project.rootDir}/buildscript/forge-1.7.gradle"
def projectVersion = version
dependencies {
// TODO only include IFMLLoadingPlugin, Mod and ComparableVersion
compileOnly "net.minecraftforge:forge:1.12.2-14.23.5.2860:universal"
}
// When publishing locally, publish every module and use the -1.7.10 suffix.
// Otherwise (for GTNH maven) only publish the -all module and don't use the suffix or the -all name or the unimixins group.
ext.localPublish = System.getenv("MAVEN_USER") == null;
ext.publishModuleToMaven = project.name == "module-all" || localPublish
ext.mavenIdSuffix = localPublish ? "-1.7.10" : ""
ext.mavenGroupId = localPublish ? project.group : project.group.replace(".unimixins", "")
if(project.name.startsWith("module-") && project.name != "module-mixin" && project.name != "module-common") {
if(project.name != "module-all") {
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
}
afterEvaluate {
if(project.name != "module-all") {
task devJar(type: Jar) {
classifier = 'dev'
def jarTask = (jar.enabled ? jar : shadowJar)
from zipTree(jarTask.getOutputs().getFiles().getSingleFile())
manifest = jarTask.manifest
dependsOn jarTask
}
}
reobf.dependsOn devJar
artifacts {
archives tasks."sourcesJar"
archives tasks."devJar"
}
if(publishModuleToMaven) {
publishing {
publications {
create("maven", MavenPublication) {
artifact jar.enabled ? jar : shadowJar
artifact source: tasks."sourcesJar", classifier: 'sources'
artifact source: tasks."devJar", classifier: 'dev'
artifactId = archivesBaseName.substring(1).replace("-1.7.10", mavenIdSuffix).replace("-all", localPublish ? "-all" : "")
version = projectVersion
groupId = mavenGroupId
}
}
}
}
project.tasks.forEach {
if(it.name.startsWith("publish") && it.name.contains("PublicationTo")) {
it.dependsOn reobf
}
}
}
}
publishing {
repositories {
if (System.getenv("MAVEN_USER") != null) {
maven {
url = System.getenv("MAVEN_URL")
allowInsecureProtocol = System.getenv("MAVEN_URL").startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
}
// Put license, credits and readme in jar
delete "$projectDir/build/tmp/license"
copy {
from "$projectDir"
into "$projectDir/build/tmp/license"
include "CREDITS", "LICENSE*", "README*"
}
sourceSets.main.resources.srcDir("build/tmp/license")
}