From 7e1b68e49bcbeb151fd77e9193377e9a360bb7f0 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Sat, 27 Feb 2021 15:42:55 +0200 Subject: Update Loom and use Maven Publish instead of the Artifactory plugin --- GuiTest/build.gradle | 29 ++++++++---------- build.gradle | 83 +++++++++++++++------------------------------------- 2 files changed, 37 insertions(+), 75 deletions(-) diff --git a/GuiTest/build.gradle b/GuiTest/build.gradle index c1423b2..bbb0f0f 100644 --- a/GuiTest/build.gradle +++ b/GuiTest/build.gradle @@ -14,7 +14,9 @@ version = rootProject.version group = rootProject.group loom { - autoGenIDERuns = true + runConfigs.configureEach { + ideConfigGenerated = true + } } //configurations.modApi { @@ -40,29 +42,24 @@ dependencies { processResources { inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" + filesMatching("fabric.mod.json") { expand "version": project.version } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType(JavaCompile) { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html options.encoding = "UTF-8" + + if (JavaVersion.current().isJava9Compatible()) { + options.release.set 8 + } } -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource +java { + withSourcesJar() } jar { diff --git a/build.gradle b/build.gradle index d7c3955..94e6f0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,12 @@ plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.6-SNAPSHOT' id 'maven-publish' - id "com.jfrog.artifactory" version "4.20.0" id 'checkstyle' } sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - - if(rootProject.file('private.gradle').exists()) { //Publishing details apply from: 'private.gradle' } @@ -19,7 +16,7 @@ version = "$project.mod_version+$project.minecraft_version" group = project.maven_group repositories { - maven { url "http://server.bbkr.space:8081/artifactory/libs-release" } + maven { url "https://server.bbkr.space/artifactory/libs-release" } maven { url = "http://maven.terraformersmc.com/releases" content { @@ -44,29 +41,25 @@ dependencies { processResources { inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" + filesMatching("fabric.mod.json") { expand "version": project.version } +} - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } +java { + withSourcesJar() + withJavadocJar() } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType(JavaCompile) { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html options.encoding = "UTF-8" -} -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource + if (JavaVersion.current().isJava9Compatible()) { + options.release.set 8 + } } jar { @@ -82,58 +75,30 @@ checkstyle { publishing { publications { maven(MavenPublication) { - // add all the jars that should be included when publishing to maven - //artifact(jar) { - // builtBy remapJar - //} - artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}.jar") { //release jar - file location not provided anywhere in loom - artifactId = "LibGui" - classifier null - builtBy remapJar - } - - artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}-dev.jar") { //release jar - file location not provided anywhere in loom - artifactId = "LibGui" - classifier "dev" + artifact(remapJar) { builtBy remapJar } artifact(sourcesJar) { - artifactId = "LibGui" builtBy remapSourcesJar } + + artifact(javadocJar) } } // select the repositories you want to publish to repositories { - // uncomment to publish to the local maven - // mavenLocal() - } -} - -artifactory { - if (project.hasProperty("artifactoryUsername")) { - contextUrl = "http://server.bbkr.space:8081/artifactory/" - publish { - repository { - if (version.contains("SNAPSHOT")) { - repoKey = "libs-snapshot" - } else { - repoKey = "libs-release" + if (project.hasProperty("artifactoryUsername")) { + maven { + url = "https://server.bbkr.space/artifactory/libs-release/" + credentials { + username = artifactoryUsername + password = artifactoryPassword } - - username = artifactoryUsername - password = artifactoryPassword - } - defaults { - publications("maven") - - publishArtifacts = true - publishPom = true } + } else { + println "Cannot configure artifactory; please define ext.artifactoryUsername and ext.artifactoryPassword before running publish" } - } else { - println "Cannot configure artifactory; please define ext.artifactoryUsername and ext.artifactoryPassword before running artifactoryPublish" } } -- cgit