Skip to content
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

Master #510

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
31 changes: 30 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ tasks.named('jar') {
dependsOn(copyLibs)
dependsOn(copyResources)
}

tasks.named("test") {
dependsOn(tasks.named("modifyAndCompileD"))
}

tasks.register('compileModules', JavaCompile) {
dependsOn(copyLibs)
Expand Down Expand Up @@ -269,6 +271,33 @@ tasks.register('buildJars') {
dependsOn createRunJpfJar
dependsOn createRunTestJar
}
task.register("modifyAndCompileD") {
cyrille-artho marked this conversation as resolved.
Show resolved Hide resolved
// Declaring inputs and outputs to make the task compatible with the configuration cache
inputs.file("src/main/java/D.java")
outputs.dir("${buildDir}/classes/java/main")

doLast {
// Step 1: Defining file paths
def originalFile = "src/main/java/D.java"
def tempDir = file("${buildDir}/tempD")
def buildClassesDir = file("${buildDir}/classes/java/main")

// Step 2: Creating a temporary directory
tempDir.mkdirs()

// Step 3: Modifying D.java by removing the "static" keyword
def modifiedFile = file("${sourceDir}/D.java")
modifiedFile.text = originalFile.text.replace("static ", "")

// Step 4: Compiling the modified D.java
def javac = org.gradle.internal.jvm.Jvm.current().javacExecutable
exec {
commandLine javac, "-d", buildClassesDir, modifiedFile
}

println "Modified and recompiled D.java without 'static'."
}
}

test {
description = "Runs core regression tests."
Expand Down
Loading