Exemplo n.º 1
0
        public void Build(Func <ProjectDOM.Project, PathString, Factory.Collection> evalPlugins, SDK.IMonitorContext monitor, PathString buildTarget)
        {
            _CancelRequested = false;

            var state = new Evaluation.PipelineClientState.Manager();

            var prjFilePath = _SrcPrj;

            prjFilePath = prjFilePath.AsAbsolute();
            var dstDirPath = buildTarget.AsAbsolute();

            // load project
            var document = ProjectDOM.LoadProjectFrom(prjFilePath);

            // load plugins
            var prjDir  = prjFilePath.DirectoryPath;
            var plugins = evalPlugins(document, prjDir);

            // create build context

            var buildSettings = Evaluation.BuildContext.Create(_Configuration, prjDir, dstDirPath, _TargetTask == "SIMULATE");

            // do build
            ProjectDOM.BuildProject(document, buildSettings, plugins.CreateInstance, monitor, state);

            if (!IsSimulation)
            {
                CommitBuildResults(_TmpDir, _OutDir);
            }
        }
Exemplo n.º 2
0
        public static CommandLineContext Create(params string[] args)
        {
            if (args == null || args.Length == 0)
            {
                throw new ArgumentNullException(nameof(args));
            }

            // todo: check if first arg is .exe and skip it

            var prjPath = new PathString(args.Where(item => !item.StartsWith("-")).First());

            prjPath = prjPath.AsAbsolute();

            var cfg = _GetCommandArgument(args, "-CFG:", "Root");

            var outDir = new PathString(_GetCommandArgument(args, "-OUT:", $"bin\\{cfg}")).AsAbsolute();
            var tmpDir = new PathString(_GetCommandArgument(args, "-TMP:", $"obj\\{cfg}")).AsAbsolute();

            // in simulate mode, we should replace the ContextWriters with dummy ones
            var targetTask = args.Any(item => item.StartsWith("-SIMULATE")) ? "SIMULATE" : "BUILD";

            return(new CommandLineContext(targetTask, prjPath, outDir, tmpDir, cfg));
        }