Clean up PublishTargets

This commit is contained in:
Bryan Thornbury 2016-03-22 18:31:16 -07:00
parent 34ca32ebaf
commit dfd4d0b954

View file

@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target( [Target(
nameof(PublishTargets.PublishVersionBadge), nameof(PublishTargets.PublishVersionBadge),
nameof(PublishTargets.PublishSdkInstallerFile), nameof(PublishTargets.PublishCombinedFrameworkSDKHostInstallerFile),
nameof(PublishTargets.PublishDebFilesToDebianRepo), nameof(PublishTargets.PublishDebFilesToDebianRepo),
nameof(PublishTargets.PublishCombinedFrameworkSDKHostFile), nameof(PublishTargets.PublishCombinedFrameworkSDKHostFile),
nameof(PublishTargets.PublishCombinedFrameworkHostFile), nameof(PublishTargets.PublishCombinedFrameworkHostFile),
@ -69,8 +69,8 @@ namespace Microsoft.DotNet.Cli.Build
} }
[Target] [Target]
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]//, BuildPlatform.Ubuntu)] [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]
public static BuildTargetResult PublishSdkInstallerFile(BuildTargetContext c) public static BuildTargetResult PublishCombinedFrameworkSDKHostInstallerFile(BuildTargetContext c)
{ {
var installerFile = c.BuildContext.Get<string>("CombinedFrameworkSDKHostInstallerFile"); var installerFile = c.BuildContext.Get<string>("CombinedFrameworkSDKHostInstallerFile");
var installerFileBlob = $"{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}"; var installerFileBlob = $"{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}";
@ -109,12 +109,8 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var packageName = Monikers.GetSdkDebianPackageName(c); var packageName = Monikers.GetSdkDebianPackageName(c);
var installerFile = c.BuildContext.Get<string>("SdkInstallerFile"); var installerFile = c.BuildContext.Get<string>("SdkInstallerFile");
var uploadUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}";
var uploadJson = GenerateUploadJsonFile(packageName, Version, uploadUrl);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "publish", "repoapi_client.sh"), "-addpkg", uploadJson) PublishDebFileToDebianRepo(packageName, installerFile);
.Execute()
.EnsureSuccessful();
return c.Success(); return c.Success();
} }
@ -125,12 +121,8 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var packageName = Monikers.GetDebianSharedFrameworkPackageName(c); var packageName = Monikers.GetDebianSharedFrameworkPackageName(c);
var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile"); var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
var uploadUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}";
var uploadJson = GenerateUploadJsonFile(packageName, Version, uploadUrl); PublishDebFileToDebianRepo(packageName, installerFile);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "publish", "repoapi_client.sh"), "-addpkg", uploadJson)
.Execute()
.EnsureSuccessful();
return c.Success(); return c.Success();
} }
@ -141,12 +133,8 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var packageName = Monikers.GetDebianSharedHostPackageName(c); var packageName = Monikers.GetDebianSharedHostPackageName(c);
var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile"); var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
var uploadUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}";
var uploadJson = GenerateUploadJsonFile(packageName, Version, uploadUrl);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "publish", "repoapi_client.sh"), "-addpkg", uploadJson) PublishDebFileToDebianRepo(packageName, installerFile);
.Execute()
.EnsureSuccessful();
return c.Success(); return c.Success();
} }
@ -249,6 +237,16 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
private static void PublishDebFileToDebianRepo(string packageName, string installerFile)
{
var uploadUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}";
var uploadJson = GenerateUploadJsonFile(packageName, Version, uploadUrl);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "publish", "repoapi_client.sh"), "-addpkg", uploadJson)
.Execute()
.EnsureSuccessful();
}
private static void PublishFileAzure(string blob, string file) private static void PublishFileAzure(string blob, string file)
{ {
CloudBlockBlob blockBlob = BlobContainer.GetBlockBlobReference(blob); CloudBlockBlob blockBlob = BlobContainer.GetBlockBlobReference(blob);