plugins { id "org.jetbrains.kotlin.jvm" version "1.3.72" id "java" id "idea" id "eclipse" id "maven-publish" } group "me.shedaniel" def isSnapshot = System.getenv("PR_NUM") != null def runNumber = (System.getenv("GITHUB_RUN_NUMBER") == null ? (((short) new Random().nextInt()).abs() + 1000).toString() : System.getenv("GITHUB_RUN_NUMBER")) if (!isSnapshot) { version = base_version + "." + runNumber } else { version = base_version + "-PR." + System.getenv("PR_NUM") + "." + runNumber } def pluginId = "architectury-plugin" logger.lifecycle(":building architectury plugin v${version}") sourceCompatibility = targetCompatibility = 1.8 repositories { maven { url "https://maven.fabricmc.net/" } maven { url "https://files.minecraftforge.net/maven/" } maven { url "https://maven.shedaniel.me/" } gradlePluginPortal() } apply plugin: 'java-gradle-plugin' sourceSets { annotationsInject } dependencies { implementation gradleApi() implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72" implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72" implementation "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.10" implementation "me.shedaniel:architectury-transformer:$transformer_version" implementation "me.shedaniel:forgified-fabric-loom:$loom_version" runtime "me.shedaniel:forgified-fabric-loom:$loom_version" implementation "net.fabricmc:tiny-remapper:0.3.0.70" implementation "net.fabricmc:tiny-mappings-parser:0.2.2.14" implementation "org.ow2.asm:asm:8.0" implementation "org.ow2.asm:asm-commons:8.0" implementation "org.ow2.asm:asm-tree:8.0" implementation "org.ow2.asm:asm-util:8.0" implementation "org.zeroturnaround:zt-zip:1.13" implementation "com.google.code.gson:gson:2.8.5" } task annotationsInjectJar(type: Jar) { classifier = 'annotations-inject' from sourceSets.annotationsInject.output } jar { dependsOn annotationsInjectJar from(annotationsInjectJar.outputs) { into "annotations-inject" rename { "injection.jar" } } } compileKotlin { kotlinOptions { jvmTarget = "1.8" freeCompilerArgs = ['-Xjvm-default=compatibility'] } } jar { manifest { attributes 'Implementation-Version': project.version } } gradlePlugin { plugins { architect { id = pluginId implementationClass = 'me.shedaniel.architect.plugin.ArchitectPlugin' } } } task sourcesJar(type: Jar, dependsOn: classes) { classifier("sources") from sourceSets.main.allSource } publishing { publications { MyPublication(MavenPublication) { groupId pluginId artifactId pluginId + '.gradle.plugin' from components.java artifact(sourcesJar) } } repositories { if (System.getenv("MAVEN_PASS") != null) { maven { url = "https://deploy.shedaniel.me/" credentials { username = "shedaniel" password = System.getenv("MAVEN_PASS") } } } } }