Skip to content

Commit 9be0054

Browse files
committed
re-structured TFS task
1 parent fd0c83a commit 9be0054

File tree

16 files changed

+31
-80
lines changed

16 files changed

+31
-80
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ releaseArtifacts
121121
.cake
122122
artifacts
123123
/src/Docker/**/content
124-
/src/GitVersionTfsTask/lib
125-
/src/GitVersionTfsTask/GitVersion.exe
126-
/src/GitVersionTfsTask/LibGit2Sharp.dll.config
124+
/src/GitVersionTfsTask/scripts
127125
/src/GitVersionTfsTask/*.vsix
128126
/src/GitVersionRubyGem/*.gem
129127
/src/GitVersionRubyGem/bin/lib

build/paths.cake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ public class BuildPaths
3636

3737
var zipArtifactPathCoreClr = artifactsDir.CombineWithFilePath("GitVersion-bin-coreclr-v" + semVersion + ".zip");
3838
var zipArtifactPathDesktop = artifactsDir.CombineWithFilePath("GitVersion-bin-net40-v" + semVersion + ".zip");
39-
4039
var testCoverageOutputFilePath = buildArtifactDir.CombineWithFilePath("TestResult.xml");
4140
var releaseNotesOutputFilePath = buildArtifactDir.CombineWithFilePath("releasenotes.md");
42-
var vsixOutputFilePath = buildArtifactDir.CombineWithFilePath("gittools.gitversion-" + semVersion + ".vsix");
41+
42+
var vsixVersion = version.DotNetVersion;
43+
var vsixOutputFilePath = buildArtifactDir.CombineWithFilePath("gittools.gitversion-" + vsixVersion + ".vsix");
4344

4445
var gemVersion = version.SemVersion.Replace("-", ".pre.");
4546
var gemOutputFilePath = buildArtifactDir.CombineWithFilePath("gitversion-" + gemVersion + ".gem");

build/version.cake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ public class BuildVersion
44
public string SemVersion { get; private set; }
55
public string NuGetVersion { get; private set; }
66
public string DotNetAsterix { get; private set; }
7+
public string DotNetVersion { get; private set; }
78
public string PreReleaseTag { get; private set; }
89

910
public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
1011
{
1112
var version = gitVersion.MajorMinorPatch;
1213
var preReleaseTag = gitVersion.PreReleaseTag;
1314
var semVersion = gitVersion.LegacySemVerPadded;
15+
var dotnetVersion = version;
1416

1517
if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaDataPadded)) {
1618
semVersion += "." + gitVersion.BuildMetaDataPadded;
19+
dotnetVersion += "." + gitVersion.BuildMetaDataPadded;
1720
}
1821

1922
return new BuildVersion
@@ -22,6 +25,7 @@ public class BuildVersion
2225
SemVersion = semVersion,
2326
NuGetVersion = gitVersion.NuGetVersion,
2427
DotNetAsterix = semVersion.Substring(version.Length).TrimStart('-'),
28+
DotNetVersion = dotnetVersion,
2529
PreReleaseTag = preReleaseTag
2630
};
2731
}

run.cake

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ Task("Clean")
117117

118118
CleanDirectories("./src/**/bin/" + parameters.Configuration);
119119
CleanDirectories("./src/**/obj");
120+
CleanDirectories("./src/GitVersionTfsTask/scripts/**");
120121

122+
DeleteFiles("src/GitVersionTfsTask/*.vsix");
121123
DeleteFiles("src/GitVersionRubyGem/*.gem");
122124

123125
CleanDirectories(parameters.Paths.Directories.ToClean);
@@ -231,13 +233,15 @@ Task("Copy-Files")
231233
PublishILRepackedGitVersionExe(false, parameters.Paths.Directories.ArtifactsBinFullFx, ilMergDir, cmdlineDir, parameters.Configuration, dotnetVersion);
232234

233235
// Vsix
234-
var tfsPath = new DirectoryPath("./src/GitVersionTfsTask");
236+
var tfsPath = new DirectoryPath("./src/GitVersionTfsTask/scripts");
237+
EnsureDirectoryExists(tfsPath);
235238
CopyFileToDirectory(portableDir + "/" + "LibGit2Sharp.dll.config", tfsPath);
236239
CopyFileToDirectory(portableDir + "/" + "GitVersion.exe", tfsPath);
237240
CopyDirectory(portableDir.Combine("lib"), tfsPath.Combine("lib"));
238241

239242
// Ruby Gem
240243
var gemPath = new DirectoryPath("./src/GitVersionRubyGem/bin");
244+
EnsureDirectoryExists(gemPath);
241245
CopyFileToDirectory(portableDir + "/" + "LibGit2Sharp.dll.config", gemPath);
242246
CopyFileToDirectory(portableDir + "/" + "GitVersion.exe", gemPath);
243247
CopyDirectory(portableDir.Combine("lib"), gemPath.Combine("lib"));
@@ -250,13 +254,14 @@ Task("Pack-Tfs")
250254
var workDir = "./src/GitVersionTfsTask";
251255

252256
// update version number
253-
ReplaceTextInFile(new FilePath(workDir + "/manifest.json"), "$version$", parameters.Version.SemVersion);
257+
ReplaceTextInFile(new FilePath(workDir + "/vss-extension.json"), "$version$", parameters.Version.DotNetVersion);
254258

255-
var taskJson = ParseJsonFromFile(workDir + "/task.json");
259+
var taskJsonFile = new FilePath(workDir + "/GitVersionTask/task.json");
260+
var taskJson = ParseJsonFromFile(taskJsonFile);
256261
taskJson["version"]["Major"] = gitVersion.Major.ToString();
257262
taskJson["version"]["Minor"] = gitVersion.Minor.ToString();
258263
taskJson["version"]["Patch"] = gitVersion.Patch.ToString();
259-
SerializeJsonToPrettyFile(workDir + "/task.json", taskJson);
264+
SerializeJsonToPrettyFile(taskJsonFile, taskJson);
260265

261266
// build and pack
262267
NpmSet("progress", "false");
@@ -267,7 +272,7 @@ Task("Pack-Tfs")
267272
{
268273
ToolPath = workDir + "/node_modules/.bin/" + (parameters.IsRunningOnWindows ? "tfx.cmd" : "tfx"),
269274
WorkingDirectory = workDir,
270-
ManifestGlobs = new List<string>(){ "manifest.json" },
275+
ManifestGlobs = new List<string>(){ "vss-extension.json" },
271276
OutputPath = parameters.Paths.Directories.BuildArtifact
272277
});
273278
});
@@ -467,8 +472,6 @@ Task("Publish-Tfs")
467472
.IsDependentOn("Pack-Tfs")
468473
.Does(() =>
469474
{
470-
Information("Publish-Tfs");
471-
return;
472475
var token = parameters.Credentials.Tfx.Token;
473476
if(string.IsNullOrEmpty(token)) {
474477
throw new InvalidOperationException("Could not resolve Tfx token.");

src/Docker/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
There are 4 variants of docker image :
1+
# There are 4 variants of docker image :
22

33
- based on **microsoft/dotnet-framework:4.7.2-runtime** - Windows Full FX
44
- based on **microsoft/dotnet:2.1-runtime** - Windows dotnet core

src/GitVersionTfsTask/BuildTs.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/GitVersionTfsTask/Create-Vsix.ps1

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/GitVersionTfsTask/Update-GitVersionTfsTaskVersion.ps1

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/GitVersionTfsTask/icon.png

-1.16 KB
Binary file not shown.

0 commit comments

Comments
 (0)