Beispiel #1
0
        /// <summary>
        /// Start background process
        /// </summary>
        private void StartMxmlcRunner(string flexPath)
        {
            currentSDK = flexPath;
            if (mxmlcRunner != null && mxmlcRunner.IsRunning)
            {
                mxmlcRunner.KillProcess();
            }

            CheckIsFlex4SDK(flexPath);
            string shell = isFlex4SDK ? "Mxmlc4Shell" : "MxmlcShell";

            string cmd = jvmConfig["java.args"]
                         + " -classpath \"" + mxmlcPath + ";" + flexShellsPath + "\" " + shell;

            TraceManager.Add(TextHelper.GetString("Info.StartMxmlcRunner") + "\n"
                             + JvmConfigHelper.GetJavaEXE(jvmConfig) + " " + cmd, -1);
            // run compiler shell
            mxmlcRunner = new ProcessRunner();
            mxmlcRunner.WorkingDirectory = Path.Combine(flexPath, "frameworks");
            mxmlcRunner.RedirectInput    = true;
            mxmlcRunner.Run(JvmConfigHelper.GetJavaEXE(jvmConfig), cmd, true);
            mxmlcRunner.Output += mxmlcRunner_Output;
            mxmlcRunner.Error  += mxmlcRunner_Error;
            errorState          = 0;
            Thread.Sleep(100);
        }
        void CompileWithMxmlc(string mxmlcArgs)
        {
            var javaExe = JvmConfigHelper.GetJavaEXE(jvmConfig, CompilerPath);

            Console.WriteLine("Running java as: " + javaExe);
            var frameworks = Path.Combine(CompilerPath, "frameworks");
            var args       = $"-Dflexcompiler=\"{CompilerPath}\" -Dflexlib=\"{frameworks}\" {jvmArgs} -jar \"{mxmlcPath}\"";

            args += " -js-output-type=FLEXJS";
            args += " -sdk-js-lib=\"" + Path.Combine(frameworks, "js", "FlexJS", "generated-sources") + "\" ";
            var index = mxmlcArgs.LastIndexOf("-o ");

            if (index != -1)
            {
                mxmlcArgs = mxmlcArgs.Remove(index);
            }
            args += mxmlcArgs;
            args += " -targets=SWF";
            args += " " + project.CompileTargets.First();
            args += " -output=" + project.OutputPath;
            if (!ProcessRunner.Run(javaExe, args, false, false))
            {
                throw new BuildException("Build halted with errors (mxmlc).");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Start background process
        /// </summary>
        private void StartAscRunner()
        {
            string cmd = "-Duser.language=en -Duser.region=US"
                         + " -classpath \"" + ascPath + ";" + flexShellsPath + "\" AscShell";

            TraceManager.Add(TextHelper.GetString("Info.StartAscRunner") + " java " + cmd, -1);
            // run asc shell
            ascRunner = new ProcessRunner();
            ascRunner.WorkingDirectory = Path.GetDirectoryName(ascPath);
            ascRunner.RedirectInput    = true;
            ascRunner.Run(JvmConfigHelper.GetJavaEXE(jvmConfig), cmd, true);
            ascRunner.Output += ascRunner_Output;
            ascRunner.Error  += ascRunner_Error;
            errorState        = 0;
            Thread.Sleep(100);
        }
        public void CompileWithMxmlc(string workingdir, string arguments, bool configChanged)
        {
            if (fcsh != null)
            {
                string   output;
                string[] errors;
                string[] warnings;
                string   jar    = ascshPath != null ? ascshPath : fcshPath;
                string   jvmarg = VMARGS + " -Dapplication.home=\"" + sdkPath
                                  //+ "\" -Dflexlib=\"" + Path.Combine(sdkPath, "frameworks")
                                  + "\" -jar \"" + jar + "\"";
                fcsh.Compile(workingdir, configChanged, arguments, out output, out errors, out warnings, jvmarg, JvmConfigHelper.GetJavaEXE(jvmConfig, sdkPath));

                string[] lines = output.Split('\n');
                foreach (string line in lines)
                {
                    if (!line.StartsWith("Recompile:", StringComparison.Ordinal) && !line.StartsWith("Reason:", StringComparison.Ordinal))
                    {
                        Console.Write(line);
                    }
                }
                foreach (string warning in warnings)
                {
                    Console.Error.WriteLine(warning);
                }
                foreach (string error in errors)
                {
                    Console.Error.WriteLine(error);
                }

                if (errors.Length > 0)
                {
                    throw new BuildException("Build halted with errors (fcsh).");
                }
            }
            else
            {
                string jar     = asc2Mode ? asc2Path : mxmlcPath;
                string javaExe = JvmConfigHelper.GetJavaEXE(jvmConfig, sdkPath);
                Console.WriteLine("Running java as: " + javaExe);
                string jvmarg = VMARGS + " -jar \"" + jar + "\" +flexlib=\"" + Path.Combine(sdkPath, "frameworks") + "\" ";
                if (!ProcessRunner.Run(javaExe, jvmarg + arguments, false, asc2Mode))
                {
                    throw new BuildException("Build halted with errors (" + (asc2Mode ? "mxmlc-cli" : "mxmlc") + ").");
                }
            }
        }
Beispiel #5
0
        bool Initialize(string flexSDKPath, Dictionary <string, string> jvmConfig, string projectPath)
        {
            cmdQueue = new Queue <string>();

            string fdbPath = Path.Combine(flexSDKPath, "lib\\fdb.jar");

            if (!File.Exists(fdbPath))
            {
                fdbPath = Path.Combine(flexSDKPath, "lib\\legacy\\fdb.jar");
            }
            if (!File.Exists(fdbPath))
            {
                process = null;
                return(false);
            }

            workingDir = projectPath;
            process    = new Process();
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardInput  = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.FileName  = JvmConfigHelper.GetJavaEXE(jvmConfig);
            process.StartInfo.Arguments = jvmConfig["java.args"]
                                          + "  -Dfile.encoding=UTF-8 -Dapplication.home=\"" + flexSDKPath + "\" -jar \"" + fdbPath + "\"";
            process.StartInfo.WorkingDirectory       = workingDir;
            process.StartInfo.StandardErrorEncoding  = Encoding.UTF8;
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            process.Start();

            process.Exited += process_Exited;

            errorThread = new Thread(ReadErrors);
            errorThread.Start();

            fdbThread = new Thread(FdbRun);
            fdbThread.Start();

            Thread.Sleep(100);
            return(true);
        }
Beispiel #6
0
        /// <summary>
        /// Start background process
        /// </summary>
        private void StartAscRunner(string flexPath)
        {
            currentSDK = flexPath;
            if (ascRunner != null && ascRunner.IsRunning)
            {
                ascRunner.KillProcess();
            }

            string cmd = jvmConfig["java.args"]
                         + " -classpath \"" + ascPath + ";" + flexShellsPath + "\" AscShell";

            TraceManager.Add(TextHelper.GetString("Info.StartAscRunner") + "\n"
                             + JvmConfigHelper.GetJavaEXE(jvmConfig) + " " + cmd, 0);
            // run asc shell
            ascRunner = new ProcessRunner();
            ascRunner.WorkingDirectory = Path.GetDirectoryName(ascPath);
            ascRunner.RedirectInput    = true;
            ascRunner.Run(JvmConfigHelper.GetJavaEXE(jvmConfig), cmd, true);
            ascRunner.Output += ascRunner_Output;
            ascRunner.Error  += ascRunner_Error;
            errorState        = 0;
            Thread.Sleep(100);
        }