Flywheel/common/build.gradle
Jozufozu 1406d21d83 Publicity stunt
- Only publish api/lib and full jars for platforms
- Do not eagerly create outgoing configurations for JarTaskSet
- Add method to create outgoing configuration
- Clean up JarTaskSet creation and move some string constants to statics
- Set @CompileStatic
- Remove ${name} classifier prefix from JarTaskSet jars
- Put JarTaskSet jars into subdirectories in the output folders
- Add configure and configureEach methods to JarTaskSet
- Rename OutgoingConfigurationPlugin -> JarSetPlugin and move extension
  to root module so idea offers completions in gradle files
- Standardize artifact naming flywheel-$platform(-api)?-$mcversion
2024-05-17 08:43:56 -07:00

88 lines
2.6 KiB
Groovy

plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'dev.architectury.loom'
id 'flywheel.java'
id 'flywheel.package-infos'
id 'flywheel.subproject'
id 'flywheel.jar-sets'
}
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
}
}
// 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')
}
}
// For publishing
def apiLibJar = jarSets.createJars('api', sourceSets.api, sourceSets.lib)
dependencies {
modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}
test {
useJUnitPlatform()
}
publishing {
publications {
register('mavenIntermediary', MavenPublication) {
artifact apiLibJar.remapJar
artifact apiLibJar.remapSources
artifact apiLibJar.javadocJar
artifactId = "flywheel-common-intermediary-api-${artifact_minecraft_version}"
}
register('mavenMojmap', MavenPublication) {
artifact apiLibJar.jar
artifact apiLibJar.sources
artifact apiLibJar.javadocJar
artifactId = "flywheel-common-mojmap-api-${artifact_minecraft_version}"
}
}
}