Exemple #1
0
        public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c)
        {
            var packageName      = Monikers.GetDebianSharedHostPackageName(c);
            var version          = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();
            var inputRoot        = c.BuildContext.Get <string>("SharedHostPublishRoot");
            var debFile          = c.BuildContext.Get <string>("SharedHostInstallerFile");
            var manPagesDir      = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
            var debianConfigFile = Path.Combine(Dirs.DebPackagingConfig, "dotnet-sharedhost-debian_config.json");

            var debianConfigVariables = new Dictionary <string, string>()
            {
                { "SHARED_HOST_BRAND_NAME", Monikers.SharedHostBrandName }
            };

            var debCreator = new DebPackageCreator(
                DotNetCli.Stage0,
                Dirs.Intermediate,
                dotnetDebToolPackageSource: Dirs.Packages);

            debCreator.CreateDeb(
                debianConfigFile,
                packageName,
                version,
                inputRoot,
                debianConfigVariables,
                debFile,
                manPagesDir);

            return(c.Success());
        }
Exemple #2
0
        public static BuildTargetResult RemovePackages(BuildTargetContext c)
        {
            // Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
            // So we need to skip this target if the tools aren't present.
            // https://github.com/dotnet/core-setup/issues/167
            if (DebuildNotPresent())
            {
                c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
                return(c.Success());
            }

            var sharedFrameworkNugetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var hostFxrVersion = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostFxrVersion.ToString();

            IEnumerable <string> orderedPackageNames = new List <string>()
            {
                Monikers.GetDebianSharedFrameworkPackageName(sharedFrameworkNugetVersion),
                Monikers.GetDebianHostFxrPackageName(hostFxrVersion),
                Monikers.GetDebianSharedHostPackageName(c)
            };

            foreach (var packageName in orderedPackageNames)
            {
                RemovePackage(packageName);
            }

            return(c.Success());
        }
Exemple #3
0
        public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c)
        {
            var packageName       = Monikers.GetDebianSharedFrameworkPackageName(c);
            var sharedHostVersion = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion;
            var version           = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var inputRoot         = c.BuildContext.Get <string>("SharedFrameworkPublishRoot");
            var debFile           = c.BuildContext.Get <string>("SharedFrameworkInstallerFile");
            var objRoot           = Path.Combine(Dirs.Output, "obj", "debian", "sharedframework");

            if (Directory.Exists(objRoot))
            {
                Directory.Delete(objRoot, true);
            }

            Directory.CreateDirectory(objRoot);

            Cmd(Path.Combine(Dirs.RepoRoot, "packaging", "deb-package", "sharedframework", "package-sharedframework-debian.sh"),
                "--input", inputRoot, "--output", debFile, "--package-name", packageName, "-b", Monikers.SharedFxBrandName,
                "--shared-host-version", sharedHostVersion,
                "--framework-nuget-name", Monikers.SharedFrameworkName,
                "--framework-nuget-version", c.BuildContext.Get <string>("SharedFrameworkNugetVersion"),
                "--obj-root", objRoot, "--version", version)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #4
0
        public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c)
        {
            var sharedFrameworkNugetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var packageName       = Monikers.GetDebianSharedFrameworkPackageName(sharedFrameworkNugetVersion);
            var sharedHostVersion = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();
            var version           = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var inputRoot         = c.BuildContext.Get <string>("SharedFrameworkPublishRoot");
            var debFile           = c.BuildContext.Get <string>("SharedFrameworkInstallerFile");
            var debianConfigFile  = Path.Combine(Dirs.DebPackagingConfig, "dotnet-sharedframework-debian_config.json");

            var debianConfigVariables = new Dictionary <string, string>()
            {
                { "SHARED_HOST_DEBIAN_VERSION", sharedHostVersion },
                { "SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME", packageName },
                { "SHARED_FRAMEWORK_NUGET_NAME", Monikers.SharedFrameworkName },
                { "SHARED_FRAMEWORK_NUGET_VERSION", c.BuildContext.Get <string>("SharedFrameworkNugetVersion") },
                { "SHARED_FRAMEWORK_BRAND_NAME", Monikers.SharedFxBrandName }
            };

            var debCreator = new DebPackageCreator(
                DotNetCli.Stage0,
                Dirs.Intermediate,
                dotnetDebToolPackageSource: Dirs.Packages);

            debCreator.CreateDeb(
                debianConfigFile,
                packageName,
                version,
                inputRoot,
                debianConfigVariables,
                debFile);

            return(c.Success());
        }
Exemple #5
0
 public bool Equals(TargetFrameworks other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Monikers?.SequenceEqual(other.Monikers) == true && Frameworks?.SequenceEqual(other.Frameworks) == true);
 }
        private static void AddInstallerArtifactToContext(
            BuildTargetContext c,
            string artifactPrefix,
            string contextPrefix,
            string version)
        {
            var  productName  = Monikers.GetProductMoniker(c, artifactPrefix, version);
            bool linkPortable = c.BuildContext.Get <bool>("LinkPortable");

            if (linkPortable)
            {
                // If we are building portable binaries, then reflect the same in the installer binary name as well.
                productName = productName + "-portable";
            }

            var extension = CurrentPlatform.IsWindows ? ".zip" : ".tar.gz";

            c.BuildContext[contextPrefix + "CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension);

            string installer = "";

            switch (CurrentPlatform.Current)
            {
            case BuildPlatform.Windows:
                if (contextPrefix.Contains("Combined"))
                {
                    installer = productName + ".exe";
                }
                else
                {
                    installer = productName + ".msi";
                }
                break;

            case BuildPlatform.OSX:
                installer = productName + ".pkg";
                break;

            case BuildPlatform.Ubuntu:
            case BuildPlatform.Debian:
                installer = productName + ".deb";
                break;

            default:
                break;
            }

            if (!string.IsNullOrEmpty(installer))
            {
                c.BuildContext[contextPrefix + "InstallerFile"] = Path.Combine(Dirs.Packages, installer);
            }
        }
Exemple #7
0
        public static BuildTargetResult GenerateSharedFxBundle(BuildTargetContext c)
        {
            var sharedFrameworkNuGetName    = Monikers.SharedFrameworkName;
            var sharedFrameworkNuGetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var upgradeCode       = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper();
            var sharedFxBrandName = $"'{Monikers.GetSharedFxBrandName(c)}'";

            Cmd("powershell", "-NoProfile", "-NoLogo",
                Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"),
                SharedFrameworkMsi, SharedHostMsi, HostFxrMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, DisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, TargetArch, MSIBuildArch)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #8
0
        private static bool CheckIfAllBuildsHavePublished()
        {
            Dictionary <string, bool> badges = new Dictionary <string, bool>()
            {
                { "sharedfx_Windows_x86", false },
                { "sharedfx_Windows_x64", false },
                { "sharedfx_Ubuntu_x64", false },
                { "sharedfx_Ubuntu_16_04_x64", false },
                { "sharedfx_Ubuntu_16_10_x64", false },
                { "sharedfx_RHEL_x64", false },
                { "sharedfx_OSX_x64", false },
                { "sharedfx_Debian_x64", false },
                { "sharedfx_CentOS_x64", false },
                { "sharedfx_Fedora_23_x64", false },
                { "sharedfx_openSUSE_13_2_x64", false },
                { "sharedfx_openSUSE_42_1_x64", false }
            };

            List <string> blobs = new List <string>(AzurePublisherTool.ListBlobs($"{Channel}/Binaries/{SharedFrameworkNugetVersion}/"));

            var versionBadgeName = $"sharedfx_{Monikers.GetBadgeMoniker()}";

            if (badges.ContainsKey(versionBadgeName) == false)
            {
                throw new ArgumentException($"A new OS build ({versionBadgeName}) was added without adding the moniker to the {nameof(badges)} lookup");
            }

            foreach (string file in blobs)
            {
                string name = Path.GetFileName(file);
                string key  = string.Empty;

                foreach (string img in badges.Keys)
                {
                    if ((name.StartsWith($"{img}")) && (name.EndsWith(".svg")))
                    {
                        key = img;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(key) == false)
                {
                    badges[key] = true;
                }
            }

            return(badges.Keys.All(key => badges[key]));
        }
Exemple #9
0
        public static BuildTargetResult RemovePackages(BuildTargetContext c)
        {
            IEnumerable <string> orderedPackageNames = new List <string>()
            {
                Monikers.GetDebianSharedFrameworkPackageName(c),
                Monikers.GetDebianSharedHostPackageName(c)
            };

            foreach (var packageName in orderedPackageNames)
            {
                RemovePackage(packageName);
            }

            return(c.Success());
        }
Exemple #10
0
        public static BuildTargetResult PublishSharedHostDebToDebianRepo(BuildTargetContext c)
        {
            var version = SharedHostNugetVersion;

            var packageName   = Monikers.GetDebianSharedHostPackageName(c);
            var installerFile = c.BuildContext.Get <string>("SharedHostInstallerFile");
            var uploadUrl     = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version);

            DebRepoPublisherTool.PublishDebFileToDebianRepo(
                packageName,
                version,
                uploadUrl);

            return(c.Success());
        }
Exemple #11
0
        public static BuildTargetResult ExpectedBuildArtifacts(BuildTargetContext c)
        {
            var config           = Environment.GetEnvironmentVariable("CONFIGURATION");
            var versionBadgeName = $"sharedfx_{Monikers.GetBadgeMoniker()}_{config}_version_badge.svg";

            c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);

            var sharedFrameworkVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var hostVersion            = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();

            AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
            AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
            AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion);

            return(c.Success());
        }
Exemple #12
0
        public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c)
        {
            // Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
            // So we need to skip this target if the tools aren't present.
            // https://github.com/dotnet/core-setup/issues/167
            if (DebuildNotPresent())
            {
                c.Info("Debuild not present, skipping target: {nameof(GenerateSharedFrameworkDeb)}");
                return(c.Success());
            }

            var sharedFrameworkNugetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var packageName              = Monikers.GetDebianSharedFrameworkPackageName(sharedFrameworkNugetVersion);
            var sharedHostVersion        = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();
            var hostFxrVersion           = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostFxrVersion.ToString();
            var hostfxrDebianPackageName = Monikers.GetDebianHostFxrPackageName(hostFxrVersion);
            var version          = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var inputRoot        = c.BuildContext.Get <string>("SharedFrameworkPublishRoot");
            var debFile          = c.BuildContext.Get <string>("SharedFrameworkInstallerFile");
            var debianConfigFile = Path.Combine(Dirs.DebPackagingConfig, "dotnet-sharedframework-debian_config.json");

            var debianConfigVariables = new Dictionary <string, string>()
            {
                { "SHARED_HOST_DEBIAN_VERSION", sharedHostVersion },
                { "HOSTFXR_DEBIAN_PACKAGE_NAME", hostfxrDebianPackageName },
                { "HOSTFXR_DEBIAN_VERSION", hostFxrVersion },
                { "SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME", packageName },
                { "SHARED_FRAMEWORK_NUGET_NAME", Monikers.SharedFrameworkName },
                { "SHARED_FRAMEWORK_NUGET_VERSION", c.BuildContext.Get <string>("SharedFrameworkNugetVersion") },
                { "SHARED_FRAMEWORK_BRAND_NAME", Monikers.GetSharedFxBrandName(c) }
            };

            var debCreator = new DebPackageCreator(
                DotNetCli.Stage0,
                Dirs.Intermediate,
                dotnetDebToolPackageSource: Dirs.Packages);

            debCreator.CreateDeb(
                debianConfigFile,
                packageName,
                version,
                inputRoot,
                debianConfigVariables,
                debFile);

            return(c.Success());
        }
Exemple #13
0
        private static void AddInstallerArtifactToContext(
            BuildTargetContext c,
            string artifactPrefix,
            string contextPrefix,
            string version)
        {
            var productName = Monikers.GetProductMoniker(c, artifactPrefix, version);

            var extension = CurrentPlatform.IsWindows ? ".zip" : ".tar.gz";

            c.BuildContext[contextPrefix + "CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension);

            string installer = "";

            switch (CurrentPlatform.Current)
            {
            case BuildPlatform.Windows:
                if (contextPrefix.Contains("Combined"))
                {
                    installer = productName + ".exe";
                }
                else
                {
                    installer = productName + ".msi";
                }
                break;

            case BuildPlatform.OSX:
                installer = productName + ".pkg";
                break;

            case BuildPlatform.Ubuntu:
            case BuildPlatform.Debian:
                installer = productName + ".deb";
                break;

            default:
                break;
            }

            if (!string.IsNullOrEmpty(installer))
            {
                c.BuildContext[contextPrefix + "InstallerFile"] = Path.Combine(Dirs.Packages, installer);
            }
        }
Exemple #14
0
        public static BuildTargetResult ExpectedBuildArtifacts(BuildTargetContext c)
        {
            var config           = c.BuildContext.Get <string>("Configuration");
            var versionBadgeName = $"sharedfx_{Monikers.GetBadgeMoniker(c)}_{config}_version_badge.svg";

            c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);

            var sharedFrameworkVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var hostVersion            = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();
            var hostFxrVersion         = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostFxrVersion.ToString();

            AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
            AddInstallerArtifactToContext(c, "dotnet-hostfxr", "HostFxr", hostFxrVersion);
            AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
            AddInstallerArtifactToContext(c, "dotnet-sharedframework-symbols", "SharedFrameworkSymbols", sharedFrameworkVersion);
            AddInstallerArtifactToContext(c, "dotnet", "CombinedMuxerHostFxrFramework", sharedFrameworkVersion);

            return(c.Success());
        }
Exemple #15
0
        public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c)
        {
            // Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
            // So we need to skip this target if the tools aren't present.
            // https://github.com/dotnet/core-setup/issues/167
            if (DebuildNotPresent())
            {
                c.Info("Debuild not present, skipping target: {nameof(GenerateSharedHostDeb)}");
                return(c.Success());
            }

            var packageName      = Monikers.GetDebianSharedHostPackageName(c);
            var version          = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion.ToString();
            var inputRoot        = c.BuildContext.Get <string>("SharedHostPublishRoot");
            var debFile          = c.BuildContext.Get <string>("SharedHostInstallerFile");
            var manPagesDir      = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
            var debianConfigFile = Path.Combine(Dirs.DebPackagingConfig, "dotnet-sharedhost-debian_config.json");

            var debianConfigVariables = new Dictionary <string, string>()
            {
                { "SHARED_HOST_BRAND_NAME", Monikers.GetSharedHostBrandName(c) }
            };

            var debCreator = new DebPackageCreator(
                DotNetCli.Stage0,
                Dirs.Intermediate,
                dotnetDebToolPackageSource: Dirs.Packages);

            debCreator.CreateDeb(
                debianConfigFile,
                packageName,
                version,
                inputRoot,
                debianConfigVariables,
                debFile,
                manPagesDir);

            return(c.Success());
        }
Exemple #16
0
        public static BuildTargetResult GenerateDotnetHostFxrMsi(BuildTargetContext c)
        {
            var hostVersion         = c.BuildContext.Get <HostVersion>("HostVersion");
            var hostFxrMsiVersion   = hostVersion.LockedHostFxrVersion.GenerateMsiVersion();
            var hostFxrNugetVersion = hostVersion.LockedHostFxrVersion.ToString();
            var inputDir            = c.BuildContext.Get <string>("HostFxrPublishRoot");
            var wixObjRoot          = Path.Combine(Dirs.Output, "obj", "wix", "hostfxr");
            var hostFxrBrandName    = $"'{Monikers.GetHostFxrBrandName(c)}'";

            if (Directory.Exists(wixObjRoot))
            {
                Utils.DeleteDirectory(wixObjRoot);
            }
            Directory.CreateDirectory(wixObjRoot);

            Cmd("powershell", "-NoProfile", "-NoLogo",
                Path.Combine(Dirs.RepoRoot, "packaging", "windows", "hostfxr", "generatemsi.ps1"),
                inputDir, HostFxrMsi, WixRoot, hostFxrBrandName, hostFxrMsiVersion, hostFxrNugetVersion, Arch, wixObjRoot)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #17
0
        public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c)
        {
            var packageName = Monikers.GetDebianSharedHostPackageName(c);
            var version     = c.BuildContext.Get <HostVersion>("HostVersion").LockedHostVersion;
            var inputRoot   = c.BuildContext.Get <string>("SharedHostPublishRoot");
            var debFile     = c.BuildContext.Get <string>("SharedHostInstallerFile");
            var objRoot     = Path.Combine(Dirs.Output, "obj", "debian", "sharedhost");
            var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");

            if (Directory.Exists(objRoot))
            {
                Directory.Delete(objRoot, true);
            }

            Directory.CreateDirectory(objRoot);

            Cmd(Path.Combine(Dirs.RepoRoot, "packaging", "deb-package", "host", "package-sharedhost-debian.sh"),
                "--input", inputRoot, "--output", debFile, "-b", Monikers.SharedHostBrandName,
                "--obj-root", objRoot, "--version", version, "-m", manPagesDir)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #18
0
        public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c)
        {
            var hostVersion         = c.BuildContext.Get <HostVersion>("HostVersion");
            var hostMsiVersion      = hostVersion.LockedHostVersion.GenerateMsiVersion();
            var hostNugetVersion    = hostVersion.LockedHostVersion.ToString();
            var inputDir            = c.BuildContext.Get <string>("SharedHostPublishRoot");
            var wixObjRoot          = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost");
            var sharedHostBrandName = $"'{Monikers.GetSharedHostBrandName(c)}'";
            var upgradeCode         = Utils.GenerateGuidFromName(SharedHostMsi).ToString().ToUpper();

            if (Directory.Exists(wixObjRoot))
            {
                Utils.DeleteDirectory(wixObjRoot);
            }
            Directory.CreateDirectory(wixObjRoot);

            Cmd("powershell", "-NoProfile", "-NoLogo",
                Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"),
                inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, MSIBuildArch, TargetArch, wixObjRoot, upgradeCode)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #19
0
        public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
        {
            var inputDir = c.BuildContext.Get <string>("SharedFrameworkPublishRoot");
            var sharedFrameworkNuGetName    = Monikers.SharedFrameworkName;
            var sharedFrameworkNuGetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion");
            var msiVerison        = sharedFrameworkNuGetVersion.Split('-')[0];
            var upgradeCode       = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper();
            var wixObjRoot        = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
            var sharedFxBrandName = $"'{Monikers.GetSharedFxBrandName(c)}'";

            if (Directory.Exists(wixObjRoot))
            {
                Utils.DeleteDirectory(wixObjRoot);
            }
            Directory.CreateDirectory(wixObjRoot);

            Cmd("powershell", "-NoProfile", "-NoLogo",
                Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"),
                inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, MSIBuildArch, TargetArch, wixObjRoot)
            .Execute()
            .EnsureSuccessful();
            return(c.Success());
        }
Exemple #20
0
        public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c)
        {
            string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "resources");
            string outFilePath  = Path.Combine(PkgsIntermediateDir, c.BuildContext.Get <string>("CombinedMuxerHostFxrFrameworkInstallerFile"));

            string inputDistTemplatePath = Path.Combine(
                Dirs.RepoRoot,
                "packaging",
                "osx",
                "sharedframework",
                "shared-framework-distribution-template.xml");
            string distTemplate          = File.ReadAllText(inputDistTemplatePath);
            string distributionPath      = Path.Combine(PkgsIntermediateDir, "shared-framework-formatted-distribution.xml");
            string formattedDistContents =
                distTemplate.Replace("{SharedFxComponentId}", SharedFxComponentId)
                .Replace("{SharedHostComponentId}", SharedHostComponentId)
                .Replace("{HostFxrComponentId}", HostFxrComponentId)
                .Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
                .Replace("{SharedFrameworkNugetVersion}", SharedFrameworkNugetVersion)
                .Replace("{SharedFxBrandName}", Monikers.GetSharedFxBrandName(c))
                .Replace("{SharedHostBrandName}", Monikers.GetSharedHostBrandName(c))
                .Replace("{HostFxrBrandName}", Monikers.GetHostFxrBrandName(c));

            File.WriteAllText(distributionPath, formattedDistContents);

            Cmd("productbuild",
                "--version", SharedFrameworkNugetVersion,
                "--identifier", SharedFxPkgId,
                "--package-path", PkgsIntermediateDir,
                "--resources", resourcePath,
                "--distribution", distributionPath,
                outFilePath)
            .Execute()
            .EnsureSuccessful();

            return(c.Success());
        }
Exemple #21
0
        private static bool CheckIfAllBuildsHavePublished()
        {
            Dictionary <string, bool> badges = new Dictionary <string, bool>()
            {
                { "sharedfx_Windows_x86", false },
                { "sharedfx_Windows_x64", false },
                { "sharedfx_Windows_arm", false },
                { "sharedfx_Windows_arm64", false },
                { "sharedfx_Linux_x64", false },
                { "sharedfx_Ubuntu_x64", false },
                // { "sharedfx_Ubuntu_14_04_arm", false },
                { "sharedfx_Ubuntu_16_04_x64", false },
                // { "sharedfx_Ubuntu_16_04_arm", false },
                { "sharedfx_Ubuntu_16_10_x64", false },
                { "sharedfx_RHEL_x64", false },
                { "sharedfx_OSX_x64", false },
                { "sharedfx_Debian_x64", false },
                { "sharedfx_CentOS_x64", false },
                { "sharedfx_Fedora_23_x64", false },
                { "sharedfx_Fedora_24_x64", false },
                { "sharedfx_openSUSE_13_2_x64", false },
                { "sharedfx_openSUSE_42_1_x64", false }
            };

            List <string> blobs = new List <string>(AzurePublisherTool.ListBlobs($"{Channel}/Binaries/{SharedFrameworkNugetVersion}/"));

            var versionBadgeName = $"sharedfx_{Monikers.GetBadgeMoniker()}";

            if (badges.ContainsKey(versionBadgeName) == false)
            {
                throw new ArgumentException($"A new OS build ({versionBadgeName}) was added without adding the moniker to the {nameof(badges)} lookup");
            }

            foreach (string file in blobs)
            {
                string name = Path.GetFileName(file);

                if (!name.EndsWith(".svg"))
                {
                    continue;
                }

                // Include _ delimiter when matching to prevent finding both arm and arm64 badges
                // when checking the arm badge file.
                string[] matchingBadgeKeys = badges.Keys
                                             .Where(badgeName => name.StartsWith($"{badgeName}_"))
                                             .ToArray();

                if (matchingBadgeKeys.Length == 1)
                {
                    badges[matchingBadgeKeys[0]] = true;
                }
                else if (matchingBadgeKeys.Length > 1)
                {
                    throw new BuildFailureException(
                              $"Expected 0 or 1 badges matching file '{name}', " +
                              $"found {matchingBadgeKeys.Length}: " +
                              string.Join(", ", matchingBadgeKeys));
                }
            }

            foreach (string unfinishedBadge in badges.Where(pair => !pair.Value).Select(pair => pair.Key))
            {
                Console.WriteLine($"Not all builds complete, badge not found: {unfinishedBadge}");
            }

            return(badges.Keys.All(key => badges[key]));
        }