plugins { id 'base' } apply from: 'gradle/dependencies.gradle' def outputDir = layout.projectDirectory.dir('out/tmp') def distDir = layout.projectDirectory.dir('out') def resourcesDir = layout.projectDirectory.dir('resources') def nativesDir = layout.projectDirectory.dir('natives') tasks.register('cleanOut') { group = 'build' description = 'Deletes the shaded jar output directory (out/tmp)' doLast { delete outputDir } } tasks.register('prepareInjection') { group = 'build' description = 'Copies resources and natives into out/tmp (both flattened)' dependsOn cleanOut dependsOn ':Loader:shadowJar', ':OrangeX:shadowJar' doLast { copy { from resourcesDir into outputDir exclude '**/.gitkeep' } copy { from nativesDir into outputDir } } } tasks.register('injectionZip', Zip) { group = 'build' description = 'Zips out/tmp into out/injection.zip' dependsOn prepareInjection destinationDirectory = distDir archiveFileName = 'injection.zip' from outputDir } tasks.register('packageAll') { group = 'build' description = 'Builds Loader, OrangeX and Injector, then zips out/tmp into out/injection.zip' dependsOn downloadDependencies dependsOn cleanOut dependsOn ':Loader:shadowJar', ':OrangeX:shadowJar', ':Injector:jar' dependsOn injectionZip } subprojects { plugins.withId('java') { java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' if (JavaVersion.current().isJava9Compatible()) { // Fail fast if a post-Java-8 API is used. options.release = 25 } } } tasks.matching { it.name == 'shadowJar' }.configureEach { mustRunAfter rootProject.tasks.named('cleanOut') } } gradle.taskGraph.whenReady { taskGraph -> if (taskGraph.hasTask(':build')) { throw new GradleException('---> The build task is not supported. Please refer to the documentation. <---') } }