Browse Source

Improve build script (#467)

* Adds Flubu build script

* Improve build script

* update flubu global tool version

* fix target name
master
Marko Zorec 4 years ago
committed by Savorboard
parent
commit
549bb5ec0a
4 changed files with 17 additions and 14 deletions
  1. +3
    -2
      .travis.yml
  2. +1
    -1
      appveyor.yml
  3. +12
    -9
      build/BuildScript.cs
  4. +1
    -2
      build/BuildScript.csproj

+ 3
- 2
.travis.yml View File

@@ -17,5 +17,6 @@ mono: none
# Run the build script

script:
- dotnet tool install --global FlubuCore.GlobalTool --version 4.2.8
- flubu build test
- export PATH="$PATH:$HOME/.dotnet/tools"
- dotnet tool install --global FlubuCore.GlobalTool --version 4.3.5
- flubu build tests -s=build/BuildScript.cs

+ 1
- 1
appveyor.yml View File

@@ -7,7 +7,7 @@ environment:
services:
- mysql
before_build:
- ps: dotnet tool install --global FlubuCore.GlobalTool --version 4.2.8
- ps: dotnet tool install --global FlubuCore.GlobalTool --version 4.3.5
build_script:
- ps: flubu
test: off


+ 12
- 9
build/BuildScript.cs View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using FlubuCore.Context;
using FlubuCore.IO;
using FlubuCore.Scripting;
using FlubuCore.Scripting.Attributes;
using GlobExpressions;
@@ -18,25 +19,27 @@ namespace BuildScript

protected BuildVersion BuildVersion { get; set; }

protected List<string> ProjectFiles { get; set; }
protected List<FileFullPath> ProjectFiles { get; set; }

protected List<string> TestProjectFiles { get; set; }
protected List<FileFullPath> TestProjectFiles { get; set; }

protected override void ConfigureBuildProperties(IBuildPropertiesContext context)
{
context.Properties.Set(BuildProps.ProductId, "CAP");
context.Properties.Set(BuildProps.SolutionFileName, "CAP.sln");
context.Properties.Set(BuildProps.BuildConfiguration, string.IsNullOrEmpty(Configuration) ? "Release" : Configuration);
//// todo remove casting when new version of flubu is available
BuildVersion = FetchBuildVersion(context as ITaskContext);
Console.WriteLine(BuildVersion.Version());
TestProjectFiles = Glob.Files("./test", "*/*.csproj", GlobOptions.MatchFullPath).Select(x => $"./test/{x}").ToList();
ProjectFiles = Glob.Files("./src", "*/*.csproj").Select(x => $"./src/{x}").ToList();
}

protected override void BeforeBuildExecution(ITaskContext context)
{
BuildVersion = FetchBuildVersion(context);
TestProjectFiles = context.GetFiles("./test", "*/*.csproj");
ProjectFiles = context.GetFiles("./src", "*/*.csproj");
}

protected override void ConfigureTargets(ITaskContext context)
{
var clean = context.CreateTarget("Clean")
.SetDescription("")
.AddCoreTask(x => x.Clean()
.AddDirectoryToClean(ArtifactsDir, true));

@@ -58,7 +61,7 @@ namespace BuildScript
.NoBuild());
});

var pack = context.CreateTarget("Pack")
var pack = context.CreateTarget("Pack")
.ForEach(ProjectFiles, (projectFile, target) =>
{
target.AddCoreTask(x => x.Pack()


+ 1
- 2
build/BuildScript.csproj View File

@@ -5,8 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FlubuCore" Version="4.2.1" />
<PackageReference Include="Glob" Version="1.1.3" />
<PackageReference Include="FlubuCore" Version="4.3.5" />
</ItemGroup>

</Project>

Loading…
Cancel
Save