File tree Expand file tree Collapse file tree
elide-plugin/src/main/kotlin/dev/elide/maven/plugin
java-compiler/src/main/kotlin/dev/elide/maven/compiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 */
1313package dev.elide.maven.plugin
1414
15- import dev.elide.maven.compiler.ElideJavacCompiler
1615import org.apache.maven.plugin.compiler.AbstractCompilerMojo
1716import org.apache.maven.plugin.compiler.CompilerMojo
1817import org.apache.maven.plugins.annotations.Parameter
@@ -27,11 +26,17 @@ open class ElideCompileMojoImpl : CompilerMojo() {
2726 /* * Elide executable location. */
2827 @Parameter(name = " executable" ) var executable: String? = null
2928
30- init {
29+ override fun execute () {
3130 AbstractCompilerMojo ::class .java.getDeclaredField(" compilerId" ).apply {
3231 isAccessible = true
3332 set(this @ElideCompileMojoImpl, " elide" )
3433 }
35- ElideJavacCompiler .executable = executable
34+ executable?.let {
35+ AbstractCompilerMojo ::class .java.getDeclaredField(" executable" ).apply {
36+ isAccessible = true
37+ set(this @ElideCompileMojoImpl, it)
38+ }
39+ }
40+ super .execute()
3641 }
3742}
Original file line number Diff line number Diff line change 1212 */
1313package dev.elide.maven.plugin
1414
15- import dev.elide.maven.compiler.ElideJavacCompiler
1615import org.apache.maven.plugin.compiler.AbstractCompilerMojo
1716import org.apache.maven.plugin.compiler.TestCompilerMojo
1817import org.apache.maven.plugins.annotations.Parameter
@@ -27,11 +26,17 @@ open class ElideTestCompileMojoImpl : TestCompilerMojo() {
2726 /* * Elide executable location. */
2827 @Parameter(name = " executable" ) var executable: String? = null
2928
30- init {
29+ override fun execute () {
3130 AbstractCompilerMojo ::class .java.getDeclaredField(" compilerId" ).apply {
3231 isAccessible = true
3332 set(this @ElideTestCompileMojoImpl, " elide" )
3433 }
35- ElideJavacCompiler .executable = executable
34+ executable?.let {
35+ AbstractCompilerMojo ::class .java.getDeclaredField(" executable" ).apply {
36+ isAccessible = true
37+ set(this @ElideTestCompileMojoImpl, it)
38+ }
39+ }
40+ super .execute()
3641 }
3742}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ open class ElideJavacCompiler :
7878 }
7979
8080 private fun getElideExecutable (config : CompilerConfiguration ): String =
81- executable ? : config.executable ? : ElideLocator .locate()?.absolutePathString() ? : ELIDE_EXECUTABLE
81+ config.executable ? : ElideLocator .locate()?.absolutePathString() ? : ELIDE_EXECUTABLE
8282
8383 override fun createCommandLine (config : CompilerConfiguration ): Array <String > {
8484 return buildElideArgs(config, getSourceFiles(config)).toTypedArray()
@@ -207,9 +207,4 @@ open class ElideJavacCompiler :
207207 val kind = if (exitCode == 0 ) CompilerMessage .Kind .NOTE else CompilerMessage .Kind .ERROR
208208 return input.map { CompilerMessage (it, kind) }
209209 }
210-
211- companion object {
212- // allow overriding executable in elide-maven-plugin
213- var executable: String? = null
214- }
215210}
Original file line number Diff line number Diff line change 1212 */
1313package dev.elide.maven.compiler
1414
15+ import java.io.File.pathSeparatorChar
1516import java.nio.file.Path
1617import java.nio.file.Paths
1718
@@ -36,7 +37,7 @@ object ElideLocator {
3637 */
3738 fun locate (): Path ? {
3839 val path = System .getenv(" PATH" ) ? : " "
39- for (pathCandidate in path.split(' : ' )) {
40+ for (pathCandidate in path.split(pathSeparatorChar )) {
4041 val candidate = Paths .get(pathCandidate, ELIDE_EXECUTABLE )
4142 if (isValidElideBinary(candidate)) {
4243 return candidate
You can’t perform that action at this time.
0 commit comments