Exemplo n.º 1
0
        protected override void DoBuild(string[] extraClasspaths, bool noTrace)
        {
            Environment.CurrentDirectory = project.Directory;

            string output = project.FixDebugReleasePath(project.OutputPathAbsolute);
            string outputDir = Path.GetDirectoryName(project.OutputPathAbsolute);
            if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);

            string serverPort = Environment.ExpandEnvironmentVariables("%HAXE_SERVER_PORT%");
            string connect = (!serverPort.StartsWith("%", StringComparison.Ordinal) && serverPort != "0")
                ? "--connect " + serverPort : "";

            // always use relative path for CPP (because it prepends ./)
            //if (project.IsCppOutput)
            //    output = project.FixDebugReleasePath(project.OutputPath);

            if (project.IsFlashOutput)
            {
                SwfmillLibraryBuilder libraryBuilder = new SwfmillLibraryBuilder();

                // before doing anything else, make sure any resources marked as "keep updated"
                // are properly kept up to date if possible
                libraryBuilder.KeepUpdated(project);

                // if we have any resources, build our library file and run swfmill on it
                libraryBuilder.BuildLibrarySwf(project, false);
            }

            string haxeArgs = connect + " " + String.Join(" ", project.BuildHXML(extraClasspaths, output, noTrace));
            
            Console.WriteLine("haxe " + haxeArgs);

            if (!ProcessRunner.Run(haxePath, haxeArgs, false, false))
                throw new BuildException("Build halted with errors (haxe.exe).");
        }
Exemplo n.º 2
0
        protected override void DoBuild(string[] extraClasspaths, bool noTrace)
        {
            Environment.CurrentDirectory = project.Directory;

            string outputDir = Path.GetDirectoryName(project.OutputPathAbsolute);
            if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);

            SwfmillLibraryBuilder libraryBuilder = new SwfmillLibraryBuilder();

            // before doing anything else, make sure any resources marked as "keep updated"
            // are properly kept up to date if possible
            libraryBuilder.KeepUpdated(project);

            // if we have any resources, build our library file and run swfmill on it
            libraryBuilder.BuildLibrarySwf(project, project.CompilerOptions.Verbose);

            // do we have anything to compile?
            if (project.CompileTargets.Count > 0 ||
                project.CompilerOptions.IncludePackages.Length > 0)
            {
                MtascArgumentBuilder mtasc = new MtascArgumentBuilder(project);
                mtasc.AddCompileTargets();
                mtasc.AddOutput();
                mtasc.AddClassPaths(extraClasspaths);
                mtasc.AddOptions(noTrace);

                if (project.UsesInjection)
                {
                    mtasc.AddInput();
                }
                else
                {
                    mtasc.AddFrame(libraryBuilder.Frame);

                    if (project.LibraryAssets.Count == 0)
                        mtasc.AddHeader(); // mtasc will have to generate its own output SWF
                    else
                        mtasc.AddKeep(); // keep everything you added with swfmill
                }

                string mtascArgs = mtasc.ToString();

                if (project.CompilerOptions.Verbose)
                    Console.WriteLine("mtasc " + mtascArgs);

                if (!ProcessRunner.Run(MtascPath, mtascArgs, false, false))
                    throw new BuildException("Build halted with errors (mtasc).");
            }
        }