-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first draft * Improve import collector locking * Deduplicate part of the buildscript * Small fixup
- Loading branch information
Showing
41 changed files
with
1,812 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
apply plugin: 'java' | ||
plugins { | ||
id 'java' | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
|
28 changes: 28 additions & 0 deletions
28
buildSrc/src/main/groovy/org/vineflower/build/TestDataRuntimesProvider.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.vineflower.build | ||
|
||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.MapProperty | ||
import org.gradle.api.tasks.Nested | ||
import org.gradle.jvm.toolchain.JavaLauncher | ||
import org.gradle.process.CommandLineArgumentProvider | ||
|
||
import javax.inject.Inject | ||
|
||
public class TestDataRuntimesProvider implements CommandLineArgumentProvider { | ||
@Nested | ||
final MapProperty<String, JavaLauncher> launchers | ||
|
||
@Inject | ||
public TestDataRuntimesProvider(final ObjectFactory objects) { | ||
this.launchers = objects.mapProperty(Integer, JavaLauncher) | ||
} | ||
|
||
@Override | ||
Iterable<String> asArguments() { | ||
def result = [] | ||
this.launchers.get().each { k, v -> | ||
result << "-Djava.${k}.home=${v.metadata.installationPath.asFile.absolutePath}" | ||
} | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../decompiler/build/JasmCompileOptions.java → .../vineflower/build/JasmCompileOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build/ | ||
/out/ | ||
testData/classes/java*/ | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import org.vineflower.build.TestDataRuntimesProvider | ||
|
||
archivesBaseName = 'vineflower-variable-renaming' | ||
|
||
dependencies { | ||
implementation project(":") | ||
testImplementation testFixtures(project(":")) | ||
} | ||
|
||
task testDataClasses { | ||
group = 'build' | ||
} | ||
testClasses.dependsOn(testDataClasses) | ||
|
||
void createJavaTestDataSet(int version, String suffix = "", List<String> compilerArgs = []) { | ||
sourceSets.create("testDataJava${version}${suffix}") { | ||
it.java.srcDirs file("testData/src/java${version}${suffix.toLowerCase()}") | ||
} | ||
tasks.getByName("compileTestDataJava${version}${suffix}Java") { | ||
destinationDirectory = file("testData/classes/java${version}${suffix.toLowerCase()}") | ||
if (project.isArm && version > 8 && version < 11) { | ||
// On ARM systems, a more limited set of JVM versions are available | ||
// We'll accept the `--release` flag so development is at least somewhat possible | ||
javaCompiler = javaToolchains.compilerFor { | ||
languageVersion = JavaLanguageVersion.of(11) | ||
} | ||
options.release = version | ||
} else { | ||
javaCompiler = javaToolchains.compilerFor { | ||
languageVersion = JavaLanguageVersion.of(version) | ||
} | ||
} | ||
|
||
options.compilerArgs = compilerArgs | ||
} | ||
testDataClasses.dependsOn("testDataJava${version}${suffix}Classes") | ||
} | ||
|
||
def testJavaRuntimes = [:] | ||
|
||
[8].forEach { version -> | ||
def runtimeVersion = isArm && version > 8 && version < 11 ? 11 : version | ||
createJavaTestDataSet(version) | ||
testJavaRuntimes[version] = javaToolchains.launcherFor { | ||
languageVersion = JavaLanguageVersion.of(runtimeVersion) | ||
} | ||
} | ||
|
||
test { | ||
maxHeapSize = "512M" | ||
|
||
systemProperty "DOT_EXPORT_DIR", System.getProperty("DOT_EXPORT_DIR", null) | ||
systemProperty "DOT_ERROR_EXPORT_DIR", System.getProperty("DOT_ERROR_EXPORT_DIR", null) | ||
systemProperty "VALIDATE_DECOMPILED_CODE", System.getProperty("VALIDATE_DECOMPILED_CODE", "false") | ||
|
||
def provider = objects.newInstance(TestDataRuntimesProvider) | ||
testJavaRuntimes.each { k, v -> | ||
provider.launchers.put(k, v) | ||
} | ||
jvmArgumentProviders << provider | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
does_shadow=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
plugins/variable-renaming/src/main/java/org/vineflower/variablerenaming/Renamers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.vineflower.variablerenaming; | ||
|
||
import org.jetbrains.java.decompiler.main.extern.IVariableNamingFactory; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class Renamers { | ||
private static final Map<String, IVariableNamingFactory> PROVIDERS = new HashMap<>(); | ||
|
||
public static void registerProvider(String name, IVariableNamingFactory factory) { | ||
PROVIDERS.put(name, factory); | ||
} | ||
|
||
public static IVariableNamingFactory get(String name) { | ||
return PROVIDERS.get(name); | ||
} | ||
} |
Oops, something went wrong.