public CppCompiler(string code, IExecutionProperties execProps, ICompilerProperties compProps, string[] imports = null) { SourceCode = code; ExecuteProperties = execProps; CompilerProperties = compProps; }
/// <summary> /// Load javac.exe and run compilation from arguments /// </summary> /// <param name="javacPathName">Path to javac.exe (Program Files\java\jdk\bin\javac.exe)</param> /// <param name="javaFilePathName">Source code file name</param> /// <param name="properties">Compilation properties</param> /// <param name="commandLineOptions">Any compiler options</param> public static async Task <string> CompileJava(string javacPathName, string javaFilePathName, ICompilerProperties properties, string commandLineOptions = "") { var startInfo = new ProcessStartInfo { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, FileName = javacPathName, WindowStyle = ProcessWindowStyle.Hidden, Arguments = commandLineOptions + " " + javaFilePathName }; using (var javacProcess = Process.Start(startInfo)) { if (javacProcess == null) { throw new CompileException("javac.exe could not start!"); } bool graceful = javacProcess.WaitForExit((int)properties.Timeout); if (graceful) { string error = await javacProcess.StandardError.ReadToEndAsync(); if (!string.IsNullOrWhiteSpace(error)) { throw new CompileException(error); } string output = await javacProcess.StandardOutput.ReadToEndAsync(); return(output); } throw new CompileException("The compilation took longer than expected!"); } }
public LuaCompiler(string code, IExecutionProperties execProps, ICompilerProperties compProps, IGlobals globals = null) { SourceCode = code; ExecuteProperties = execProps; CompilerProperties = compProps; Globals = globals; }
public PyCompiler(string code, IExecutionProperties eProps, ICompilerProperties cProps, string libSearchPath = null, IGlobals globals = null) { SourceCode = code; CompilerProperties = cProps; ExecuteProperties = eProps; LibSearchPath = libSearchPath; Globals = globals; }
public Properties(Language language, string code, string[] imports = null, string jdkPath = null, string pyPath = null, IExecutionProperties exProps = null, ICompilerProperties comProps = null, IGlobals globals = null) { Language = language; Code = code; Imports = imports; JdkPath = jdkPath; PySearchPath = pyPath; ExecuteProperties = exProps; CompilerProperties = comProps; Globals = globals; }
public VbCompiler(string code, IExecutionProperties execProps, ICompilerProperties compProps, string[] imports = null) { SourceCode = code; ExecuteProperties = execProps; CompilerProperties = compProps; if (imports == null) { //TODO: Load references for VB (now: C#) //LoadReferences(); } else { Imports = imports; } Create(); }
public CSharpCompiler(string code, IExecutionProperties execProps, ICompilerProperties compProps, string[] imports = null, IGlobals globals = null) { SourceCode = code; ExecuteProperties = execProps; CompilerProperties = compProps; if (imports == null || !imports.Any()) { LoadReferences(); } else { Imports = imports; } Globals = globals ?? new Globals(new StringBuilder()); Create(); }
public JavaCompiler(string code, IExecutionProperties execProps, ICompilerProperties compProps, string jdkPath = null) { SourceCode = code; ExecuteProperties = execProps; CompilerProperties = compProps; if (string.IsNullOrWhiteSpace(jdkPath) || !Directory.Exists(jdkPath)) { //Search for JDK if jdkPath is invalid directory FindJdk(); } else { //Use JDK Path parameter JdkPath = jdkPath; } }