예제 #1
0
    private static bool FDBuild(Project project, bool runOutput, string compiler)
    {
        string fdBuildDir  = Path.Combine(PathHelper.ToolDir, "fdbuild");
        string fdBuildPath = Path.Combine(fdBuildDir, "fdbuild.exe");

        string arguments = "";

        if (compiler != null && compiler.Length > 0)
        {
            arguments += " -compiler \"" + compiler + "\"";
        }

        arguments += " -notrace";
        arguments += " -library \"" + PathHelper.LibraryDir + "\"";

        foreach (string cp in ProjectManager.PluginMain.Settings.GlobalClasspaths)
        {
            arguments += " -cp \"" + Environment.ExpandEnvironmentVariables(cp) + "\"";
        }

        arguments += " -cp \"" + project.Directory + "\\libs-release\\" + "\"";
        arguments  = arguments.Replace("\\\"", "\"");        // c# console args[] bugfix

        fdProcess.StartProcess(
            fdBuildPath,
            "\"" + project.ProjectPath + "\"" + arguments,
            project.Directory,
            delegate(bool success) {}
            );

        return(true);
    }
예제 #2
0
        public void Build(Project project, bool runOutput, bool noTrace)
        {
            this.runOutput = runOutput;
            this.project   = project;

            if (project.CompilerOptions.UseMain && project.CompileTargets.Count == 0)
            {
                ErrorHandler.ShowInfo("In order to build this project, you must mark one or more classes as \"Always Compile\" in the project Explorer, or turn off the 'UseMain' compiler option.");
                return;
            }

            if (project.OutputPath.Length < 1)
            {
                ErrorHandler.ShowInfo("In order to build this project, you must specify a valid Output SWF in the Project Properties.");
                return;
            }

            // save modified files
            mainForm.CallCommand("SaveAllModified", null);

            string toolsPath   = Path.Combine(Application.StartupPath, "tools");
            string fdBuildDir  = Path.Combine(toolsPath, "fdbuild");
            string fdBuildPath = Path.Combine(fdBuildDir, "fdbuild.exe");

            string arguments = "";

            if (noTrace)
            {
                arguments += " -notrace";
            }

            if (Settings.GlobalClasspaths != null)
            {
                foreach (string cp in Environment.ExpandEnvironmentVariables(Settings.GlobalClasspaths).Split(';'))
                {
                    arguments += " -cp \"" + cp + "\"";
                }
            }

            arguments = arguments.Replace("\\\"", "\"");             // c# console args[] bugfix

            SetStatusBar("Build started...");

            // track what classpaths, if any, were missing before the build
            missingClasspaths.Clear();
            foreach (string cp in project.AbsoluteClasspaths)
            {
                if (!Directory.Exists(cp))
                {
                    missingClasspaths.Add(cp);
                }
            }

            fdProcess.StartProcess(fdBuildPath,
                                   "\"" + project.ProjectPath + "\"" + arguments,
                                   project.Directory, new ProcessEndedHandler(BuildCallback));
        }
예제 #3
0
        public bool FDBuild(Project project, bool runOutput, bool noTrace, string compiler)
        {
            string directory = Environment.CurrentDirectory;

            Environment.CurrentDirectory = project.Directory;

            string fdBuildDir  = Path.Combine(PathHelper.ToolDir, "fdbuild");
            string fdBuildPath = Path.Combine(fdBuildDir, "fdbuild.exe");

            string arguments = " -ipc " + ipcName;

            if (compiler != null && compiler.Length > 0)
            {
                arguments += " -compiler \"" + compiler + "\"";
            }
            if (noTrace)
            {
                arguments += " -notrace";
            }
            arguments += " -library \"" + PathHelper.LibraryDir + "\"";

            foreach (string cp in PluginMain.Settings.GlobalClasspaths)
            {
                arguments += " -cp \"" + Environment.ExpandEnvironmentVariables(cp) + "\"";
            }

            arguments = arguments.Replace("\\\"", "\"");             // c# console args[] bugfix

            SetStatusBar(TextHelper.GetString("Info.BuildStarted"));
            menus.DisabledForBuild = true;
            menus.ConfigurationSelector.Enabled = false;

            fdProcess.StartProcess(fdBuildPath, "\"" + project.ProjectPath + "\"" + arguments,
                                   project.Directory, delegate(bool success)
            {
                menus.DisabledForBuild = false;
                menus.ConfigurationSelector.Enabled = true;     // !project.NoOutput;
                if (success)
                {
                    SetStatusBar(TextHelper.GetString("Info.BuildSucceeded"));
                    AddTrustFile(project);
                    OnBuildComplete(runOutput);
                }
                else
                {
                    SetStatusBar(TextHelper.GetString("Info.BuildFailed"));
                    OnBuildFailed(runOutput);
                }
                Environment.CurrentDirectory = directory;
            });
            return(true);
        }
예제 #4
0
        public bool FDBuild(Project project, bool runOutput, bool releaseMode, InstalledSDK sdk)
        {
            string directory = Environment.CurrentDirectory;

            Environment.CurrentDirectory = project.Directory;

            string fdBuildDir  = Path.Combine(PathHelper.ToolDir, "fdbuild");
            string fdBuildPath = Path.Combine(fdBuildDir, "fdbuild.exe");

            string arguments = " -ipc " + ipcName;

            if (sdk != null && sdk.Version != null)
            {
                arguments += " -version \"" + sdk.Version.Replace(',', ';') + "\"";
                if (!string.IsNullOrEmpty(project.CurrentSDK))
                {
                    arguments += " -compiler \"" + project.CurrentSDK + "\"";
                }
            }

            if (releaseMode)
            {
                arguments += " -notrace";
            }
            arguments += " -library \"" + PathHelper.LibraryDir + "\"";

            foreach (string cp in PluginMain.Settings.GlobalClasspaths)
            {
                arguments += " -cp \"" + Environment.ExpandEnvironmentVariables(cp) + "\"";
            }

            if (project.TargetBuild != null)
            {
                arguments += " -target \"" + project.TargetBuild + "\"";
            }

            arguments = arguments.Replace("\\\"", "\"");             // c# console args[] bugfix

            SetStatusBar(TextHelper.GetString("Info.BuildStarted"));
            menus.DisabledForBuild = true;

            // Apache Flex compat
            if (project.Language == "as3")
            {
                string playerglobalHome = Environment.ExpandEnvironmentVariables("%PLAYERGLOBAL_HOME%");
                if (playerglobalHome.StartsWith("%"))
                {
                    setPlayerglobalHomeEnv = true;
                }
                if (setPlayerglobalHomeEnv)
                {
                    Environment.SetEnvironmentVariable("PLAYERGLOBAL_HOME",
                                                       Path.Combine(project.CurrentSDK, "frameworks/libs/player"));
                }
            }

            // run FDBuild
            fdProcess.StartProcess(fdBuildPath, "\"" + project.ProjectPath + "\"" + arguments,
                                   project.Directory, delegate(bool success)
            {
                menus.DisabledForBuild = false;
                if (success)
                {
                    SetStatusBar(TextHelper.GetString("Info.BuildSucceeded"));
                    AddTrustFile(project);
                    OnBuildComplete(project, runOutput);
                }
                else
                {
                    SetStatusBar(TextHelper.GetString("Info.BuildFailed"));
                    OnBuildFailed(project, runOutput);
                }
                Environment.CurrentDirectory = directory;
            });
            return(true);
        }