예제 #1
0
    private static bool Build(Project project, bool runOutput)
    {
        // save modified files
        mainForm.CallCommand("SaveAllModified", null);

        string compiler = null;
        if (project.NoOutput) {
            // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects
            if (project.Language == "as3")
                compiler = GetCompilerPath(project);

            if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0) {
                // no output and no build commands
                if (project is AS2Project || project is AS3Project) {
                    ErrorManager.ShowInfo("このプロジェクトはなにも出力せず、コマンドも実行しません。");
                }
                else {
                    ErrorManager.ShowInfo("このプロジェクトは有効な AS2 / AS3 プロジェクトではありません。");
                }
                return false;
            }
        }
        else {
            // Ask the project to validate itself
            string error;
            project.ValidateBuild(out error);

            if (error != null) {
                ErrorManager.ShowInfo(TextHelper.GetString(error));
                return false;
            }

            // 出力先が空だったとき
            if (project.OutputPath.Length < 1) {
                String info = "プロジェクトをビルドするには、プロジェクトプロパティに SWF ファイルの有効な出力先を設定する必要があります。";
                ErrorManager.ShowInfo(info);
                return false;
            }

            compiler = GetCompilerPath(project);
            if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler))) {
                MessageBox.Show("Flex SDK へのパスが間違っています。プロジェクトプロパティのコンパイル設定を修正してください。", "エラー", MessageBoxButtons.OK);
                return false;
            }
        }

        return FDBuild(project, runOutput, compiler);
    }
        public bool Build(Project project, bool runOutput, bool releaseMode)
        {
            // save modified files
            mainForm.CallCommand("SaveAllModified", null);

            string compiler = null;
            InstalledSDK sdk = null;
            if (project.IsCompilable)
            {
                sdk = GetProjectSDK(project);
                compiler = GetCompilerPath(project, sdk);
            }
            project.TraceEnabled = !releaseMode;

            if (project.OutputType == OutputType.OtherIDE)
            {
                // compile using associated IDE
                string error;
                string command = project.GetOtherIDE(runOutput, releaseMode, out error);

                if (error != null) ErrorManager.ShowInfo(TextHelper.GetString(error));
                else
                {
                    if (command == "FlashIDE") RunFlashIDE(project, runOutput, releaseMode);
                    else
                    {
                        Hashtable data = new Hashtable();
                        data["command"] = command;
                        data["project"] = project;
                        data["runOutput"] = runOutput;
                        data["releaseMode"] = releaseMode;
                        DataEvent de = new DataEvent(EventType.Command, "ProjectManager.RunWithAssociatedIDE", data);
                        EventManager.DispatchEvent(project, de);
                        if (de.Handled) return true;
                    }
                }
                return false;
            }
            else if (project.OutputType == OutputType.CustomBuild)
            {
                // validate commands not empty
                if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0)
                {
                    String info = TextHelper.GetString("Info.NoOutputAndNoBuild");
                    TraceManager.Add(info);
                }
            }
            else if (project.IsCompilable)
            {
                // ask the project to validate itself
                string error;
                project.ValidateBuild(out error);

                if (error != null)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString(error));
                    return false;
                }

                if (project.OutputPath.Length == 0)
                {
                    String info = TextHelper.GetString("Info.SpecifyValidOutputSWF");
                    ErrorManager.ShowInfo(info);
                    return false;
                }

                if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler)))
                {
                    string info = TextHelper.GetString("Info.CheckSDKSettings");
                    MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OK);
                    return false;
                }
            }
            
            // close running AIR projector
            if (project.MovieOptions.Platform.StartsWith("AIR"))
            {
                foreach (Process proc in Process.GetProcessesByName("adl"))
                {
                    try { proc.Kill(); proc.WaitForExit(10 * 1000); }
                    catch { }
                }
            }

            return FDBuild(project, runOutput, releaseMode, sdk);
        }
예제 #3
0
        public bool Build(Project project, bool runOutput, bool noTrace)
        {
            // save modified files
            mainForm.CallCommand("SaveAllModified", null);
            string compiler = null;
            project.TraceEnabled = !noTrace;
            if (project.NoOutput)
            {
                // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects
                if (project.Language == "as3") compiler = GetCompilerPath(project);
                
                if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0)
                {
                    // no output and no build commands
                    if (project is AS2Project || project is AS3Project) RunFlashIDE(runOutput, noTrace);
                    else
                    {
                        String info = TextHelper.GetString("Info.NoOutputAndNoBuild");
                        ErrorManager.ShowInfo(info);
                    }
                    return false;
                }
            }
            else
            {
                // Ask the project to validate itself
                string error;
                project.ValidateBuild(out error);

                if (error != null)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString(error));
                    return false;
                }

                if (project.OutputPath.Length < 1)
                {
                    String info = TextHelper.GetString("Info.SpecifyValidOutputSWF");
                    ErrorManager.ShowInfo(info);
                    return false;
                }
                compiler = GetCompilerPath(project);
                if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler)))
                {
                    if (usingProjectDefinedCompiler)
                    {
                        string info = TextHelper.GetString("Info.InvalidCustomCompiler");
                        MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OK);
                    }
                    else
                    {
                        string info = String.Format(TextHelper.GetString("Info.SpecifyCompilerPath"), project.Language.ToUpper());
                        DialogResult result = MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel);
                        if (result == DialogResult.OK)
                        {
                            DataEvent de = new DataEvent(EventType.Command, "ASCompletion.ShowSettings", project.Language);
                            EventManager.DispatchEvent(this, de);
                        }
                    }
                    return false;
                }
            }
            return FDBuild(project, runOutput, noTrace, compiler);
        }
예제 #4
0
        public bool Build(Project project, bool runOutput)
        {
            ipcName = Globals.MainForm.ProcessArgString("$(BuildIPC)");

            string compiler = null;
            if (project.NoOutput)
            {
                // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects
                if (project.Language == "as3")
                    compiler = ProjectManager.Actions.BuildActions.GetCompilerPath(project);

                if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0)
                {
                    // no output and no build commands
                    if (project is AS2Project || project is AS3Project)
                    {
                        //RunFlashIDE(runOutput);
                        //ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.NoOutputAndNoBuild"));
                    }
                    else
                    {
                        //ErrorManager.ShowInfo("Info.InvalidProject");
                        ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.NoOutputAndNoBuild"));
                    }
                    return false;
                }
            }
            else
            {
                // Ask the project to validate itself
                string error;
                project.ValidateBuild(out error);

                if (error != null)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString(error));
                    return false;
                }

                // 出力先が空だったとき
                if (project.OutputPath.Length < 1)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.SpecifyValidOutputSWF"));
                    return false;
                }

                compiler = BuildActions.GetCompilerPath(project);
                if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler)))
                {
                    string info = TextHelper.GetString("ProjectManager.Info.InvalidCustomCompiler");
                    MessageBox.Show(info, TextHelper.GetString("ProjectManager.Title.ConfigurationRequired"), MessageBoxButtons.OK);
                    return false;
                }
            }

            return FDBuild(project, runOutput, compiler);
        }