-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild.gradle
More file actions
200 lines (166 loc) · 4.87 KB
/
build.gradle
File metadata and controls
200 lines (166 loc) · 4.87 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
193
194
195
196
197
198
199
200
import com.xpdustry.toxopid.spec.ModMetadata
import com.xpdustry.toxopid.spec.ModPlatform
plugins {
id "java"
id "com.xpdustry.toxopid" version "4.2.0"
id "net.kyori.indra.publishing" version "4.0.0"
}
def metadata = ModMetadata.fromJson(file("mod.hjson"))
allprojects {
apply plugin: "java"
apply plugin: "com.xpdustry.toxopid"
group = "com.xpdustry.${metadata.name}"
version = metadata.version
description = metadata.description
sourceSets.main.java.srcDirs = ["src"]
sourceSets.main.resources.srcDirs = ["resources"]
toxopid.compileVersion = "v${metadata.minGameVersion}"
ext.compileVersionV8 = "157"
ext.arcNet = "com.github.Anuken.Arc:arcnet:${toxopid.compileVersion}" //toxopid.dependencies.arcnet
repositories {
mavenCentral()
maven { url "https://maven.xpdustry.com/mindustry" }
maven { url "https://maven.xpdustry.com/releases" }
maven { url "https://www.jitpack.io" }
}
// Force java 1.8
compileJava {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_21
options.encoding = "UTF-8"
options.release = 8
options.compilerArgs += ["-Xlint:-options", "-Xlint:unchecked"]
}
dependencies {
annotationProcessor "com.xpdustry:jabel:1.1.0"
}
}
project(":common") {
dependencies {
compileOnly toxopid.dependencies.arcCore
compileOnly arcNet
}
}
project(":api") {
dependencies {
implementation project(":common")
compileOnly toxopid.dependencies.arcCore
compileOnly arcNet
}
}
project(":client") {
toxopid.platforms = [ModPlatform.DESKTOP, ModPlatform.ANDROID]
dependencies {
implementation project(":common")
implementation project(":api")
compileOnly toxopid.dependencies.arcCore
compileOnly toxopid.dependencies.mindustryCore
}
jar.from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
mergeJar {
archiveFileName = "${metadata.name}-${project.name}.jar"
// Includes mod json and icon
from(rootDir) {
include "mod.hjson"
include "icon.png"
}
}
// Includes android dex
build.dependsOn mergeJar
// For testing
runMindustryDesktop.mods.from(mergeJar)
task run(dependsOn: runMindustryDesktop) {
//toxopid.compileVersion = "v${project.compileVersionV8}"
}
}
project(":server") {
ext.mainClassName = "com.xpdustry.claj.server.Main"
toxopid.platforms = [ModPlatform.SERVER]
toxopid.compileVersion = "v${project.compileVersionV8}"
dependencies {
implementation project(":common")
implementation toxopid.dependencies.arcCore
implementation arcNet
implementation toxopid.dependencies.arcHeadless
}
jar {
archiveFileName = "${metadata.name}-${project.name}.jar"
manifest.attributes["Main-Class"] = project.mainClassName
manifest.attributes["Claj-Version"] = metadata.version
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
//TODO: use arc-lite
//exclude "arc/assets/**", "arc/audio/**", "arc/input/**", "arc/scene/**", "arc/util/noise/**", "arc/util/viewport/**"
}
task run(dependsOn: classes, type: JavaExec) {
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = temporaryDir
args 7000 // default port
jvmArgs "-DClaj-Version=${metadata.version}" // claj version
}
}
task release(dependsOn: subprojects.build, type: Copy) {
subprojects.each {
from it.layout.buildDirectory.dir("libs")
include "${metadata.name}-*.jar"
}
into layout.buildDirectory.dir("release")
//into rootDir
}
// To shut up Javadoc
javadoc.options{
addStringOption("Xdoclint:none", "-quiet")
}
// Publishing
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
}
indra {
javaVersions {
target(8)
minimumToolchain(8)
}
gpl3OnlyLicense()
publishReleasesTo("xpdustry", "https://maven.xpdustry.com/releases")
def repo = metadata.repository.split("/")
github(repo[0], repo[1]) {
ci(true)
issues(true)
scm(true)
}
configurePublications {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
organization {
name = "Xpdustry"
url = "https://www.xpdustry.com"
}
developers {
metadata.author.split(",").each { author ->
developer {
id = author.trim()
url = "https://github.com/${author.trim()}"
}
}
}
}
}
}
// I want these to only be included when publishing, not all the time...
task javadocJar(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}
task sourcesJar(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}