From b3a5f4ebd795ef34784bcf1a8847efba2ffa18dd Mon Sep 17 00:00:00 2001 From: NikkyAI Date: Sat, 3 Nov 2018 14:01:34 +0100 Subject: [PATCH] add gradle plugin marker (#11) format build.gradle format do tabs --- .editorconfig | 5 ++ .gitignore | 1 + build.gradle | 86 ++++++++++--------- .../net.fabricmc.gradle.properties | 1 - 4 files changed, 50 insertions(+), 43 deletions(-) create mode 100644 .editorconfig delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.fabricmc.gradle.properties diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dd52275 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +[*.kt] +indent_style = tab + +[*.gradle] +indent_style = tab \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9023533..198da20 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Files !/.gitattributes !/.gitignore +!/.editorconfig !/build.gradle !/gradle.properties !/gradlew diff --git a/build.gradle b/build.gradle index 9f25063..be0b1ac 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,9 @@ plugins { - id 'java' - id 'groovy' - id 'maven' - id 'maven-publish' - id 'idea' - id 'eclipse' + id 'java' + id 'maven-publish' + id 'java-gradle-plugin' + id 'idea' + id 'eclipse' } sourceCompatibility = 1.8 @@ -14,11 +13,14 @@ group = 'net.fabricmc' archivesBaseName = project.name version = '0.0.12-SNAPSHOT' +// Remove the gradleApi so it isn't merged into the jar file. +configurations.compile.dependencies.remove dependencies.gradleApi() + repositories { - mavenCentral() + mavenCentral() maven { - name "Modmuss" - url 'http://maven.modmuss50.me/' + name = "Modmuss" + url = 'http://maven.modmuss50.me/' } maven { name = 'Mojang' @@ -28,46 +30,39 @@ repositories { name = 'Forge' //For ModLauncher url = 'http://files.minecraftforge.net/maven/' } - maven { - name = 'SpongePowered' - url = 'http://repo.spongepowered.org/maven' - } + maven { + name = 'SpongePowered' + url = 'http://repo.spongepowered.org/maven' + } } configurations { - deployerJars - shade - compile.extendsFrom shade + deployerJars + shade + compile.extendsFrom shade } dependencies { - compile gradleApi() + implementation gradleApi() - shade 'commons-io:commons-io:2.6' - shade 'org.zeroturnaround:zt-zip:1.13' - shade 'com.google.code.gson:gson:2.8.5' - shade 'com.google.guava:guava:27.0-jre' - shade ('net.fabricmc:stitch:0.1.0.+'){ - transitive = false - } - shade 'net.fabricmc:tiny-remapper:0.1.0.15' + shade('commons-io:commons-io:2.6') + shade('org.zeroturnaround:zt-zip:1.13') + shade('com.google.code.gson:gson:2.8.5') + shade('com.google.guava:guava:27.0-jre') + shade('net.fabricmc:stitch:0.1.0.+') { + transitive = false + } + shade('net.fabricmc:tiny-remapper:0.1.0.15') - shade('org.spongepowered:mixin:0.7.11-SNAPSHOT') { - exclude module: 'launchwrapper' - exclude module: 'guava' - } -} - -sourceSets { - main.compileClasspath += configurations.shade; - main.runtimeClasspath += configurations.shade; - test.compileClasspath += configurations.shade; - test.runtimeClasspath += configurations.shade; + shade('org.spongepowered:mixin:0.7.11-SNAPSHOT') { + exclude module: 'launchwrapper' + exclude module: 'guava' + } } jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from (configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }) { + from(configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }) { exclude 'META-INF/*' exclude 'META-INF' } @@ -76,18 +71,25 @@ jar { apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle' task wrapper(type: Wrapper) { - gradleVersion = '4.10.2' + gradleVersion = '4.10.2' +} + +gradlePlugin { + plugins { + register("fabricLoom") { + id = "fabric-loom" + implementationClass = "net.fabricmc.loom.LoomGradlePlugin" + } + } } publishing { publications { - maven(MavenPublication) { + pluginMaven(MavenPublication) { publication -> groupId project.group artifactId project.archivesBaseName version project.version - from components.java - //Removes all of the dependencies from the maven pom, prevents sub projects downloading all the libs, as we use a fat jar pom.withXml { asNode().remove(asNode().get('dependencies')) @@ -105,4 +107,4 @@ publishing { } } } -} +} \ No newline at end of file diff --git a/src/main/resources/META-INF/gradle-plugins/net.fabricmc.gradle.properties b/src/main/resources/META-INF/gradle-plugins/net.fabricmc.gradle.properties deleted file mode 100644 index 8b29c32..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.fabricmc.gradle.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=net.fabricmc.loom.LoomGradlePlugin