Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Port to .NET Core & update LibGit * Update to LibGit2Sharp.0.25.2 * Ported to .NET Standard 2.0
  • Loading branch information
devlead committed Aug 23, 2018
2 parents 46ac0df + f80fcfd commit 3bb67a7
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 141 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,6 @@ FakesAssemblies/
# Repo tests
[Tt]est[Rr]epo/
*.ide

#Cake Artifacts dir
[Aa]rtifacts/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ dist: trusty
osx_image: xcode9.2

mono:
- 4.4.2
- 5.12.0

dotnet: 2.1.4
dotnet: 2.1.400

before_install:
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
Expand Down
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### New in 0.19.0 (Released 2018/08/23)

* Ported to .NET Standard 2.0
* Updated to LibGit2Sharp 0.25.2

### New in 0.18.0 (Released 2018/07/04)

* Bumped Cake.Core to 0.28.1
Expand Down
118 changes: 91 additions & 27 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ var solutions = GetFiles("./**/*.sln");
var solutionPaths = solutions.Select(solution => solution.GetDirectory());
var releaseNotes = ParseReleaseNotes("./ReleaseNotes.md");
var version = releaseNotes.Version.ToString();
var binDir = MakeAbsolute(Directory("./src/Cake.Git/bin/" + configuration));
var binDir = MakeAbsolute(Directory("./src/Cake.Git/bin/" + configuration + "/net461"));
var nugetRoot = "./nuget/";
var artifactsRoot = MakeAbsolute(Directory("./artifacts/"));
var semVersion = isLocalBuild
? version
: string.Concat(version, "-build-", AppVeyor.Environment.Build.Number.ToString("0000"));
Expand Down Expand Up @@ -49,10 +50,16 @@ var nuGetPackSettings = new NuGetPackSettings {
Symbols = false,
NoPackageAnalysis = true,
Files = new NuSpecContent[0], // is set dynamically
BasePath = binDir,
BasePath = artifactsRoot,
OutputDirectory = nugetRoot
};

var msBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", semVersion)
.WithProperty("AssemblyVersion", version)
.WithProperty("FileVersion", version)
.WithProperty("PackageReleaseNotes", string.Concat("\"", string.Concat(releaseNotes.Notes.ToArray()), "\""));

Context.Tools.RegisterFile("./tools/nuget.exe");

if (!isLocalBuild)
Expand All @@ -77,6 +84,15 @@ Setup(ctx =>
);

Information(buildStartMessage);

if(!IsRunningOnWindows())
{
var frameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";

// Use FrameworkPathOverride when not running on Windows.
Information("Build will use FrameworkPathOverride={0} since not building on Windows.", frameworkPathOverride);
msBuildSettings.WithProperty("FrameworkPathOverride", frameworkPathOverride);
}
});

Teardown(ctx =>
Expand All @@ -102,6 +118,9 @@ Task("Clean")

Information("Cleaning {0}", nugetRoot);
CleanDirectory(MakeAbsolute(Directory(nugetRoot)));

Information("Cleaning {0}", artifactsRoot);
CleanDirectory(artifactsRoot);
});

Task("Restore")
Expand All @@ -111,7 +130,12 @@ Task("Restore")
foreach(var solution in solutions)
{
Information("Restoring {0}...", solution);
NuGetRestore(solution);
DotNetCoreRestore(
solution.FullPath,
new DotNetCoreRestoreSettings {
Verbosity = DotNetCoreVerbosity.Minimal,
MSBuildSettings = msBuildSettings
});
}
});

Expand All @@ -134,35 +158,64 @@ Task("Build")
foreach(var solution in solutions)
{
Information("Building {0}", solution);
if (IsRunningOnUnix())
{
XBuild(solution, new XBuildSettings()
.SetConfiguration(configuration)
.WithProperty("POSIX", "True")
.WithProperty("TreatWarningsAsErrors", "True")
.SetVerbosity(Verbosity.Minimal)
);
}
else
{
MSBuild(solution, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.WithProperty("TreatWarningsAsErrors","true")
.WithTarget("Build")
.SetConfiguration(configuration));
}
DotNetCoreBuild(
solution.FullPath,
new DotNetCoreBuildSettings {
Configuration = configuration,
NoRestore = true,
MSBuildSettings = msBuildSettings
});
}
});

Task("Create-NuGet-Package")
Task("Publish-Artifacts")
.IsDependentOn("Build")
.Does(() =>
{
nuGetPackSettings.Files = GetFiles(binDir + "/**/*")
.Where(file => !file.FullPath.Contains("Cake.Core."))
.Select(file => file.FullPath.Substring(binDir.FullPath.Length+1))
.Select(file => new NuSpecContent { Source = file, Target = "lib/net46/" + file })
.ToArray();
if (!DirectoryExists(artifactsRoot))
{
CreateDirectory(artifactsRoot);
}

DotNetCorePublish("./src/Cake.Git", new DotNetCorePublishSettings
{
NoRestore = true,
Framework = "net461",
MSBuildSettings = msBuildSettings,
OutputDirectory = artifactsRoot + "/net461"
});

DotNetCorePublish("./src/Cake.Git", new DotNetCorePublishSettings
{
NoRestore = true,
Framework = "netstandard2.0",
MSBuildSettings = msBuildSettings,
OutputDirectory = artifactsRoot + "/netstandard2.0"
});
});


Task("Create-NuGet-Package")
.IsDependentOn("Publish-Artifacts")
.Does(() =>
{
var native = GetFiles(artifactsRoot.FullPath + "/net461/lib/**/*");
var cakeGit = GetFiles(artifactsRoot.FullPath + "/**/Cake.Git.dll");
var libGit = GetFiles(artifactsRoot.FullPath + "/**/LibGit2Sharp*");
var coreNative = GetFiles(artifactsRoot.FullPath + "/netstandard2.0/runtimes/**/*")
- GetFiles(artifactsRoot.FullPath + "/netstandard2.0/runtimes/win7-x86/**/*");
nuGetPackSettings.Files = (native + libGit + cakeGit)
.Where(file=>!file.FullPath.Contains("Cake.Core.") && !file.FullPath.Contains("/runtimes/"))
.Select(file=>file.FullPath.Substring(artifactsRoot.FullPath.Length+1))
.Select(file=>new NuSpecContent {Source = file, Target = "lib/" + file})
.Union(
coreNative
.Select(file=>new NuSpecContent {
Source = file.FullPath.Substring(artifactsRoot.FullPath.Length+1),
Target = "lib/netstandard2.0/" + file.GetFilename()
})
)
.ToArray();

if (!DirectoryExists(nugetRoot))
{
Expand All @@ -187,7 +240,18 @@ Task("Test")
}
Unzip(package, addinDir);

Action executeTests = ()=> CakeExecuteScript("./test.cake", new CakeSettings{ Arguments = new Dictionary<string, string>{{"target", target == "Default" ? "Default-Tests" : "Local-Tests"}}});
Action executeTests = ()=> {
CakeExecuteScript("./testnet461.cake",
new CakeSettings{
Arguments = new Dictionary<string, string>{
{"target", target == "Default" ? "Default-Tests" : "Local-Tests"}}});

DotNetCoreExecute(
"./tools/Cake.CoreCLR/Cake.dll",
string.Concat("testnetstandard2.cake --target=", target == "Default" ? "Default-Tests" : "Local-Tests")
);
};

if (TravisCI.IsRunningOnTravisCI)
{
using(TravisCI.Fold("Execute-Tests"))
Expand Down
110 changes: 16 additions & 94 deletions src/Cake.Git/Cake.Git.csproj
Original file line number Diff line number Diff line change
@@ -1,116 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.165\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.165\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{08F0A5C3-0E9C-451D-B003-14FF73699BE1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cake.Git</RootNamespace>
<AssemblyName>Cake.Git</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DocumentationFile>bin\Debug\Cake.Git.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DocumentationFile>bin\Release\Cake.Git.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>{08F0A5C3-0E9C-451D-B003-14FF73699BE1}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cake.Core, Version=0.28.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.28.1\lib\net46\Cake.Core.dll</HintPath>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.Portable.0.24.10\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
</Reference>
<PackageReference Include="Cake.Core" Version="0.28.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="LibGit2Sharp" Version="0.25.2" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="1.0.217" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GitAliases.Clean.cs" />
<Compile Include="GitAliases.Tags.cs" />
<Compile Include="GitAliases.Unstage.cs" />
<Compile Include="GitAliases.Repository.cs" />
<Compile Include="GitAliases.Reset.cs" />
<Compile Include="GitAliases.Branch.cs" />
<Compile Include="GitAliases.Checkout.cs" />
<Compile Include="Extensions\RepositoryExtensions.cs" />
<Compile Include="GitAliases.Add.cs" />
<Compile Include="GitAliases.Clone.cs" />
<Compile Include="Extensions\PathExtensions.cs" />
<Compile Include="GitAliases.Commit.cs" />
<Compile Include="GitAliases.cs" />
<Compile Include="GitAliases.Describe.cs" />
<Compile Include="GitAliases.Diff.cs" />
<Compile Include="GitAliases.Init.cs" />
<Compile Include="GitAliases.Log.cs" />
<Compile Include="GitAliases.Pull.cs" />
<Compile Include="GitAliases.Push.cs" />
<Compile Include="GitAliases.Tag.cs" />
<Compile Include="GitBranch.cs" />
<Compile Include="GitChangeKind.cs" />
<Compile Include="GitCloneSettings.cs" />
<Compile Include="GitCommit.cs" />
<Compile Include="GitDescribeStrategy.cs" />
<Compile Include="GitDiffFile.cs" />
<Compile Include="GitMergeResult.cs" />
<Compile Include="GitMergeStatus.cs" />
<Compile Include="GitRemote.cs" />
<Compile Include="GitResetMode.cs" />
<Compile Include="GitSignature.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Namespaces.cs" />
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="GitAliases.Remove.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SolutionInfo.cs" Link="Properties\SolutionInfo.cs" />
<None Include="..\..\LICENSE.md">
<Link>LICENSE.md</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.165\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.165\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
6 changes: 0 additions & 6 deletions src/Cake.Git/packages.config

This file was deleted.

6 changes: 3 additions & 3 deletions src/SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
[assembly: AssemblyDescription("Cake Git AddIn")]
[assembly: AssemblyCompany("WCOM AB")]
[assembly: AssemblyProduct("Cake.Git")]
[assembly: AssemblyVersion("0.18.0")]
[assembly: AssemblyFileVersion("0.18.0")]
[assembly: AssemblyInformationalVersion("0.18.0")]
[assembly: AssemblyVersion("0.19.0")]
[assembly: AssemblyFileVersion("0.19.0")]
[assembly: AssemblyInformationalVersion("0.19.0")]
[assembly: AssemblyCopyright("Copyright © WCOM AB 2018")]
[assembly: CLSCompliant(true)]

Loading

0 comments on commit 3bb67a7

Please sign in to comment.