Esempio n. 1
0
        public static StepResults DownloadFile(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults();

            sr.Command = Path.GetFileName(step.Command);

            sr.Log += string.Format("DownloadFile: {0}\n", step.Arguments);

            try {
                if (!Directory.Exists(Path.GetDirectoryName(step.Arguments)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(step.Arguments));
                }

                WebClient wc = new WebClient();
                wc.DownloadFile(step.Arguments, Path.Combine(step.WorkingDirectory, Path.GetFileName(step.Arguments)));

                sr.Log     += string.Format("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log     += string.Format("Failed:\n{0}\n", ex.ToString());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract(start);

            return(sr);
        }
Esempio n. 2
0
        static int Main(string[] args)
        {
            // Build mono runtime
            Console.WriteLine("Building the mono runtime..");

            string msbuild  = @"C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe";
            string solution = Utilities.CombinePaths(Environment.CurrentDirectory, "mono", "msvc", "mono.sln");

            string[] msbuild_args = new string[] { "/m", "\"" + solution + "\"", "/p:Configuration=Release_eglib", "/p:Platform=Win32" };

            CommandLineResults results = CommandLineRunner.ExecuteCommand(msbuild, null, string.Join(" ", msbuild_args));

            if (results.ExitCode != 0)
            {
                Console.WriteLine("Error compiling mono runtime:");
                Console.WriteLine(results.Output);
                return(1);
            }

            Console.WriteLine("Runtime successfully built.");

            // Build managed libraries/tools
            Console.WriteLine("Building the managed libraries..");

            MonoCompiler.MonoCompiler mc = new MonkeyBuilder.MonoCompiler.MonoCompiler();

            string config_file = Utilities.CombinePaths(Environment.CurrentDirectory, "mono", "msvc", "win32.xml");

            StepResults compile_results = mc.Compile("unknown", config_file);

            if (compile_results.ExitCode != 0)
            {
                Console.WriteLine("Error compiling managed libraries:");
                Console.WriteLine(compile_results.Log);
                return(1);
            }

            Console.WriteLine("Managed libraries successfully built.");

            return(0);
        }
Esempio n. 3
0
        public static StepResults RemoveDirectory(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults();

            sr.Command = Path.GetFileName(step.Command);

            sr.Log += string.Format("RemoveDirectory: {0}\n", step.Arguments);

            try {
                Directory.Delete(step.Arguments, true);
                sr.Log     += string.Format("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log     += string.Format("Failed:\n{0}\n", ex.ToString());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract(start);

            return(sr);
        }
Esempio n. 4
0
        public static StepResults CopyFile(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults ();
            sr.Command = Path.GetFileName (step.Command);

            string source;
            string dest;

            try {
                source = step.Arguments.Split (' ')[0];
                dest = step.Arguments.Split (' ')[1];

            } catch (Exception) {
                sr.Log += string.Format ("CopyFile: Cannot determine source and destination.\nMust be of form: <source> <dest>\nFound: {0}\n", step.Arguments);
                sr.ExecutionTime = DateTime.Now.Subtract (start);
                sr.ExitCode = 1;
                return sr;
            }

            sr.Log += string.Format ("CopyFile: {0} => {1}\n", source, dest);

            try {
                File.Copy (source, dest, true);
                sr.Log += string.Format ("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log += string.Format ("Failed:\n{0}\n", ex.ToString ());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract (start);

            return sr;
        }
Esempio n. 5
0
        public static StepResults MoveFile(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults();

            sr.Command = Path.GetFileName(step.Command);

            string source;
            string dest;

            try {
                source = step.Arguments.Split(' ')[0];
                dest   = step.Arguments.Split(' ')[1];
            } catch (Exception) {
                sr.Log          += string.Format("MoveFile: Cannot determine source and destination.\nMust be of form: <source> <dest>\nFound: {0}\n", step.Arguments);
                sr.ExecutionTime = DateTime.Now.Subtract(start);
                sr.ExitCode      = 1;
                return(sr);
            }

            sr.Log += string.Format("MoveFile: {0} => {1}\n", source, dest);

            try {
                File.Move(source, dest);
                sr.Log     += string.Format("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log     += string.Format("Failed:\n{0}\n", ex.ToString());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract(start);

            return(sr);
        }
Esempio n. 6
0
        public static StepResults DownloadFile(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults ();
            sr.Command = Path.GetFileName (step.Command);

            sr.Log += string.Format ("DownloadFile: {0}\n", step.Arguments);

            try {
                if (!Directory.Exists (Path.GetDirectoryName (step.Arguments)))
                    Directory.CreateDirectory (Path.GetDirectoryName (step.Arguments));

                WebClient wc = new WebClient ();
                wc.DownloadFile (step.Arguments, Path.Combine (step.WorkingDirectory, Path.GetFileName (step.Arguments)));

                sr.Log += string.Format ("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log += string.Format ("Failed:\n{0}\n", ex.ToString ());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract (start);

            return sr;
        }
Esempio n. 7
0
        public static StepResults RemoveDirectory(BuildStep step)
        {
            DateTime start = DateTime.Now;

            StepResults sr = new StepResults ();
            sr.Command = Path.GetFileName (step.Command);

            sr.Log += string.Format ("RemoveDirectory: {0}\n", step.Arguments);

            try {
                Directory.Delete (step.Arguments, true);
                sr.Log += string.Format ("Success.");
                sr.ExitCode = 0;
            } catch (Exception ex) {
                sr.Log += string.Format ("Failed:\n{0}\n", ex.ToString ());
                sr.ExitCode = 1;
            }

            sr.ExecutionTime = DateTime.Now.Subtract (start);

            return sr;
        }