aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt
AgeCommit message (Collapse)Author
2024-06-08bruhHEADmasterDeftu
2024-06-07Clean up Kotlin-specific files & support K2Deftu
2024-04-25Add support for Kotlin 1.9.0 (#21)DJtheRedstoner
The KotlinSourceRoot constructor was updated to include an additional argument related to Kotlin Multiplatform. We always pass null for this argument. Co-authored-by: Wyvest <wyvestbusiness@gmail.com>
2023-05-26Allow JDK_HOME to be set explicitly, required for Kotlin 1.8+Jonas Herzig
2022-05-27Add support for adding missing and removing unused importsJonas Herzig
This adds a post-process step which automatically adds unambiguous imports, removes unused imports and sorts the import list (formatting matches standard IntelliJ settings). This will preserve line count across versions at all cost. Java only for now because it's a lot more tricky with Kotlin and we don't yet use Kotlin ourselves (and won't be preprocessing it in the future either).
2022-05-10Add support for kotlin-compiler-embeddable 1.6.20Jonas Herzig
While, unlike last time, maintaining backwards compatibility with 1.5.21 (and anything in between).
2021-11-13Consider location of expression when determining field accessibilityJonas Herzig
A protected field is not accessible unless we are referencing it from within a class which extends its owner. Therefore, we may use a synthetic property with the same name as long as we do not have access to the field.
2021-11-12Fix synthetic property becoming shadowed by field of same nameJonas Herzig
2021-03-14Add new @Pattern feature to centralize version-aware codeJonas Herzig
That is, most of the business code should not be aware that it is being compiled to multiple versions even when it heavily interacts with MC, preprocessor statements should be an escape hatch, not the norm. Similarly, code should not be forced to do `MCVer.getWindow(mc)` instead of the much more intuitive `mc.getWindow()`, and this new preprocessor (technically remap) feature makes this possible by defining "search and replace"-like patterns (but smarter in that they are type-aware) in one or more central places which then are applied all over the code base. In a way, this is another step in the automatic back-porting process where preprocessor statements are used when we cannot yet do something automatically. Previously we "merely" automatically converted between different mapping, this new feature now also allows us to automatically perform simple refactoring tasks like changing field access to a getter+setter (e.g. `mc.getWindow()`), or changing how a method is called (e.g. `BufferBuilder.begin`), or changing a method call chain (e.g. `dispatcher.camera.getYaw()`), or most other search-and-replace-like changes and any combination of those. The only major limitation is that the replacement itself is not smart, so arguments must be kept in same order (or be temporarily assigned to local variables which then can be used in any order).
2020-11-21Update kotlin-compiler-embeddable to 1.3.72Jonas Herzig
Since 1.3.70, the Kotlin compiler by default uses an internal framework to read binary Java class files instead of relying on IntelliJ's PSI to do it for them. This internal framework was introduced in commit d65af8f to reduce the amount of unnecessary work done by the PSI model. Our entire mapper was written for the PSI model though (and remains to be because it must also support Java), so it would fail to remap any Kotlin files if kotlin-compiler-embeddable was upgraded (for whatever reason) to at least 70 where the new behavior became the default. Luckily there exists a config flag (renamed in the same version) which allows us to go back to the PSI reader, so that's what this commit does.
2020-05-22Properly dispose of root Disposable once doneJonas Herzig
2020-05-22Fix thread-unsafe extension point registeringJonas Herzig
2019-12-08Move remap error handling to the callerJonas Herzig
This e.g. allows the preprocessor to ignore errors in lines which it would have commented out anyway.
2019-09-15Add support for remapping Kotlin filesJonas Herzig
2019-08-31Use -embeddable compiler for compatibility with kotlin gradle pluginJonas Herzig
2019-08-30Convert implementation and build script to KotlinJonas Herzig