Commit 549bb5ec authored by Marko Zorec's avatar Marko Zorec Committed by Savorboard

Improve build script (#467)

* Adds Flubu build script

* Improve build script

* update flubu global tool version

* fix target name
parent cc585288
......@@ -17,5 +17,6 @@ mono: none
# Run the build script
script:
- dotnet tool install --global FlubuCore.GlobalTool --version 4.2.8
- flubu build test
\ No newline at end of file
- 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
......@@ -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
......
......@@ -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()
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment