Skip to content

Commit

Permalink
Merge remote-tracking branch 'FabricMC/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
makamys committed Mar 19, 2024
2 parents bbd3c93 + b07a8b2 commit 40adfc7
Show file tree
Hide file tree
Showing 21 changed files with 396 additions and 89 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ jobs:
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_CENTRAL_URL: ${{ secrets.MAVEN_CENTRAL_URL }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_SERVER: ${{ secrets.SIGNING_SERVER }}
SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }}
64 changes: 63 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ buildscript {
}
}

plugins {
id "me.modmuss50.remotesign" version "0.4.0"
}

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

// Apply plugin
Expand Down Expand Up @@ -157,6 +161,7 @@ sourceSets {
ext.languageVersion = 16
ext.modularityExcluded = true // don't add ourselves
}
modularityDummy {}
}

// Because Mixin aims to support a variety of environments, we have to be able to run with older versions of GSON and Guava that lack official module
Expand Down Expand Up @@ -364,7 +369,7 @@ if (JavaVersion.current().isJava8Compatible()) {
}

task stagingJar(type: ShadowJar) {
sourceSets.findAll { !(it.name =~ /example|test/) }.each {
sourceSets.findAll { !(it.name =~ /example|test|modularityDummy/) }.each {
from it.output
}
configurations = [project.configurations.stagingJar]
Expand Down Expand Up @@ -491,6 +496,45 @@ publishing {
}
}
}

pom {
description = 'Fabric Mixin is a trait/mixin and bytecode weaving framework for Java using ASM.'
url = 'https://github.com/FabricMC/Mixin'

scm {
connection = "scm:git:https://github.com/FabricMC/Mixin.git"
developerConnection = "scm:git:[email protected]:FabricMC/Mixin.git"
url = "https://github.com/FabricMC/Mixin"
}

issueManagement {
system = "GitHub"
url = "https://github.com/FabricMC/Mixin/issues"
}

licenses {
license {
name = 'The MIT License'
url = 'https://raw.githubusercontent.com/FabricMC/Mixin/main/LICENSE.txt'
}
}

developers {
// Et. al. that arent in the fabric org on maven central

developer {
id = "modmuss50"
name = "modmuss50"
email = "[email protected]"
}

developer {
id = "sfPlayer"
name = "Player"
email = "[email protected]"
}
}
}
}
}

Expand All @@ -504,9 +548,27 @@ publishing {
}
}
}

if (ENV.MAVEN_CENTRAL_URL) {
repositories.maven {
name "central"
url ENV.MAVEN_CENTRAL_URL
credentials {
username ENV.MAVEN_CENTRAL_USERNAME
password ENV.MAVEN_CENTRAL_PASSWORD
}
}
}
}
}

remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
useDummyForTesting = ENV.SIGNING_SERVER == null
sign publishing.publications.developer
}

// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ organization=LegacyModdingMC
buildVersion=0.12.2
upstreamMixinVersion=0.8.5
buildType=RELEASE
asmVersion=9.2
asmVersion=9.6
legacyForgeAsmVersion=5.0.3
modlauncherAsmVersion=9.1
modlauncherVersion=9.0.7
Expand Down
10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
}
}

rootProject.name = name
59 changes: 58 additions & 1 deletion src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,64 @@ boolean isSupported() {
return JavaVersion.current() >= JavaVersion.JAVA_18 && ASM.isAtLeastVersion(9, 2);
}

};
},

/**
* Java 19 or above is required
*/
JAVA_19(19, Opcodes.V19, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES
| LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS
| LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) {

@Override
boolean isSupported() {
return JavaVersion.current() >= JavaVersion.JAVA_19 && ASM.isAtLeastVersion(9, 3);
}

},

/**
* Java 20 or above is required
*/
JAVA_20(20, Opcodes.V20, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES
| LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS
| LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) {

@Override
boolean isSupported() {
return JavaVersion.current() >= JavaVersion.JAVA_20 && ASM.isAtLeastVersion(9, 4);
}

},

/**
* Java 21 or above is required
*/
JAVA_21(21, Opcodes.V21, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES
| LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS
| LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) {

@Override
boolean isSupported() {
return JavaVersion.current() >= JavaVersion.JAVA_21 && ASM.isAtLeastVersion(9, 5);
}

},

/**
* Java 22 or above is required
*/
JAVA_22(22, Opcodes.V22, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES
| LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS
| LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) {

@Override
boolean isSupported() {
return JavaVersion.current() >= JavaVersion.JAVA_22 && ASM.isAtLeastVersion(9, 6);
}

},
;

/**
* Default compatibility level to use if not specified by the service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,19 @@ public abstract class InjectionPoint {
}

/**
* Selector type for slice delmiters, ignored for normal injection points.
* <tt>Selectors</tt> can be supplied in {@link At} annotations by including
* a colon (<tt>:</tt>) character followed by the selector type
* (case-sensitive), eg:
* Additional specifier for injection points. <tt>Specifiers</tt> can be
* supplied in {@link At} annotations by including a colon (<tt>:</tt>)
* character followed by the specifier type (case-sensitive), eg:
*
* <blockquote><pre>&#064;At(value = "INVOKE:LAST", ... )</pre></blockquote>
*/
public enum Selector {

public enum Specifier {

/**
* Use all instructions from the query result.
*/
ALL,

/**
* Use the <em>first</em> instruction from the query result.
*/
Expand All @@ -186,13 +190,13 @@ public enum Selector {
* more than one instruction this should be considered a fail-fast error
* state and a runtime exception will be thrown.
*/
ONE;
ONE,

/**
* Default selector type used if no selector is explicitly specified.
* <em>For internal use only. Currently {@link #FIRST}</em>
* Use the default setting as defined by the consumer. For slices this
* is {@link #FIRST}, for all other consumers this is {@link #ALL}
*/
public static final Selector DEFAULT = Selector.FIRST;
DEFAULT;

}

Expand Down Expand Up @@ -276,26 +280,26 @@ enum ShiftByViolationBehaviour {
}

private final String slice;
private final Selector selector;
private final Specifier specifier;
private final String id;
private final IMessageSink messageSink;


protected InjectionPoint() {
this("", Selector.DEFAULT, null);
this("", Specifier.DEFAULT, null);
}

protected InjectionPoint(InjectionPointData data) {
this(data.getSlice(), data.getSelector(), data.getId(), data.getMessageSink());
this(data.getSlice(), data.getSpecifier(), data.getId(), data.getMessageSink());
}

public InjectionPoint(String slice, Selector selector, String id) {
this(slice, selector, id, null);
public InjectionPoint(String slice, Specifier specifier, String id) {
this(slice, specifier, id, null);
}

public InjectionPoint(String slice, Selector selector, String id, IMessageSink messageSink) {
public InjectionPoint(String slice, Specifier specifier, String id, IMessageSink messageSink) {
this.slice = slice;
this.selector = selector;
this.specifier = specifier;
this.id = id;
this.messageSink = messageSink;
}
Expand All @@ -304,8 +308,8 @@ public String getSlice() {
return this.slice;
}

public Selector getSelector() {
return this.selector;
public Specifier getSpecifier(Specifier defaultSpecifier) {
return this.specifier == Specifier.DEFAULT ? defaultSpecifier : this.specifier;
}

public String getId() {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/spongepowered/asm/mixin/injection/Slice.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.spongepowered.asm.mixin.injection.InjectionPoint.Selector;
import org.spongepowered.asm.mixin.injection.InjectionPoint.Specifier;

/**
* A <tt>Slice</tt> identifies a section of a method to search for injection
Expand Down Expand Up @@ -162,10 +162,10 @@

/**
* Injection point which specifies the <em>start</em> of the slice region.
* {@link At}s supplied here should generally specify a {@link Selector}
* {@link At}s supplied here should generally use a {@link Specifier}
* in order to identify which instruction should be used for queries which
* return multiple results. The selector is specified by appending the
* selector type to the injection point type as follows:
* return multiple results. The specifier is supplied by appending the
* specifier type to the injection point type as follows:
*
* <blockquote><pre>&#064;At(value = "INVOKE:LAST", ... )</pre></blockquote>
*
Expand All @@ -182,9 +182,9 @@
/**
* Injection point which specifies the <em>end</em> of the slice region.
* Like {@link #from}, {@link At}s supplied here should generally specify a
* {@link Selector} in order to identify which instruction should be used
* for queries which return multiple results. The selector is specified by
* appending the selector type to the injection point type as follows:
* {@link Specifier} in order to identify which instruction should be used
* for queries which return multiple results. The specifier is supplied by
* appending the specifier type to the injection point type as follows:
*
* <blockquote><pre>&#064;At(value = "INVOKE:LAST", ... )</pre></blockquote>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ private class Callback extends InsnList {
this.invoke = target.extendStack();
this.ctor = target.extendStack();

this.invoke.add(target.arguments.length);
if (this.canCaptureLocals) {
this.invoke.add(this.localTypes.length - this.frameSize);
}
this.invoke.add().add(handlerArgs);

//If the handler doesn't captureArgs, the CallbackInfo(Returnable) will be the first LVT slot, otherwise it will be at the target's frameSize
int callbackInfoSlot = handlerArgs.length == 1 ? Bytecode.isStatic(handler) ? 0 : 1 : frameSize;
Expand Down
Loading

0 comments on commit 40adfc7

Please sign in to comment.