Exemple #1
0
		public void CreateCompilationTasks (BuildTasks tasks, string build_dir, IEnumerable<Abi> abis)
		{
			var assembly = Path.Combine (build_dir, FileName);

			if (App.FastDev)
				Dylib = Path.Combine (App.AppDirectory, Driver.Quote ("lib" + Path.GetFileName (FullPath) + ".dylib"));

			foreach (var abi in abis) {
				var task = CreateManagedToAssemblyTasks (assembly, abi, build_dir);
				if (task != null)
					tasks.AddRange (task);
			}
		}
Exemple #2
0
		IEnumerable<BuildTask> CreateCompileTasks (string s, string asm_infile, string llvm_infile, Abi abi)
		{
			var compile_tasks = new BuildTasks ();
			if (asm_infile != null) {
				var task = CreateCompileTask (s, asm_infile, abi);
				if (task != null)
					compile_tasks.Add (task);
			}

			if (llvm_infile != null) {
				var taskllvm = CreateCompileTask (s, llvm_infile, abi);
				if (taskllvm != null)
					compile_tasks.Add (taskllvm);
			}
			return compile_tasks.Count > 0 ? compile_tasks : null;
		}
Exemple #3
0
        public async Task Execute(BuildTasks build_tasks)
        {
            if (started_task.TrySetResult(true))
            {
                var watch = new System.Diagnostics.Stopwatch();
                try {
                    Log("Launching task");
                    var deps      = Dependencies.ToArray();
                    var dep_tasks = new Task [deps.Length];
                    for (int i = 0; i < deps.Length; i++)
                    {
                        dep_tasks [i] = deps [i].Execute(build_tasks);
                    }

                    Log("Waiting for dependencies to complete.");
                    await Task.WhenAll(dep_tasks);

                    Log("Done waiting for dependencies.");

                    // We can only check if we're up-to-date after executing dependencies.
                    if (IsUptodate)
                    {
                        if (Outputs.Count() > 1)
                        {
                            Driver.Log(3, "Targets '{0}' are up-to-date.", string.Join("', '", Outputs.ToArray()));
                        }
                        else
                        {
                            Driver.Log(3, "Target '{0}' is up-to-date.", Outputs.First());
                        }
                        completed_task.SetResult(false);
                    }
                    else
                    {
                        Driver.Log(3, "Target(s) {0} must be rebuilt.", string.Join(", ", Outputs.ToArray()));
                        Log("Dependencies are complete.");
                        await build_tasks.AcquireSemaphore();

                        try {
                            Log("Executing task");
                            watch.Start();
                            await ExecuteAsync();

                            watch.Stop();
                            Log("Completed task {0} s", watch.Elapsed.TotalSeconds);
                            completed_task.SetResult(true);
                        } finally {
                            build_tasks.ReleaseSemaphore();
                        }
                    }
                } catch (Exception e) {
                    Log("Completed task in {0} s with exception: {1}", watch.Elapsed.TotalSeconds, e.Message);
                    completed_task.SetException(e);
                    throw;
                }
            }
            else
            {
                Log("Waiting for started task");
                await completed_task.Task;
                Log("Waited for started task");
            }
        }