-
-
Notifications
You must be signed in to change notification settings - Fork 23
Split ASMAPI into a seperate artifact #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| rootProject.name = 'CoreMods' | ||
| rootProject.name = 'coremods' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks importing the project on some versions of IntelliJ due to the cloned folder name not exactly matching the root project name, please change it back to how it was.
| private static String map(String name, INameMappingService.Domain domain) { | ||
| if (Launcher.INSTANCE == null || Launcher.INSTANCE.environment() == null) | ||
| return name; | ||
| var mapper = Launcher.INSTANCE.environment().findNameMapping("srg").orElse(null); | ||
| return mapper == null ? name : mapper.apply(domain, name); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good candidate for caching either in a static field or a lazy init class static final:
| private static String map(String name, INameMappingService.Domain domain) { | |
| if (Launcher.INSTANCE == null || Launcher.INSTANCE.environment() == null) | |
| return name; | |
| var mapper = Launcher.INSTANCE.environment().findNameMapping("srg").orElse(null); | |
| return mapper == null ? name : mapper.apply(domain, name); | |
| } | |
| private static String map(String name, INameMappingService.Domain domain) { | |
| final class LazyInit { | |
| static final BiFunction<INameMappingService.Domain, String, String> MAPPER; | |
| static { | |
| BiFunction<INameMappingService.Domain, String, String> mapper = null; | |
| if (Launcher.INSTANCE != null && Launcher.INSTANCE.environment() != null) { | |
| mapper = Launcher.INSTANCE.environment().findNameMapping("srg").orElse(null); | |
| } | |
| MAPPER = mapper; | |
| } | |
| } | |
| return LazyInit.MAPPER == null ? name : LazyInit.MAPPER.apply(domain, name); | |
| } |
| newLine = false | ||
| } | ||
|
|
||
| dependencies { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the coremods-api should be added here as an api to avoid accidental breaking changes from forgetting to manually add it when updating?
| org.gradle.caching=true | ||
| org.gradle.parallel=true | ||
| org.gradle.configuration-cache=true | ||
| org.gradle.configuration-cache=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was disabled, but if it's to fix IDE import issues, you can add org.gradle.configuration-cache.problems=warn instead like in MinecraftMavenizer and Renamer.
| */ | ||
| private static final boolean DO_NOT_FIX_INSNBEFORE = shouldntFixInsnBefore(); | ||
|
|
||
| private static final boolean shouldntFixInsnBefore() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final on a static method prevents subclasses from having a static method with the same name at compile-time only. Unlike virtual methods, it has no effect on runtime.
Quick pass to split ASMAPI into its own jar for use in Forge when not using JavaScript coremods.
There are 3 methods that call into the JavaScript coremoding manager,
loadFile,loadData, andlog.These methods are expected to throw exceptions if invoked from a non-JS transformer. So it should be fine.
For old versions that ship the JS engine, they will now need to ship the ASMAPI artifact as well.