Ejemplo n.º 1
0
        public async Task RunAsync()
        {
            var ctx = BuildContext.Default;

            var bt = new Bullseye.Targets();

            if (WxsOnly)
            {
                bt.Add("Clean#all", () =>
                {
                    try
                    { Directory.Delete(ctx.BinDir, true); }
                    catch { };
                });

                bt.Add("Clean", Bullseye.Targets.DependsOn("Clean#all"));
            }
            else
            {
                bt.Add("Clean#CompilerDir", () =>
                {
                    try
                    { Directory.Delete(ctx.CompilerDir, true); }
                    catch { };
                });

                bt.Add("Clean#OutDir", () =>
                {
                    try
                    { Directory.Delete(ctx.OutDir, true); }
                    catch { };
                });

                bt.Add("Clean",
                       Bullseye.Targets.DependsOn("Clean#CompilerDir", "Clean#OutDir"));
            }

            try
            {
                await bt.RunWithoutExitingAsync("Clean".Split());
            }
            catch
            {
                // We swallow exceptions here, BullsEye prints them
                // TODO: use overload "messageOnly"
            }

            // TODO: Add support for Targets
        }
Ejemplo n.º 2
0
        public async Task RunAsync()
        {
            if (Targets.Any(t => t.ToLower() == "all"))
            {
                Targets = BuildContext.Default.Config.ProductNames;
            }

            var bt  = new Bullseye.Targets();
            var cmd = this;

            var productBuildTargets = new List <string>();

            foreach (var target in Targets)
            {
                var product = target;
                var ctx     = new BuildContext();
                ctx.SetCommand(this);

                bt.Add(
                    FindPackageTarget.NameWith(product),
                    async() => await FindPackageTarget.RunAsync(ctx, product));

                bt.Add(
                    FetchPackageTarget.NameWith(product),
                    Bullseye.Targets.DependsOn(FindPackageTarget.NameWith(product)),
                    async() => await FetchPackageTarget.RunAsync(ctx));

                productBuildTargets.Add(FetchPackageTarget.NameWith(product));
            }

            try
            {
                await bt.RunWithoutExitingAsync(productBuildTargets);
            }
            catch
            {
                // We swallow exceptions here, BullsEye prints them
                // TODO: use overload "messageOnly"
            }
        }
Ejemplo n.º 3
0
        public async Task RunAsync()
        {
            if (Targets.Any(t => t.ToLower() == "all"))
            {
                Targets = BuildContext.Default.Config.ProductNames;
            }

            var bt  = new Bullseye.Targets();
            var cmd = this;

            bt.Add(
                BuildBeatPackageCompilerTarget.Name,
                async() => await BuildBeatPackageCompilerTarget.RunAsync(BuildContext.Default));

            var productBuildTargets = new List <string>();

            bool addSignTarget = false;

            if (!CertPass.IsEmpty() && File.Exists(CertFile))
            {
                // Let's try value as file name first, then as env var
                var password = CertPass;

                try
                { password = await File.ReadAllTextAsync(CertPass); }
                catch
                { password = Environment.GetEnvironmentVariable(password); }

                if (!password.IsEmpty())
                {
                    CertPass      = password;
                    addSignTarget = true;
                }
            }

            foreach (var target in Targets)
            {
                var ctx = new BuildContext();
                ctx.SetCommand(this);

                bt.Add(
                    FindPackageTarget.NameWith(target),
                    async() => await FindPackageTarget.RunAsync(ctx, target));

                bt.Add(
                    FetchPackageTarget.NameWith(target),
                    Bullseye.Targets.DependsOn(FindPackageTarget.NameWith(target)),
                    async() => await FetchPackageTarget.RunAsync(ctx));

                bt.Add(
                    UnpackPackageTarget.NameWith(target),
                    Bullseye.Targets.DependsOn(FetchPackageTarget.NameWith(target)),
                    async() => await UnpackPackageTarget.RunAsync(ctx));

                // sign individual binaries
                if (addSignTarget)
                {
                    ctx.SetCertificate(CertFile, CertPass);
                }

                if (addSignTarget)
                {
                    bt.Add(
                        SignProductBinariesTarget.NameWith(target),
                        Bullseye.Targets.DependsOn(UnpackPackageTarget.NameWith(target)),
                        async() => await SignProductBinariesTarget.RunAsync(ctx));
                }
                else
                {
                    bt.Add(
                        SignProductBinariesTarget.NameWith(target),
                        Bullseye.Targets.DependsOn(UnpackPackageTarget.NameWith(target)),
                        () => Console.WriteLine("Skipping digital signature for product binaries"));
                }

                bt.Add(
                    CompileMsiTarget.NameWith(target),
                    Bullseye.Targets.DependsOn(
                        BuildBeatPackageCompilerTarget.Name,
                        SignProductBinariesTarget.NameWith(target)),
                    async() => await CompileMsiTarget.RunAsync(ctx));

                // sign final .msi
                if (addSignTarget)
                {
                    bt.Add(
                        SignMsiPackageTarget.NameWith(target),
                        Bullseye.Targets.DependsOn(CompileMsiTarget.NameWith(target)),
                        async() => await SignMsiPackageTarget.RunAsync(ctx));
                }
                else
                {
                    bt.Add(
                        SignMsiPackageTarget.NameWith(target),
                        Bullseye.Targets.DependsOn(CompileMsiTarget.NameWith(target)),
                        () => Console.WriteLine("Skipping digital signature for MSI package"));
                }

                bt.Add(
                    BuildInstallerTarget.NameWith(target),
                    Bullseye.Targets.DependsOn(SignMsiPackageTarget.NameWith(target)),
                    async() => await BuildInstallerTarget.RunAsync(ctx));

                productBuildTargets.Add(BuildInstallerTarget.NameWith(target));
            }

            try
            {
                await bt.RunWithoutExitingAsync(productBuildTargets);
            }
            catch
            {
                // We swallow exceptions here, BullsEye prints them
                // TODO: use overload "messageOnly"
            }
        }