Exemplo n.º 1
0
        private void ResolveBuildJobItems(string rootDir, ProjectBuildTarget buildTarget)
        {
            Dictionary <string, string> varMap = new Dictionary <string, string>
            {
                { "VISDIR", AppRootHelper.AppRoot },
                {
                    "PROJDIR", rootDir.EndsWith("\\") ||
                    rootDir.EndsWith("/")
                                                                          ? rootDir
                                                                          : rootDir + "/"
                },
                { "NAME", ProjectName },
                { "VERSION", ProjectVersion },
                { "TARGET", buildTarget.TargetName },
            };

            foreach (string varMapKey in varMap.Keys.ToArray())
            {
                buildTarget.TargetName = buildTarget.TargetName.Replace($"%{varMapKey}%", varMap[varMapKey]);

                for (int i = 0; i < buildTarget.DependsOn.Length; i++)
                {
                    buildTarget.DependsOn[i] =
                        buildTarget.DependsOn[i].Replace($"%{varMapKey}%", varMap[varMapKey]);
                }
            }
        }
Exemplo n.º 2
0
 public static string Serialize(ProjectBuildTarget config)
 {
     return(JsonConvert.SerializeObject(
                config,
                Formatting.Indented
                ));
 }
Exemplo n.º 3
0
        private void ResolveBuildJobItems(string rootDir, ProjectBuildTarget buildTarget, ProjectBuildJob job)
        {
            Dictionary <string, string> varMap = new Dictionary <string, string>
            {
                { "VISDIR", AppRootHelper.AppRoot },
                {
                    "PROJDIR", rootDir.EndsWith("\\") ||
                    rootDir.EndsWith("/")
                                                                          ? rootDir
                                                                          : rootDir + "/"
                },
                { "NAME", ProjectName },
                { "VERSION", ProjectVersion },
                { "TARGET", buildTarget.TargetName },
            };

            foreach (string varMapKey in varMap.Keys.ToArray())
            {
                job.JobName = job.JobName.Replace($"%{varMapKey}%", varMap[varMapKey]);

                foreach (string argumentsKey in job.Arguments.Keys.ToArray())
                {
                    job.Arguments[argumentsKey] =
                        job.Arguments[argumentsKey].Replace($"%{varMapKey}%", varMap[varMapKey]);
                }
            }
        }
Exemplo n.º 4
0
        public void RunTarget(string rootDir, string target)
        {
            if (!BuildTargets.ContainsKey(target))
            {
                Logger.LogMessage(LoggerSystems.ModuleSystem, "Can not Find Target: {0}", target);

                return;
            }

            ProjectBuildTarget buildTarget = BuildTargets[target];

            RunTarget(rootDir, buildTarget);
        }
Exemplo n.º 5
0
        public void RunJob(
            string rootDir,
            ProjectBuildTarget buildTarget,
            ProjectBuildJob job)
        {
            if (!s_BuildJobRunners.ContainsKey(job.BuildJobRunner))
            {
                Logger.LogMessage(LoggerSystems.ModuleSystem, "Can not Find Job Runner: {0}", job.BuildJobRunner);

                return;
            }

            ResolveBuildJobItems(rootDir, buildTarget, job);

            s_BuildJobRunners[job.BuildJobRunner].RunJob(rootDir, this, buildTarget, job);
        }
Exemplo n.º 6
0
        public void RunTarget(string rootDir, ProjectBuildTarget buildTarget)
        {
            ResolveBuildJobItems(rootDir, buildTarget);

            foreach (string dependency in buildTarget.DependsOn)
            {
                if (File.Exists(dependency))
                {
                    RunTarget(rootDir, ProjectBuildTarget.Load(dependency));
                }
                else
                {
                    RunTarget(rootDir, dependency);
                }
            }

            Logger.LogMessage(LoggerSystems.ModuleSystem, $"Running {buildTarget.Jobs.Count} Jobs...");

            foreach (ProjectBuildJob buildTargetJob in buildTarget.Jobs)
            {
                RunJob(rootDir, buildTarget, buildTargetJob);
            }
        }
Exemplo n.º 7
0
 public static void Save(string path, ProjectBuildTarget config)
 {
     File.WriteAllText(path, Serialize(config));
 }