diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-11-15 13:22:39 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-11-15 13:22:39 +0100 |
| commit | 1d6d1a8ee90f407fc6461c18db2811ac672bd1c5 (patch) | |
| tree | 75eb5114f9e9f1a753a4bc548d72072cf7d472f5 /stubs/src | |
| parent | 5df7cb16a9e2a38014deafda99e0b3256acc0040 (diff) | |
Generate argument handling from kotlin-compiler-arguments-description
Diffstat (limited to 'stubs/src')
| -rw-r--r-- | stubs/src/kotlin/proxy/KotlinProxyOverrides.java | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/stubs/src/kotlin/proxy/KotlinProxyOverrides.java b/stubs/src/kotlin/proxy/KotlinProxyOverrides.java index eebc423..c52db80 100644 --- a/stubs/src/kotlin/proxy/KotlinProxyOverrides.java +++ b/stubs/src/kotlin/proxy/KotlinProxyOverrides.java @@ -4,13 +4,12 @@ import org.jetbrains.kotlin.cli.common.ExitCode; import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments; import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity; import org.jetbrains.kotlin.cli.common.messages.MessageCollector; -import org.jetbrains.kotlin.com.intellij.openapi.Disposable; -import org.jetbrains.kotlin.config.CompilerConfiguration; import org.jetbrains.kotlin.config.JvmTarget; import org.jetbrains.kotlin.config.Services; import org.jetbrains.kotlin.platform.jvm.JvmPlatforms; -import org.jetbrains.kotlin.utils.KotlinPaths; +import org.jetbrains.kotlin.progress.CompilationCanceledStatus; +import java.util.ArrayList; import java.util.Collections; import java.util.IdentityHashMap; import java.util.Map; @@ -65,10 +64,34 @@ public final class KotlinProxyOverrides { } if ("doExecutePhased".equals(member)) { K2JVMCompilerArguments arguments = (K2JVMCompilerArguments) args[0]; - // Services services = (Services) args[1]; + Services services = (Services) args[1]; MessageCollector messageCollector = (MessageCollector) args[2]; - messageCollector.report(CompilerMessageSeverity.ERROR, "Shit is broken, yo!", null); - return ExitCode.COMPILATION_ERROR; + CompilationCanceledStatus canceledStatus = services.get(CompilationCanceledStatus.class); + + ArrayList<String> cmd = new ArrayList<String>(); + cmd.add("/home/the_jk/source/kotlin_proxy/img/kotlin-native-image-linux-x86_64-2.4.21/bin/kotlinc-native-image.sh"); + cmd.addAll(GeneratedJvmArguments.buildCommandArgs(arguments)); + cmd.addAll(arguments.getFreeArgs()); + ProcessBuilder builder = new ProcessBuilder(cmd); + builder.environment().put("JAVA_HOME", arguments.getJdkHome()); + try { + Process process = builder.start(); + int exitvalue = process.waitFor(); + /* + BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); + +String s = null; +while ((s = stdInput.readLine()) != null) { + System.out.println(s); + */ + if (exitvalue == 0) { + return ExitCode.OK; + } + messageCollector.report(CompilerMessageSeverity.ERROR, "Shit is broken, yo!", null); + return ExitCode.COMPILATION_ERROR; + } catch (Throwable t) { + throw new RuntimeException(t); + } } } return NO_VALUE; |
