-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates the build script to the MSBuild project format
- Loading branch information
1 parent
959d53b
commit 614c5c0
Showing
3 changed files
with
31 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
public static class Paths | ||
{ | ||
public static string ProjectDirectory => "src/Cake.Curl"; | ||
public static string TestsDirectory => "src/Cake.Curl.Tests"; | ||
public static FilePath SolutionFile => "src/Cake.Curl.sln"; | ||
public static FilePath ProjectFile => "src/Cake.Curl/Cake.Curl.csproj"; | ||
public static FilePath TestProjectFile => "src/Cake.Curl.Tests/Cake.Curl.Tests.csproj"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
#addin nuget:?package=Newtonsoft.Json&version=9.0.1 | ||
|
||
public static string GetVersionFromProjectFile( | ||
DirectoryPath projectDirectory) | ||
ICakeContext context, | ||
FilePath projectFile) | ||
{ | ||
var projectFilePath = projectDirectory.GetFilePath("project.json").FullPath; | ||
var content = System.IO.File.ReadAllText(projectFilePath); | ||
var project = Newtonsoft.Json.Linq.JObject.Parse(content); | ||
|
||
return (string)project["version"]; | ||
return context.XmlPeek( | ||
projectFile, | ||
"/Project/PropertyGroup/Version/text()"); | ||
} | ||
|
||
public static void SetVersionToProjectFile( | ||
string version, | ||
DirectoryPath projectDirectory) | ||
ICakeContext context, | ||
FilePath projectFile, | ||
string version) | ||
{ | ||
var projectFilePath = projectDirectory.GetFilePath("project.json").FullPath; | ||
var content = System.IO.File.ReadAllText(projectFilePath); | ||
var project = Newtonsoft.Json.Linq.JObject.Parse(content); | ||
|
||
project["version"] = version; | ||
System.IO.File.WriteAllText(projectFilePath, project.ToString()); | ||
context.XmlPoke( | ||
projectFile, | ||
"/Project/PropertyGroup/Version", | ||
version); | ||
} |