Explorar o código

Update build script

Lucas Trzesniewski %!s(int64=7) %!d(string=hai) anos
pai
achega
1b33a5bd9d

+ 0 - 30
build/Abc.Zebus.Testing.nuspec

@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<package>
-  <metadata>
-    <id>Zebus.Testing</id>
-    <title>Zebus.Testing</title>
-    <authors>ABC arbitrage</authors>
-    <licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.md</licenseUrl>
-    <projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <description>Test tools for Zebus</description>
-    <releaseNotes></releaseNotes>
-    <copyright>Copyright © ABC arbitrage 2018</copyright>
-    <tags></tags>
-    <dependencies>
-      <dependency id="Zebus" version="$version$" />
-      <dependency id="AutoFixture" version="3.36.8" />
-      <dependency id="CompareNETObjects" version="3.03.0.0" />
-      <dependency id="Moq" version="4.2.1507.0118" />
-      <dependency id="Newtonsoft.Json" version="11.0.2" />
-      <dependency id="NUnit" version="2.6.4" />
-      <dependency id="structuremap" version="3.1.6.186" />
-    </dependencies>
-  </metadata>
-  <files>
-    <file src="Abc.Zebus.Testing.pdb" target="lib\net461\" />
-    <file src="Abc.Zebus.Testing.dll" target="lib\net461\" />
-
-    <file src=".\..\..\src\Abc.Zebus.Testing\**\*.cs" target="src" />
-  </files>
-</package>

+ 0 - 30
build/Abc.Zebus.nuspec

@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<package>
-  <metadata>
-    <id>Zebus</id>
-    <title>Zebus</title>
-    <authors>ABC arbitrage</authors>
-    <licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.md</licenseUrl>
-    <projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <description>A lightweight Peer to Peer Service Bus</description>
-    <releaseNotes></releaseNotes>
-    <copyright>Copyright © ABC arbitrage 2018</copyright>
-    <tags></tags>
-    <references>
-      <reference file="Abc.Zebus.dll" />
-    </references>
-    <dependencies>
-      <dependency id="log4net" version="2.0.8" />
-      <dependency id="Newtonsoft.Json" version="11.0.2" />
-      <dependency id="protobuf-net" version="2.3.7" />
-      <dependency id="structuremap" version="3.1.6.186" />
-    </dependencies>
-  </metadata>
-  <files>
-    <file src="Abc.Zebus.dll" target="lib\net461\" />
-    <file src="Abc.Zebus.pdb" target="lib\net461\" />
-    <file src=".\..\..\lib\zmq\ZeroMQ.dll" target="lib\net461\" />
-    <file src=".\..\..\src\Abc.Zebus\**\*.cs" target="src" />
-  </files>
-</package>

+ 25 - 49
build/build.cake

@@ -1,5 +1,4 @@
-#l "scripts/utilities.cake"
-#tool nuget:?package=NUnit.Runners.Net4&version=2.6.4
+#tool "nuget:?package=NUnit.ConsoleRunner"
 
 //////////////////////////////////////////////////////////////////////
 // ARGUMENTS
@@ -7,73 +6,50 @@
 
 var target = Argument("target", "Default");
 var paths = new {
+    src = MakeAbsolute(Directory("./../src")).FullPath,
     solution = MakeAbsolute(File("./../src/Abc.Zebus.sln")).FullPath,
-    version = MakeAbsolute(File("./../version.yml")).FullPath,
-    assemblyInfo = MakeAbsolute(File("./../src/SharedVersionInfo.cs")).FullPath,
-    output = new {
-        build = MakeAbsolute(Directory("./../output/build")).FullPath,
-        nuget = MakeAbsolute(Directory("./../output/nuget")).FullPath,
-    },
-    nuspec = new {
-        zebus = MakeAbsolute(File("./Abc.Zebus.nuspec")).FullPath,
-        testing = MakeAbsolute(File("./Abc.Zebus.Testing.nuspec")).FullPath,
-    }
+    props = MakeAbsolute(File("./../src/Directory.Build.props")).FullPath,
+    testProject = MakeAbsolute(File("./../src/Abc.Zebus.Tests/Abc.Zebus.Tests.csproj")).FullPath,
+    nugetOutput = MakeAbsolute(Directory("./../output/nuget")).FullPath,
 };
 
-ReadContext(paths.version);
-
 //////////////////////////////////////////////////////////////////////
 // TASKS
 //////////////////////////////////////////////////////////////////////
 
-Task("UpdateBuildVersionNumber").Does(() => UpdateAppVeyorBuildVersionNumber());
 Task("Clean").Does(() =>
 {
-    CleanDirectory(paths.output.build);
-    CleanDirectory(paths.output.nuget);
+    CleanDirectories(GetDirectories(paths.src + "/**/bin/Release"));
+    CleanDirectory(paths.nugetOutput);
 });
 Task("Restore-NuGet-Packages").Does(() => NuGetRestore(paths.solution));
-Task("Create-AssemblyInfo").Does(()=>{
-    Information("Assembly Version: {0}", VersionContext.AssemblyVersion);
-    Information("   NuGet Version: {0}", VersionContext.NugetVersion);
-    CreateAssemblyInfo(paths.assemblyInfo, new AssemblyInfoSettings {
-        Version = VersionContext.AssemblyVersion,
-        FileVersion = VersionContext.AssemblyVersion,
-        InformationalVersion = VersionContext.NugetVersion + " Commit: " + VersionContext.Git.Sha
-    });
-});
-Task("MSBuild").Does(() => MSBuild(paths.solution, settings => settings.SetConfiguration("Release")
-                                                .SetPlatformTarget(PlatformTarget.MSIL)
-                                                .WithProperty("OutDir", paths.output.build)));
-Task("Clean-AssemblyInfo").Does(() => System.IO.File.WriteAllText(paths.assemblyInfo, string.Empty));
+Task("MSBuild").Does(() => MSBuild(paths.solution, settings => settings
+    .WithTarget("Rebuild")
+    .SetConfiguration("Release")
+));
 Task("Run-Unit-Tests").Does(() =>
 {
-    NUnit(paths.output.build + "/*.Tests.exe", new NUnitSettings { Framework = "4.6.1", NoResults = true });
-    NUnit(paths.output.build + "/*.Tests.dll", new NUnitSettings { Framework = "4.6.1", NoResults = true });
-});
-Task("Nuget-Pack").Does(() => 
-{
-    var settings = new NuGetPackSettings {
-        Version = VersionContext.NugetVersion,
-        BasePath = paths.output.build,
-        OutputDirectory = paths.output.nuget,
-        Symbols = true
-    };
-    NuGetPack(paths.nuspec.zebus, settings);
-    NuGetPack(paths.nuspec.testing, settings);
+    //NUnit3(MakeAbsolute(File("./../src/Abc.Zebus.Tests/bin/Release/net471/Abc.Zebus.Tests.dll")).FullPath, new NUnit3Settings { NoResults = true });
+    DotNetCoreTest(paths.testProject, new DotNetCoreTestSettings {
+        Configuration = "Release",
+        NoBuild = true
+    });
 });
+Task("Nuget-Pack").Does(() => MSBuild(paths.solution, settings => settings
+        .WithTarget("Pack")
+        .SetConfiguration("Release")
+        .SetPlatformTarget(PlatformTarget.MSIL)
+        .WithProperty("PackageOutputPath", paths.nugetOutput)
+));
 
 //////////////////////////////////////////////////////////////////////
 // TASK TARGETS
 //////////////////////////////////////////////////////////////////////
 
 Task("Build")
-    .IsDependentOn("UpdateBuildVersionNumber")
     .IsDependentOn("Clean")
     .IsDependentOn("Restore-NuGet-Packages")
-    .IsDependentOn("Create-AssemblyInfo")
-    .IsDependentOn("MSBuild")
-    .IsDependentOn("Clean-AssemblyInfo");
+    .IsDependentOn("MSBuild");
 
 Task("Test")
     .IsDependentOn("Build")
@@ -83,10 +59,10 @@ Task("Nuget")
     .IsDependentOn("Test")
     .IsDependentOn("Nuget-Pack")
     .Does(() => {
-        Information("   Nuget package is now ready at location: {0}.", paths.output.nuget);
+        Information("   Nuget package is now ready at location: {0}.", paths.nugetOutput);
         Warning("   Please remember to create and push a tag based on the currently built version.");
         Information("   You can do so by copying/pasting the following commands:");
-        Information("       git tag v{0}", VersionContext.NugetVersion);
+        Information("       git tag v{0}", XmlPeek(paths.props, @"/Project/PropertyGroup/PackageVersion/text()"));
         Information("       git push origin --tags");
     });
 

+ 3 - 3
build/build.ps1

@@ -165,7 +165,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
     $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
 
     if ($LASTEXITCODE -ne 0) {
-        Throw "An error occured while restoring NuGet tools."
+        Throw "An error occurred while restoring NuGet tools."
     }
     else
     {
@@ -185,7 +185,7 @@ if (Test-Path $ADDINS_PACKAGES_CONFIG) {
     $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
 
     if ($LASTEXITCODE -ne 0) {
-        Throw "An error occured while restoring NuGet addins."
+        Throw "An error occurred while restoring NuGet addins."
     }
 
     Write-Verbose -Message ($NuGetOutput | out-string)
@@ -202,7 +202,7 @@ if (Test-Path $MODULES_PACKAGES_CONFIG) {
     $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
 
     if ($LASTEXITCODE -ne 0) {
-        Throw "An error occured while restoring NuGet modules."
+        Throw "An error occurred while restoring NuGet modules."
     }
 
     Write-Verbose -Message ($NuGetOutput | out-string)

+ 0 - 62
build/scripts/utilities.cake

@@ -1,62 +0,0 @@
-#tool "nuget:?package=GitVersion.CommandLine"
-#addin "nuget:?package=YamlDotNet"
-
-public class ContextInfo
-{
-    public string NugetVersion { get; set; }
-    public string AssemblyVersion { get; set; }
-    public GitVersion Git { get; set; }
-
-    public string BuildVersion
-    {
-        get { return NugetVersion + "-" + Git.Sha; }
-    }
-}
-
-ContextInfo _versionContext = null;
-public ContextInfo VersionContext 
-{
-    get 
-    {
-        if(_versionContext == null)
-            throw new Exception("The current context has not been read yet. Call ReadContext(FilePath) before accessing the property.");
-
-        return _versionContext;
-    }
-} 
-
-public ContextInfo ReadContext(FilePath filepath)
-{
-    var deserializer = new YamlDotNet.Serialization.Deserializer();
-    _versionContext = deserializer.Deserialize<ContextInfo>(System.IO.File.ReadAllText(filepath.ToString()));
-    try
-    {
-        _versionContext.Git = GitVersion();
-    }
-    catch
-    {
-        _versionContext.Git = new Cake.Common.Tools.GitVersion.GitVersion();
-    }
-    return _versionContext;
-}
-
-public void UpdateAppVeyorBuildVersionNumber()
-{   
-    var increment = 0;
-    while(increment < 10)
-    {
-        try
-        {
-            var version = VersionContext.BuildVersion;
-            if(increment > 0)
-                version += "-" + increment;
-            
-            AppVeyor.UpdateBuildVersion(version);
-            break;
-        }
-        catch
-        {
-            increment++;
-        }
-    }
-}

+ 1 - 0
src/Abc.Zebus.Contracts/Abc.Zebus.Contracts.csproj

@@ -2,6 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
+    <PackageId>Zebus.Contracts</PackageId>
     <RootNamespace>Abc.Zebus</RootNamespace>
   </PropertyGroup>
 

+ 2 - 10
src/Abc.Zebus.Testing/Abc.Zebus.Testing.csproj

@@ -1,10 +1,8 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+    <PackageId>Zebus.Testing</PackageId>
+    <Description>Test tools for Zebus</Description>
   </PropertyGroup>
 
   <ItemGroup>
@@ -24,12 +22,6 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\SharedVersionInfo.cs">
-      <Link>Properties\SharedVersionInfo.cs</Link>
-    </Compile>
     <Content Include="Integration\Configurations\Directory-Local.config">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

+ 1 - 3
src/Abc.Zebus.Testing/Properties/AssemblyInfo.cs

@@ -1,11 +1,9 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 // General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("Abc.Zebus.Testing")]
 [assembly: ComVisible(false)]
 [assembly: Guid("2b782073-d62a-4e5e-91ed-e5c2290974b3")]
 

+ 4 - 10
src/Abc.Zebus.Tests/Abc.Zebus.Tests.csproj

@@ -1,18 +1,8 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>net471;netcoreapp2.1</TargetFrameworks>
-    <OutputType>Library</OutputType>
-    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
-    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
 
-  <ItemGroup>
-    <EmbeddedResource Include="Transport\transport_message_1_4_1.bin" />
-  </ItemGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\Abc.Zebus.Testing\Abc.Zebus.Testing.csproj" />
     <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj" />
@@ -30,6 +20,10 @@
     <PackageReference Include="structuremap" Version="4.6.1" />
   </ItemGroup>
 
+  <ItemGroup>
+    <EmbeddedResource Include="Transport\transport_message_1_4_1.bin" />
+  </ItemGroup>
+
   <ItemGroup>
     <Reference Include="ZeroMQ">
       <HintPath>..\..\lib\zmq\ZeroMQ.dll</HintPath>

+ 2 - 4
src/Abc.Zebus.Tests/Properties/AssemblyInfo.cs

@@ -1,9 +1,7 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
 
 // General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("Abc.Zebus.Tests")]
 [assembly: ComVisible(false)]
-[assembly: Guid("ea07e203-87af-4e5b-83b4-92cef686a909")]
+[assembly: Guid("ea07e203-87af-4e5b-83b4-92cef686a909")]

+ 0 - 5
src/Abc.Zebus.sln

@@ -11,14 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Abc.Zebus.Testing", "Abc.Ze
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "@ Solution Items", "@ Solution Items", "{A85342C3-7BA4-4A6B-B690-B1D0ACE14C76}"
 	ProjectSection(SolutionItems) = preProject
-		..\build\Abc.Zebus.nuspec = ..\build\Abc.Zebus.nuspec
-		..\build\Abc.Zebus.Testing.nuspec = ..\build\Abc.Zebus.Testing.nuspec
 		..\build\build.cake = ..\build\build.cake
 		Directory.Build.props = Directory.Build.props
 		..\RELEASE_NOTES.md = ..\RELEASE_NOTES.md
-		SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
-		SharedVersionInfo.cs = SharedVersionInfo.cs
-		..\version.yml = ..\version.yml
 	EndProjectSection
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Abc.Zebus.Contracts", "Abc.Zebus.Contracts\Abc.Zebus.Contracts.csproj", "{507A4411-DB8A-4663-A491-CCA29854B890}"

+ 5 - 12
src/Abc.Zebus/Abc.Zebus.csproj

@@ -1,12 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <LangVersion>latest</LangVersion>
+    <PackageId>Zebus</PackageId>
   </PropertyGroup>
 
   <ItemGroup>
@@ -30,12 +25,10 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\SharedVersionInfo.cs">
-      <Link>Properties\SharedVersionInfo.cs</Link>
-    </Compile>
+    <None Include="..\..\lib\zmq\ZeroMQ.dll">
+      <Pack>True</Pack>
+      <PackagePath>lib\netstandard2.0</PackagePath>
+    </None>
 
     <EmbeddedResource Include="Transport\libsodium-x64.dll" />
     <EmbeddedResource Include="Transport\libsodium-x86.dll" />

+ 2 - 4
src/Abc.Zebus/Properties/AssemblyInfo.cs

@@ -1,8 +1,6 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-[assembly: AssemblyTitle("Abc.Zebus")]
 [assembly: ComVisible(false)]
 [assembly: Guid("a287fe42-8da0-46cd-9562-9b35274da061")]
 
@@ -27,4 +25,4 @@ using System.Runtime.InteropServices;
 
 [assembly: InternalsVisibleTo("Abc.Zebus.Persistence")]
 [assembly: InternalsVisibleTo("Abc.Zebus.Persistence.CQL")]
-[assembly: InternalsVisibleTo("Abc.Zebus.Persistence.CQL.Tests")]
+[assembly: InternalsVisibleTo("Abc.Zebus.Persistence.CQL.Tests")]

+ 14 - 0
src/Directory.Build.props

@@ -2,11 +2,25 @@
 
   <PropertyGroup>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
     <LangVersion>latest</LangVersion>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
 
   <PropertyGroup>
     <DefineConstants Condition="'$(TargetFramework)' == 'net471'
                      or '$(TargetFramework)' == 'net461'">$(DefineConstants);NETFWK</DefineConstants>
   </PropertyGroup>
+
+  <PropertyGroup>
+    <Version>3.0.0</Version>
+    <PackageVersion>3.0.0-alpha1</PackageVersion>
+    <Authors>ABC arbitrage</Authors>
+    <Description>A lightweight Peer to Peer Service Bus</Description>
+    <PackageProjectUrl>https://github.com/Abc-Arbitrage/Zebus</PackageProjectUrl>
+    <PackageLicenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.md</PackageLicenseUrl>
+    <Copyright>Copyright © ABC arbitrage 2018</Copyright>
+  </PropertyGroup>
+
 </Project>

+ 0 - 12
src/SharedAssemblyInfo.cs

@@ -1,12 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyProduct("Zebus")]
-[assembly: AssemblyDescription("A lightweight Peer to Peer Service Bus")]
-[assembly: AssemblyCompany("ABC Arbitrage Asset Management")]
-[assembly: AssemblyCopyright("Copyright © ABC Arbitrage Asset Management 2017")]
-
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Release")]
-#endif

+ 0 - 0
src/SharedVersionInfo.cs


+ 0 - 2
version.yml

@@ -1,2 +0,0 @@
-NugetVersion: 3.0.0-alpha1
-AssemblyVersion: 3.0.0