Flywheel/buildSrc/platforms.gradle

68 lines
2.3 KiB
Groovy
Raw Normal View History

evaluationDependsOn(':common')
loom {
runs {
client {
ideConfigGenerated true
// Turn on our own debug flags
property 'flw.dumpShaderSource', 'true'
property 'flw.debugMemorySafety', 'true'
// Turn on mixin debug flags
property 'mixin.debug.export', 'true'
property 'mixin.debug.verbose', 'true'
// 720p baby!
programArgs '--width', '1280', '--height', '720'
}
// We're a client mod, but we need to make sure we correctly render when playing on a server.
server {
ideConfigGenerated true
programArgs '--nogui'
}
}
}
tasks.named('processResources', ProcessResources).configure { ProcessResources processResources ->
processResources.from project(':common').tasks.named('processResources', ProcessResources).get().source
}
tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava ->
compileJava.source project(':common').tasks.named('compileJava', JavaCompile).get().source
excludeDuplicatePackageInfos(compileJava)
}
tasks.named('javadoc', Javadoc).configure { Javadoc javadoc ->
javadoc.source project(':common').tasks.named('javadoc', Javadoc).get().source
excludeDuplicatePackageInfos(javadoc)
}
tasks.named('jar', Jar).configure { Jar jar ->
excludeDuplicatePackageInfos(jar)
}
tasks.named('sourcesJar', Jar).configure { Jar jar ->
def commonSources = project(':common').tasks.named('sourcesJar', Jar)
dependsOn commonSources
jar.from zipTree(commonSources.flatMap { it.archiveFile })
excludeDuplicatePackageInfos(jar)
}
// We have duplicate packages between the common and platform dependent subprojects.
// In theory the package-info.java files should be identical, so just take the first one we find.
static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) {
copyTask.filesMatching('**/package-info.java') {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
// The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling.
static void excludeDuplicatePackageInfos(SourceTask sourceTask) {
// FIXME: actually scan the files and exclude the duplicates
// may be tough because the files have absolute paths
sourceTask.exclude('**/package-info.java')
}