2024-04-22 20:51:28 +02:00
|
|
|
plugins {
|
2024-04-27 02:04:00 +02:00
|
|
|
id 'idea'
|
|
|
|
id 'java'
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'dev.architectury.loom'
|
|
|
|
id 'flywheel.java'
|
|
|
|
id 'flywheel.package-infos'
|
2024-04-25 19:37:12 +02:00
|
|
|
id 'flywheel.subproject'
|
2024-04-28 04:25:02 +02:00
|
|
|
id 'flywheel.jar-sets'
|
2024-04-22 20:51:28 +02:00
|
|
|
}
|
|
|
|
|
2024-04-24 23:06:20 +02:00
|
|
|
sourceSets {
|
|
|
|
// Loom only populates mc stuff to the main source set,
|
|
|
|
// so grab that here and use it for the others.
|
|
|
|
// Note that the `+` operator does NOT perform a deep copy
|
|
|
|
// of a FileCollection, so this object is shared between
|
|
|
|
// the source sets and we should avoid mutating it.
|
|
|
|
FileCollection mcCompileClassPath = main.compileClasspath
|
|
|
|
|
|
|
|
SourceSet api = api {
|
|
|
|
compileClasspath = mcCompileClassPath
|
|
|
|
}
|
|
|
|
SourceSet lib = lib {
|
|
|
|
compileClasspath = mcCompileClassPath + api.output
|
|
|
|
}
|
|
|
|
SourceSet backend = backend {
|
|
|
|
compileClasspath = mcCompileClassPath + api.output + lib.output
|
|
|
|
}
|
|
|
|
|
|
|
|
main {
|
|
|
|
// Assign here rather than concatenate to avoid modifying the mcCompileClassPath FileCollection
|
|
|
|
compileClasspath = mcCompileClassPath + api.output + lib.output + backend.output
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
// Only test needs runtimeClasspath filled since the game shouldn't run from common alone.
|
|
|
|
// Fine to concatenate here.
|
|
|
|
compileClasspath += api.output + lib.output + backend.output
|
|
|
|
runtimeClasspath += api.output + lib.output + backend.output
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-28 06:15:42 +02:00
|
|
|
defaultPackageInfos {
|
|
|
|
forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main
|
|
|
|
}
|
|
|
|
|
2024-04-28 04:25:02 +02:00
|
|
|
// For sharing with other subprojects.
|
|
|
|
jarSets {
|
|
|
|
createJars('apiOnly', sourceSets.api).configure {
|
|
|
|
it.createOutgoingConfiguration('common')
|
|
|
|
}
|
|
|
|
createJars('lib').configure {
|
|
|
|
it.createOutgoingConfiguration('common')
|
|
|
|
}
|
|
|
|
createJars('backend').configure {
|
|
|
|
it.createOutgoingConfiguration('common')
|
|
|
|
}
|
|
|
|
createJars('impl', sourceSets.main).configure {
|
|
|
|
it.createOutgoingConfiguration('common')
|
|
|
|
}
|
2024-04-24 23:06:20 +02:00
|
|
|
}
|
|
|
|
|
2024-04-28 04:25:02 +02:00
|
|
|
// For publishing
|
|
|
|
def apiLibJar = jarSets.createJars('api', sourceSets.api, sourceSets.lib)
|
2024-04-22 20:51:28 +02:00
|
|
|
|
2024-04-17 21:05:04 +02:00
|
|
|
dependencies {
|
2024-04-22 02:15:21 +02:00
|
|
|
modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
2024-04-17 21:59:44 +02:00
|
|
|
|
2024-04-20 08:01:28 +02:00
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
|
2024-04-17 21:05:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-20 08:01:28 +02:00
|
|
|
test {
|
2024-04-17 21:05:04 +02:00
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
2024-04-23 09:14:19 +02:00
|
|
|
register('mavenIntermediary', MavenPublication) {
|
2024-04-27 06:23:42 +02:00
|
|
|
artifact apiLibJar.remapJar
|
|
|
|
artifact apiLibJar.remapSources
|
|
|
|
artifact apiLibJar.javadocJar
|
2024-04-28 04:25:02 +02:00
|
|
|
artifactId = "flywheel-common-intermediary-api-${artifact_minecraft_version}"
|
2024-04-17 21:05:04 +02:00
|
|
|
}
|
2024-04-23 09:14:19 +02:00
|
|
|
register('mavenMojmap', MavenPublication) {
|
2024-04-27 06:23:42 +02:00
|
|
|
artifact apiLibJar.jar
|
|
|
|
artifact apiLibJar.sources
|
|
|
|
artifact apiLibJar.javadocJar
|
2024-04-28 04:25:02 +02:00
|
|
|
artifactId = "flywheel-common-mojmap-api-${artifact_minecraft_version}"
|
2024-04-17 21:05:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|