explicitly include mixin "properly", mavenpublish should work now

This commit is contained in:
Wagyourtail
2022-04-04 20:10:25 -07:00
parent 3cee66229a
commit 16f93ce769
6 changed files with 60 additions and 34 deletions

View File

@@ -61,6 +61,10 @@ allprojects {
apply plugin: "architectury-plugin"
repositories {
maven {
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'

View File

@@ -53,13 +53,6 @@ public class ProguardTask extends BaritoneGradleTask {
return url;
}
@Input
private String mixinUrl;
public String getMixinUrl() {
return mixinUrl;
}
@Input
private String extract;
@@ -93,7 +86,7 @@ public class ProguardTask extends BaritoneGradleTask {
}
private File getMcJar() throws IOException {
File mcClientJar = this.getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("main").getRuntimeClasspath().getFiles()
File mcClientJar = this.getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("main").getCompileClasspath().getFiles()
.stream()
.filter(this::isMcJar)
.map(f -> {
@@ -138,13 +131,6 @@ public class ProguardTask extends BaritoneGradleTask {
}
}
private void downloadMixin() throws Exception {
Path mixinJar = getTemporaryFile(MIXIN_JAR);
if (!Files.exists(mixinJar)) {
write(new URL(this.mixinUrl).openStream(), mixinJar);
}
}
private String getJavaBinPathForProguard() throws Exception {
String path;
try {
@@ -273,9 +259,6 @@ public class ProguardTask extends BaritoneGradleTask {
libraries.forEach(f -> {
template.add(2, "-libraryjars '" + f + "'");
});
downloadMixin();
template.add(2, "-libraryjars '" + this.getTemporaryFile(MIXIN_JAR) + "'");
}
Files.createDirectories(this.getRootRelativeFile(PROGUARD_MAPPING_DIR));
@@ -294,7 +277,7 @@ public class ProguardTask extends BaritoneGradleTask {
}
private Stream<File> acquireDependencies() {
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("main").getRuntimeClasspath().getFiles()
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("main").getCompileClasspath().getFiles()
.stream()
.filter(File::isFile);
}
@@ -319,10 +302,6 @@ public class ProguardTask extends BaritoneGradleTask {
this.url = url;
}
public void setMixinUrl(String mixinUrl) {
this.mixinUrl = mixinUrl;
}
public void setExtract(String extract) {
this.extract = extract;
}

View File

@@ -6,6 +6,7 @@ architectury {
common()
}
// ignore this jank, it's so I don't have to move the src folder, as that creates unnecessary git conflicts
sourceSets {
realmain {
java {
@@ -87,7 +88,10 @@ configurations {
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${project.fabric_version}"
modCompileOnly "net.fabricmc:fabric-loader:${project.fabric_version}"
// want in the pom but not to compile against as it's also provided by loom
runtimeOnly "org.spongepowered:mixin:0.8.4"
// this makes it compile with the forge tweak stuff
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
@@ -96,7 +100,7 @@ dependencies {
exclude module: 'asm-debug-all'
}
implementation 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation 'junit:junit:4.12'
}
@@ -134,7 +138,6 @@ remapJar {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
mixinUrl 'https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.11.3%2Bmixin.0.8.5/sponge-mixin-0.11.3%2Bmixin.0.8.5.jar'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "OFFICIAL"
}
@@ -142,3 +145,17 @@ task proguard(type: ProguardTask) {
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -41,8 +41,8 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.fabric_version}"
// this makes it compile with the forge tweak stuff
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
implementation('net.minecraft:launchwrapper:1.12') {
compileOnly 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
compileOnly('net.minecraft:launchwrapper:1.12') {
exclude module: 'lwjgl'
exclude module: 'asm-debug-all'
}
@@ -82,11 +82,24 @@ components.java {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
mixinUrl 'https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.11.3%2Bmixin.0.8.5/sponge-mixin-0.11.3%2Bmixin.0.8.5.jar'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "FABRIC"
}
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
build.finalizedBy(createDist)
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -47,8 +47,8 @@ dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
// this makes it compile with the forge tweak stuff
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
implementation('net.minecraft:launchwrapper:1.12') {
compileOnly 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
compileOnly('net.minecraft:launchwrapper:1.12') {
exclude module: 'lwjgl'
exclude module: 'asm-debug-all'
}
@@ -100,7 +100,6 @@ components.java {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
mixinUrl 'https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.11.3%2Bmixin.0.8.5/sponge-mixin-0.11.3%2Bmixin.0.8.5.jar'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "FORGE"
}
@@ -108,4 +107,18 @@ task proguard(type: ProguardTask) {
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
build.finalizedBy(createDist)
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}