disable shading and small other fixes (#12)

* make Project in LoomGradleExtension private

* use gradle all distribution

* disable shading
dev/0.11
NikkyAI 2018-11-04 01:27:55 +01:00 committed by Modmuss50
parent eaa00b5dff
commit 40f9168b6a
4 changed files with 30 additions and 40 deletions

View File

@ -19,62 +19,48 @@ if (ENV.BUILD_NUMBER) {
build = "jenkins #${ENV.BUILD_NUMBER}" build = "jenkins #${ENV.BUILD_NUMBER}"
} }
// Remove the gradleApi so it isn't merged into the jar file.
configurations.compile.dependencies.remove dependencies.gradleApi()
repositories { repositories {
mavenCentral() mavenCentral()
maven { maven {
name = "Modmuss" name = "Modmuss"
url = 'http://maven.modmuss50.me/' url = 'http://maven.modmuss50.me/'
} }
maven {
name = 'Mojang'
url = 'https://libraries.minecraft.net/'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
}
configurations {
deployerJars
shade
compile.extendsFrom shade
} }
dependencies { dependencies {
implementation gradleApi() implementation gradleApi()
shade('commons-io:commons-io:2.6') implementation ('commons-io:commons-io:2.6')
shade('org.zeroturnaround:zt-zip:1.13') implementation ('org.zeroturnaround:zt-zip:1.13')
shade('com.google.code.gson:gson:2.8.5') implementation ('com.google.code.gson:gson:2.8.5')
shade('com.google.guava:guava:27.0-jre') implementation ('com.google.guava:guava:27.0-jre')
shade('net.fabricmc:stitch:0.1.0.+') { implementation ('net.fabricmc:stitch:0.1.0.+')
implementation ('net.fabricmc:tiny-remapper:0.1.0.16') {
transitive = false transitive = false
} }
shade('net.fabricmc:tiny-remapper:0.1.0.16')
shade('org.spongepowered:mixin:0.7.11-SNAPSHOT') { implementation ('net.fabricmc:sponge-mixin:0.7.11.3') {
exclude module: 'launchwrapper' exclude module: 'launchwrapper'
exclude module: 'guava' exclude module: 'guava'
} }
} }
jar { jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'META-INF/*'
exclude 'META-INF'
}
manifest { manifest {
attributes 'Implementation-Version': version + " Build(" + build + ")" attributes 'Implementation-Version': version + " Build(" + build + ")"
} }
} }
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle' apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle'
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
@ -92,15 +78,15 @@ gradlePlugin {
publishing { publishing {
publications { publications {
pluginMaven(MavenPublication) { publication -> plugin(MavenPublication) { publication ->
groupId project.group groupId project.group
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
//Removes all of the dependencies from the maven pom, prevents sub projects downloading all the libs, as we use a fat jar from components["java"]
pom.withXml {
asNode().remove(asNode().get('dependencies')) artifact sourcesJar
} artifact javadocJar
} }
} }
repositories { repositories {

View File

@ -1,5 +1,6 @@
#Sat Nov 03 23:12:45 CET 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

View File

@ -67,8 +67,7 @@ public class AbstractPlugin implements Plugin<Project> {
project.apply(ImmutableMap.of("plugin", "eclipse")); project.apply(ImmutableMap.of("plugin", "eclipse"));
project.apply(ImmutableMap.of("plugin", "idea")); project.apply(ImmutableMap.of("plugin", "idea"));
project.getExtensions().create("minecraft", LoomGradleExtension.class); project.getExtensions().create("minecraft", LoomGradleExtension.class, project);
project.getExtensions().getByType(LoomGradleExtension.class).project = project;
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
readModJson(extension); readModJson(extension);

View File

@ -39,7 +39,11 @@ public class LoomGradleExtension {
public boolean localMappings = false; public boolean localMappings = false;
//Not to be set in the build.gradle //Not to be set in the build.gradle
public Project project; private Project project;
public LoomGradleExtension(Project project) {
this.project = project;
}
public String getVersionString() { public String getVersionString() {
if (isModWorkspace()) { if (isModWorkspace()) {