Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish as .NET Core Global Tool #1

Merged
merged 8 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ build_script:

test: off
skip_tags: true

cache:
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
167 changes: 86 additions & 81 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ Task("Version")
UpdateAssemblyInfo = true,
LogFilePath = "console",
OutputType = GitVersionOutput.BuildServer,
ToolPath = @"src\GitVersionExe\bin\Release\net40\GitVersion.exe"
ToolPath = @"src\GitVersionExe\bin\Release\net461\GitVersion.exe"
});
GitVersion assertedVersions = GitVersion(new GitVersionSettings
{
OutputType = GitVersionOutput.Json,
ToolPath = @"src\GitVersionExe\bin\Release\net40\GitVersion.exe"
ToolPath = @"src\GitVersionExe\bin\Release\net461\GitVersion.exe"
});

version = assertedVersions.MajorMinorPatch;
Expand Down Expand Up @@ -140,12 +140,12 @@ Task("Run-Tests")
.IsDependentOn("DogfoodBuild")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
var settings = new DotNetCoreTestSettings

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of whitespace changes here makes this diff pretty noisy!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I revert the whitespaces I fixed, or keep the changes?

Copy link

@dazinator dazinator Sep 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you, it's easier to review when any "formatting" changes or "beautification" is kept entirely seperate imho, but it's not a blocker from my personal perspective. (Mainly because I am also often guilty of this :-))

{
Configuration = configuration,
NoBuild = true,
Filter = "TestCategory!=NoMono"
};
};

DotNetCoreTest("./src/GitVersionCore.Tests/GitVersionCore.Tests.csproj", settings);
DotNetCoreTest("./src/GitVersionExe.Tests/GitVersionExe.Tests.csproj", settings);
Expand All @@ -155,24 +155,24 @@ Task("Run-Tests")

void ILRepackGitVersionExe(bool includeLibGit2Sharp)
{
var tempMergeDir = "ILMergeTemp";
var exeName = "GitVersion.exe";
var keyFilePath = "./src/key.snk";
var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
var targetPath = targetDir + exeName;

CreateDirectory(tempMergeDir);
string outFilePath = "./" + tempMergeDir + "/" + exeName;

var sourcePattern = targetDir + "*.dll";
var sourceFiles = GetFiles(sourcePattern);
if(!includeLibGit2Sharp)
{
var excludePattern = "**/LibGit2Sharp.dll";
sourceFiles = sourceFiles - GetFiles(excludePattern);
}
var settings = new ILRepackSettings { AllowDup = "", Keyfile = keyFilePath, Internalize = true, NDebug = true, TargetKind = TargetKind.Exe, TargetPlatform = TargetPlatformVersion.v4, XmlDocs = false };
ILRepack(outFilePath, targetPath, sourceFiles, settings);
var tempMergeDir = "ILMergeTemp";
var exeName = "GitVersion.exe";
var keyFilePath = "./src/key.snk";
var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net461/";
var targetPath = targetDir + exeName;

CreateDirectory(tempMergeDir);
string outFilePath = "./" + tempMergeDir + "/" + exeName;

var sourcePattern = targetDir + "*.dll";
var sourceFiles = GetFiles(sourcePattern);
if(!includeLibGit2Sharp)
{
var excludePattern = "**/LibGit2Sharp.dll";
sourceFiles = sourceFiles - GetFiles(excludePattern);
}
var settings = new ILRepackSettings { AllowDup = "", Keyfile = keyFilePath, Internalize = true, NDebug = true, TargetKind = TargetKind.Exe, TargetPlatform = TargetPlatformVersion.v4, XmlDocs = false };
ILRepack(outFilePath, targetPath, sourceFiles, settings);
}


Expand All @@ -191,7 +191,7 @@ Task("Commandline-Package")
CreateDirectory(toolsDir);
CreateDirectory(libDir);

var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net461/";

var libGitFiles = GetFiles(targetDir + "LibGit2Sharp.dll*");
var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
Expand Down Expand Up @@ -227,17 +227,17 @@ Task("Portable-Package")
.Does(() =>
{

ILRepackGitVersionExe(true);
ILRepackGitVersionExe(true);

var outputDir = buildDir + "NuGetExeBuild";
var toolsDir = outputDir + "/tools";
var libDir = toolsDir + "/lib";
var outputDir = buildDir + "NuGetExeBuild";
var toolsDir = outputDir + "/tools";
var libDir = toolsDir + "/lib";

CreateDirectory(outputDir);
CreateDirectory(toolsDir);
CreateDirectory(libDir);
CreateDirectory(outputDir);
CreateDirectory(toolsDir);
CreateDirectory(libDir);

var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net40/";
var targetDir = "./src/GitVersionExe/bin/" + configuration + "/net461/";

var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
Information("Copying files to packaging direcory..");
Expand Down Expand Up @@ -269,21 +269,21 @@ Task("GitVersionCore-Package")
.IsDependentOn("Build")
.Does(() =>
{
var outputDir = buildDir + "NuGetRefBuild";
CreateDirectory(outputDir);
var outputDir = buildDir + "NuGetRefBuild";
CreateDirectory(outputDir);

var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);
msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true,
MSBuildSettings = msBuildSettings
};

DotNetCorePack("./src/GitVersionCore", settings);
var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);
msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true,
MSBuildSettings = msBuildSettings
};

DotNetCorePack("./src/GitVersionCore", settings);
})
.ReportError(exception =>
{
Expand All @@ -298,34 +298,31 @@ Task("GitVersion-DotNet-Package")
// var publishDir = buildDir + "Published";
// CreateDirectory(outputDir);

var outputDir = buildDir + "NuGetExeDotNetCoreBuild";
var toolsDir = outputDir + "/tools";
var libDir = toolsDir + "/lib";

CreateDirectory(outputDir);
CreateDirectory(toolsDir);
CreateDirectory(libDir);


var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);
msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
var outputDir = buildDir + "NuGetExeDotNetCoreBuild";
var toolsDir = outputDir + "/tools";
var libDir = toolsDir + "/lib";

var framework = "netcoreapp20";
CreateDirectory(outputDir);
CreateDirectory(toolsDir);
CreateDirectory(libDir);

var settings = new DotNetCorePublishSettings
{
Framework = framework,
Configuration = configuration,
OutputDirectory = toolsDir,
MSBuildSettings = msBuildSettings
};

DotNetCorePublish("./src/GitVersionExe", settings);
var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);
msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };

var framework = "netcoreapp20";

var settings = new DotNetCorePublishSettings
{
Framework = framework,
Configuration = configuration,
OutputDirectory = toolsDir,
MSBuildSettings = msBuildSettings
};

// var targetDir = "./src/GitVersionExe/bin/" + configuration + "/" + framework + "/";
DotNetCorePublish("./src/GitVersionExe/GitVersionExe.csproj", settings);
// var targetDir = "./src/GitVersionExe/bin/" + configuration + "/" + framework + "/";

var nugetAssetsPath = "./src/GitVersionExe/NugetAssets/";
Information("Copying files to packaging direcory..");
Expand All @@ -338,6 +335,12 @@ Task("GitVersion-DotNet-Package")

var nuGetPackSettings = new NuGetPackSettings { Version = nugetVersion, BasePath = outputDir, OutputDirectory = outputDir };
NuGetPack(outputDir + "/GitVersion.CommandLine.DotNetCore.nuspec", nuGetPackSettings);

DotNetCorePack("./src/GitVersionExe/GitVersion.Tool.csproj", new DotNetCorePackSettings {
Configuration = configuration,
OutputDirectory = outputDir,
MSBuildSettings = msBuildSettings
});
})
.ReportError(exception =>
{
Expand All @@ -350,22 +353,22 @@ Task("GitVersionTaskPackage")
.Does(() =>
{

var outputDir = buildDir + "NuGetTaskBuild";
CreateDirectory(outputDir);
var outputDir = buildDir + "NuGetTaskBuild";
CreateDirectory(outputDir);

var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);
var msBuildSettings = new DotNetCoreMSBuildSettings();
msBuildSettings.SetVersion(nugetVersion);

msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true,
MSBuildSettings = msBuildSettings
};
msBuildSettings.Properties["PackageVersion"] = new string[]{ nugetVersion };
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true,
MSBuildSettings = msBuildSettings
};

DotNetCorePack("./src/GitVersionTask", settings);
DotNetCorePack("./src/GitVersionTask", settings);

})
.ReportError(exception =>
Expand Down Expand Up @@ -445,6 +448,7 @@ Task("Upload-AppVeyor-Artifacts")
"NuGetExeBuild:GitVersion.Portable." + nugetVersion +".nupkg",
"NuGetCommandLineBuild:GitVersion.CommandLine." + nugetVersion +".nupkg",
"NuGetExeDotNetCoreBuild:GitVersion.CommandLine.DotNetCore." + nugetVersion +".nupkg",
"NuGetExeDotNetCoreBuild:GitVersion.CommandLine.DotNetCore.Tool." + nugetVersion +".nupkg",
"NuGetRefBuild:GitVersionCore." + nugetVersion +".nupkg",
"NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg",
"zip:GitVersion_" + nugetVersion + ".zip",
Expand All @@ -456,6 +460,7 @@ Task("Upload-AppVeyor-Artifacts")
AppVeyor.UploadArtifact("build/NuGetExeBuild/GitVersion.Portable." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetCommandLineBuild/GitVersion.CommandLine." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetExeDotNetCoreBuild/GitVersion.CommandLine.DotNetCore." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetExeDotNetCoreBuild/GitVersion.CommandLine.DotNetCore.Tool." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetRefBuild/GitVersionCore." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/NuGetTaskBuild/GitVersionTask." + nugetVersion +".nupkg");
AppVeyor.UploadArtifact("build/GitVersion_" + nugetVersion + ".zip");
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<PackageVersion_GitToolsCore>1.3.1</PackageVersion_GitToolsCore>
<PackageVersion_YamlDotNet>4.2.3</PackageVersion_YamlDotNet>
<PackageVersion_LibGit2SharpNativeBinaries>[1.0.185]</PackageVersion_LibGit2SharpNativeBinaries>
<PackageVersion_LibGit2Sharp>0.26.0-preview-0027</PackageVersion_LibGit2Sharp>
<PackageVersion_LibGit2SharpNativeBinaries>1.0.226</PackageVersion_LibGit2SharpNativeBinaries>
</PropertyGroup>
</Project>
Loading