Skip to content

Commit

Permalink
Add race-condition work-around
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Jan 30, 2025
1 parent 2489e53 commit dd2a0fd
Showing 1 changed file with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,28 @@ abstract class PreprocessGithubWorkflowWorkAction implements WorkAction<Paramete

@Override
void execute() {
execOperations.javaexec {
it.executable = parameters.javaExecutable.get().asFile.absolutePath
it.classpath(parameters.kotlinCompilerClasspath)
it.mainClass.set('org.jetbrains.kotlin.cli.jvm.K2JVMCompiler')
it.args('-no-stdlib', '-no-reflect')
it.args('-classpath', parameters.mainKtsClasspath.asPath)
it.args('-script', parameters.workflowScript.get().asFile.absolutePath)

// work-around for https://youtrack.jetbrains.com/issue/KT-42101
it.systemProperty('kotlin.main.kts.compiled.scripts.cache.dir', '')
// work-around for https://youtrack.jetbrains.com/issue/KT-74830
Exception lastException = null
for (i in 1..5) {
try {
execOperations.javaexec {
it.executable = parameters.javaExecutable.get().asFile.absolutePath
it.classpath(parameters.kotlinCompilerClasspath)
it.mainClass.set('org.jetbrains.kotlin.cli.jvm.K2JVMCompiler')
it.args('-no-stdlib', '-no-reflect')
it.args('-classpath', parameters.mainKtsClasspath.asPath)
it.args('-script', parameters.workflowScript.get().asFile.absolutePath)

// work-around for https://youtrack.jetbrains.com/issue/KT-42101
it.systemProperty('kotlin.main.kts.compiled.scripts.cache.dir', '')
}
} catch (Exception e) {
lastException = e
continue
}
return
}
throw lastException
}

static interface Parameters extends WorkParameters {
Expand Down

0 comments on commit dd2a0fd

Please sign in to comment.