-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
165 lines (138 loc) · 4.43 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
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'gsl-starplane' version '0.2.1-a20241109'
id 'me.champeau.mrjar' version '0.1.1'
id 'eclipse'
}
group 'de.geolykt'
version '2.0.0'
base {
archivesName = 'starloader-api'
}
multiRelease {
targetVersions 8, 9
}
repositories {
mavenCentral()
maven {
name 'stianloader-maven'
url 'https://stianloader.org/maven'
}
mavenLocal()
}
starplane {
withRAS(rootProject.file("src/main/resources/starloader-api.ras"))
eclipseEEA = rootProject.file("src/eclipse-eea")
}
deployMods {
// No external mods need to be used as of yet
}
runMods {
from components["java"]
debug false
systemProperties.put("classloader.dump", true)
}
configurations {
compileOnlyApi.extendsFrom(galimulatorDependencies)
}
dependencies {
// The launcher - the heart of this project; Note that we now adopt a "bring your own launcher" model
// so we don't actually force the usage of micromixin on others; Other projects can make use of more modern
// launcher versions or even other variants such as those making use of the spongeian mixin implementation
compileOnly "org.stianloader:launcher-micromixin:4.0.0-a20240825"
devRuntime "org.stianloader:launcher-micromixin:4.0.0-a20240825"
compileOnly "org.stianloader:micromixin-annotations:0.7.1-a20241021"
compileOnly "de.geolykt.starloader:starplane-annotations:1.0.0"
compileOnlyApi "org.jetbrains:annotations:26.0.1"
testImplementation 'junit:junit:4.12'
testImplementation 'org.ow2.asm:asm-util:9.7'
}
// Yes, we are using Java 11 to build. But actually Java 8 for compilation.
// However, the javadoc tool is absolutely bricked with Java 8 - so we straight up use Java 17.
tasks.withType(Javadoc) {
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
javadoc {
options {
addBooleanOption('html5', true)
tags("apiNote:a:API Notice:", "implSpec:a:Implementation Specification:", "implNote:a:Implementation Notice:")
links "https://docs.oracle.com/en/java/javase/17/docs/api/"
}
// see https://stackoverflow.com/a/56641766
doLast {
// Append the fix to the file
def searchScript = new File(destinationDir, '/search.js')
searchScript.append '\n\n' +
'getURLPrefix = function(ui) {\n' +
' return \'\';\n' +
'};\n'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
remapJar {
archiveClassifier = 'remapped'
fromJar jar
inputs.file jar.archiveFile
}
task jarVerification(type: de.geolykt.starloader.gslstarplane.GslVerifyRemapperJarTask, dependsOn: remapJar) {
includingGalimulatorJar = true
validationJar = remapJar.archiveFile
}
check {
dependsOn jarVerification
}
build {
dependsOn remapJar
}
publish {
dependsOn publishToMavenLocal // Gradle doesn't quite like this line but otherwise I get issues when publishing so what gives?
}
publishing {
publications {
plugin(MavenPublication) { publication ->
groupId project.group
artifactId project.base.archivesName.get()
version '2.0.0'
from components['java']
artifact sourcesJar
artifact javadocJar
artifact remapJar
}
}
repositories {
if (System.getProperty('publishRepo') != null) {
maven {
url System.getProperty('publishRepo')
allowInsecureProtocol = true
}
} else {
mavenLocal()
}
}
}
// Unfortunately Eclipse does not have per-sourceset java versions so
// of course it will have quite the issues when seeing java 9 classes in an otherwise
// java 8 project. In the end I have opted in using the traditional maven style of dealing with the issue:
// Ignoring the java 9 source set.
eclipse {
classpath {
file {
whenMerged {
entries.removeIf { it.path == 'src/main/java9' }
entries.removeIf { it.path == project.file('build/classes/java/main').getAbsolutePath() }
entries.removeIf { it.path == project.file('build/classes/java/java9').getAbsolutePath() }
}
}
}
}