diff --git a/.travis.yml b/.travis.yml index a4d492d..e319bee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,5 @@ services: script: - export PATH="$PATH:$HOME/.dotnet/tools" - - dotnet tool install --global FlubuCore.GlobalTool --version 4.3.5 - - flubu build tests -s=build/BuildScript.cs \ No newline at end of file + - dotnet tool install --global FlubuCore.GlobalTool --version 4.3.7 + - flubu build tests \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index e7e3d0b..4df4474 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ environment: services: - mysql before_build: - - ps: dotnet tool install --global FlubuCore.GlobalTool --version 4.3.5 + - ps: dotnet tool install --global FlubuCore.GlobalTool --version 4.3.7 build_script: - ps: flubu test: off diff --git a/build/BuildScript.Version.cs b/build/BuildScript.Version.cs index 6a993f7..aed224f 100644 --- a/build/BuildScript.Version.cs +++ b/build/BuildScript.Version.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Xml; using FlubuCore.Context; using FlubuCore.Scripting.Attributes; @@ -10,7 +11,7 @@ namespace BuildScript { public BuildVersion FetchBuildVersion(ITaskContext context) { - var content = System.IO.File.ReadAllText("./build/version.props"); + var content = System.IO.File.ReadAllText(RootDirectory.CombineWith("build/version.props")); XmlDocument doc = new XmlDocument(); doc.LoadXml(content); @@ -28,22 +29,20 @@ namespace BuildScript if (!context.BuildSystems().IsLocalBuild) { isCi = true; - //// todo use flubu build system when available. - var appveyortag = context.GetEnvironmentVariable("APPVEYOR_REPO_TAG"); - bool isTagAppveyor = !string.IsNullOrEmpty(appveyortag) && appveyortag.Equals("true", StringComparison.OrdinalIgnoreCase); + bool isTagAppveyor = context.BuildSystems().AppVeyor().IsTag; - if ((context.BuildSystems().RunningOn == BuildSystemType.AppVeyor && isTagAppveyor) || - (context.BuildSystems().RunningOn == BuildSystemType.TravisCI && string.IsNullOrWhiteSpace(context.BuildSystems().Travis().TagName))) + if (context.BuildSystems().RunningOn == BuildSystemType.AppVeyor && isTagAppveyor || + context.BuildSystems().RunningOn == BuildSystemType.TravisCI && string.IsNullOrWhiteSpace(context.BuildSystems().Travis().TagName)) { isTagged = true; } } - if (!isTagged) { suffix += (isCi ? "preview-" : "dv-") + CreateStamp(); } + suffix = string.IsNullOrWhiteSpace(suffix) ? null : suffix; var version = new BuildVersion(int.Parse(versionMajor), int.Parse(versionMinor), int.Parse(versionPatch), versionQuality); diff --git a/build/BuildScript.cs b/build/BuildScript.cs index 241d57f..be7f0fa 100644 --- a/build/BuildScript.cs +++ b/build/BuildScript.cs @@ -9,7 +9,7 @@ namespace BuildScript [Include("./build/BuildVersion.cs")] public partial class BuildScript : DefaultBuildScript { - private const string ArtifactsDir = "./artifacts"; + protected string ArtifactsDir => RootDirectory.CombineWith("artifacts"); [FromArg("c|configuration")] public string Configuration { get; set; } @@ -29,27 +29,30 @@ namespace BuildScript protected override void BeforeBuildExecution(ITaskContext context) { BuildVersion = FetchBuildVersion(context); - TestProjectFiles = context.GetFiles("./test", "*/*.csproj"); - ProjectFiles = context.GetFiles("./src", "*/*.csproj"); + TestProjectFiles = context.GetFiles(RootDirectory.CombineWith("test"), "*/*.csproj"); + ProjectFiles = context.GetFiles(RootDirectory.CombineWith("src"), "*/*.csproj"); } protected override void ConfigureTargets(ITaskContext context) { var clean = context.CreateTarget("Clean") - .SetDescription("") + .SetDescription("Cleans the output of all projects in the solution.") .AddCoreTask(x => x.Clean() .AddDirectoryToClean(ArtifactsDir, true)); var restore = context.CreateTarget("Restore") + .SetDescription("Restores the dependencies and tools of all projects in the solution.") .DependsOn(clean) .AddCoreTask(x => x.Restore()); var build = context.CreateTarget("Build") + .SetDescription("Builds all projects in the solution.") .DependsOn(restore) .AddCoreTask(x => x.Build() .InformationalVersion(BuildVersion.VersionWithSuffix())); var tests = context.CreateTarget("Tests") + .SetDescription("Runs all Cap tests.") .ForEach(TestProjectFiles, (projectFile, target) => { @@ -59,17 +62,19 @@ namespace BuildScript }); var pack = context.CreateTarget("Pack") + .SetDescription("Creates nuget packages for Cap.") .ForEach(ProjectFiles, (projectFile, target) => { target.AddCoreTask(x => x.Pack() .NoBuild() .Project(projectFile) .IncludeSymbols() - .When(() => !string.IsNullOrEmpty(BuildVersion.Suffix), t => t.VersionSufix(BuildVersion.Suffix)) + .VersionSuffix(BuildVersion.Suffix) .OutputDirectory(ArtifactsDir)); }); context.CreateTarget("Default") + .SetDescription("Runs all targets.") .SetAsDefault() .DependsOn(clean, restore, build, tests, pack); } diff --git a/build/BuildScript.csproj b/build/BuildScript.csproj index 19041b5..44dc6cc 100644 --- a/build/BuildScript.csproj +++ b/build/BuildScript.csproj @@ -9,7 +9,7 @@ - +