Skip to content

Commit

Permalink
port to jsmacros 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jun 7, 2022
1 parent dbfe7a0 commit af1aee1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 47 deletions.
27 changes: 2 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'maven-publish'
id 'java'
id "com.github.johnrengelman.shadow" version "6.0.0"
Expand All @@ -21,6 +21,7 @@ repositories {
name "Modmuss50 Repository"
url 'https://maven.fabricmc.net/'
}
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://jitpack.io' }
maven { url 'https://www.cursemaven.com' }
}
Expand All @@ -43,32 +44,8 @@ dependencies {
// https://mvnrepository.com/artifact/org.python/jython-standalone
implementation "org.python:jython-standalone:2.7.2"


//partial fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api-base:${project.api_base_version}"
modImplementation "net.fabricmc.fabric-api:fabric-lifecycle-events-v1:${project.lifecycle_events_version}"
modImplementation "net.fabricmc.fabric-api:fabric-key-binding-api-v1:${project.key_bind_api_version}"
modImplementation "net.fabricmc.fabric-api:fabric-resource-loader-v0:${project.resource_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-command-api-v1:${project.command_api_version}"

modImplementation "com.github.wagyourtail:jsmacros:${project.jsmacros_version}"

implementation "org.graalvm.sdk:graal-sdk:${project.graal_version}"
implementation "org.graalvm.js:js:${project.graal_version}"
implementation "org.graalvm.truffle:truffle-api:${project.graal_version}"
// if (targetCompatibility == JavaVersion.VERSION_16) {
// implementation "org.graalvm.compiler:compiler:${project.graal_version}"
// implementation "org.graalvm.compiler:compiler-management:${project.graal_version}"
// }
implementation "org.graalvm.regex:regex:${project.graal_version}"

implementation group: 'com.ibm.icu', name: 'icu4j', version: '67.1'

implementation "io.noties:prism4j:${project.prism_version}"

//for modmenu
modImplementation "net.fabricmc.fabric-api:fabric-screen-api-v1:1.0.4+155f865c13"

//nullable not defined so...
implementation 'com.google.code.findbugs:jsr305:3.0.2'

Expand Down
18 changes: 6 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.1
loader_version=0.9.0+build.204
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.13.3

# Mod Properties
mod_version = 1.1.3
mod_version = 1.1.4
maven_group = xyz.wagyourtail
archives_base_name = jsmacros-jython

# Dependencies
api_base_version=0.3.0+a02b4463a0
lifecycle_events_version=1.4.4+a02b4463a0
key_bind_api_version=1.0.4+a02b4463a0
command_api_version=1.1.2+6cefd57713
resource_loader_version=0.4.7+b7ab6121a0

jsmacros_version=e446ce9d95
jsmacros_version=f8d39357c0
prism_version=2.0.0
graal_version=21.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ protected void exec(EventContainer<PythonInterpreter> ctx, ScriptTrigger scriptT
interp.execfile(ctx.getCtx().getFile().getCanonicalPath());
});
}

@Override
public void exec(EventContainer<PythonInterpreter> ctx, String script, Map<String, Object> globals) throws Exception {
protected void exec(EventContainer<PythonInterpreter> ctx, String script, BaseEvent event) throws Exception {
execContext(ctx, (interp) -> {
globals.forEach(interp::set);
interp.set("event", event);
interp.set("file", ctx.getCtx().getFile());
interp.set("context", ctx);

interp.exec(script);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ private void internal_accept(boolean await, Object... params) {
try {
fn._jcall(params);
} catch (Throwable ex) {
Core.instance.profile.logError(ex);
Core.getInstance().profile.logError(ex);
} finally {
ctx.releaseBoundEventIfPresent(Thread.currentThread());
ctx.unbindThread(Thread.currentThread());

Core.instance.profile.joinedThreadStack.remove(Thread.currentThread());
Core.getInstance().profile.joinedThreadStack.remove(Thread.currentThread());
}
});
t.start();
Expand All @@ -77,16 +77,16 @@ private Object internal_apply(Object... params) {

try {
ctx.bindThread(Thread.currentThread());
if (Core.instance.profile.checkJoinedThreadStack()) {
Core.instance.profile.joinedThreadStack.add(Thread.currentThread());
if (Core.getInstance().profile.checkJoinedThreadStack()) {
Core.getInstance().profile.joinedThreadStack.add(Thread.currentThread());
}
return fn._jcall(params).__tojava__(Object.class);
} catch (Throwable ex) {
throw new RuntimeException(ex);
} finally {
ctx.releaseBoundEventIfPresent(Thread.currentThread());
ctx.unbindThread(Thread.currentThread());
Core.instance.profile.joinedThreadStack.remove(Thread.currentThread());
Core.getInstance().profile.joinedThreadStack.remove(Thread.currentThread());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"depends": {
"fabricloader": ">=0.7.4",
"minecraft": "*",
"jsmacros": "1.6.X"
"jsmacros": "1.7.X"
},
"custom": {
"modmenu:parent": "jsmacros"
Expand Down

0 comments on commit af1aee1

Please sign in to comment.