Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build/UnitsNet.Serialization.JsonNet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</dependencies>
</metadata>
<files>
<file src="Artifacts\Bin\Src\AnyCPU_Release\**\UnitsNet.Serialization.JsonNet.dll" target="lib" />
<file src="Artifacts\Bin\Src-unsigned\AnyCPU_Release\**\UnitsNet.Serialization.JsonNet.dll" target="lib" />
<file src="UnitsNet.Serialization.JsonNet\**\*.cs" exclude="UnitsNet.Serialization.JsonNet\**\obj\**\*.cs"
target="src" />
</files>
Expand Down
25 changes: 25 additions & 0 deletions Build/UnitsNet.Signed.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>UnitsNet.Signed</id>
<version>3.48.1</version>
<title>Units.NET (signed)</title>
<authors>Andreas Gullberg Larsen</authors>
<owners>Andreas Gullberg Larsen</owners>
<licenseUrl>https://github.com/anjdreas/UnitsNet/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/anjdreas/UnitsNet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Strong name signed edition of Units.NET. Only use this if you need a signed version.</description>
<summary>Strong name signed edition of Units.NET.</summary>
<iconUrl>https://raw.githubusercontent.com/anjdreas/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</iconUrl>
<releaseNotes>
</releaseNotes>
<copyright>Copyright © 2015 Andreas Gullberg Larsen</copyright>
<language>en-US</language>
<tags>unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable</tags>
</metadata>
<files>
<file src="Artifacts\Bin\Src-signed\AnyCPU_Release\**\UnitsNet.dll" target="lib" />
<file src="UnitsNet\**\*.cs" exclude="UnitsNet\**\obj\**\*.cs" target="src" />
</files>
</package>
2 changes: 1 addition & 1 deletion Build/UnitsNet.WindowsRuntimeComponent.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tags>unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable uwp uap winrt win10 windows runtime component</tags>
</metadata>
<files>
<file src="Artifacts\Bin\Src\AnyCPU_Release\uap10.0\UnitsNet.*" target="lib/uap10.0" />
<file src="Artifacts\Bin\Src-unsigned\AnyCPU_Release\uap10.0\UnitsNet.*" target="lib/uap10.0" />
<file src="UnitsNet\**\*.cs" exclude="UnitsNet\**\obj\**\*.cs" target="src" />
</files>
</package>
2 changes: 1 addition & 1 deletion Build/UnitsNet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tags>unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable</tags>
</metadata>
<files>
<file src="Artifacts\Bin\Src\AnyCPU_Release\**\UnitsNet.dll" target="lib" />
<file src="Artifacts\Bin\Src-unsigned\AnyCPU_Release\**\UnitsNet.dll" target="lib" />
<file src="UnitsNet\**\*.cs" exclude="UnitsNet\**\obj\**\*.cs" target="src" />
</files>
</package>
14 changes: 12 additions & 2 deletions Build/build-all-debug.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
SET ROOT=%~dp0..
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Debug /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
@echo off
set ROOT=%~dp0..
set SrcDir="%ROOT%\Artifacts\Bin\Src"
set SrcUnsignedDir="%ROOT%\Artifacts\Bin\Src-unsigned"

echo Build unsigned binaries.
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-all.msbuild /verbosity:normal /p:Configuration=Debug /target:Clean;Rebuild /p:RestorePackages=false
if %errorlevel% neq 0 exit /b %errorlevel%

echo Move unsigned binaries to: %SrcUnsignedDir%
if exist %SrcUnsignedDir% rmdir /Q /S %SrcUnsignedDir%
ren %SrcDir% "Src-unsigned"
if %errorlevel% neq 0 exit /b %errorlevel%
13 changes: 11 additions & 2 deletions Build/build-all-release.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
@echo off
SET ROOT=%~dp0..
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Release /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
set ROOT=%~dp0..
set SrcDir="%ROOT%\Artifacts\Bin\Src"
set SrcUnsignedDir="%ROOT%\Artifacts\Bin\Src-unsigned"

echo Build unsigned binaries.
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-all.msbuild /verbosity:normal /p:Configuration=Release /target:Clean;Rebuild /p:RestorePackages=false
if %errorlevel% neq 0 exit /b %errorlevel%

echo Move unsigned binaries to: %SrcUnsignedDir%
if exist %SrcUnsignedDir% rmdir /Q /S %SrcUnsignedDir%
ren %SrcDir% "Src-unsigned"
if %errorlevel% neq 0 exit /b %errorlevel%
40 changes: 24 additions & 16 deletions Build/all.msbuild → Build/build-all.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,37 @@
<Configuration>Release</Configuration>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<RootPath>$(MSBuildProjectDirectory)\..\</RootPath>
</PropertyGroup>

<Target Name="CleanAndBuild" DependsOnTargets="Clean;CompileProjects" />

<Target Name="Clean">
<MSBuild Projects="@(AllProjects)" Targets="Clean" />
<RemoveDir Directories="$(SrcBinPath)" />
</Target>

<Target Name="CompileProjects">
<MSBuild Projects="
<Projects>
$(RootPath)\UnitsNet\UnitsNet.Net35.csproj;
$(RootPath)\UnitsNet\UnitsNet.Portable40.csproj;
$(RootPath)\UnitsNet\UnitsNet.NetStandard10.csproj;
$(RootPath)\UnitsNet\UnitsNet.WindowsRuntimeComponent.csproj;
$(RootPath)\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Net35.csproj;
$(RootPath)\UnitsNet.Tests\UnitsNet.Tests.csproj;
$(RootPath)\UnitsNet.Tests\UnitsNet.WindowsRuntimeComponent.Tests.csproj;
$(RootPath)\UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj"
$(RootPath)\UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj
</Projects>
</PropertyGroup>

<Target Name="Clean">
<MSBuild
Projects="$(Projects)"
Targets="Clean" />
</Target>

<Target Name="Build">
<MSBuild
Projects="$(Projects)"
Targets="Build"
Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion);SkipGenerateUnits=True" />
</Target>

Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion)"
Targets="Build">
</MSBuild>
<Target Name="Rebuild">
<MSBuild
Projects="$(Projects)"
Targets="Rebuild"
Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion);SkipGenerateUnits=True"
/>
</Target>

</Project>
</Project>
25 changes: 25 additions & 0 deletions Build/build-signed-release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off
set StrongNameSignFile="%1"
set errorlevel=0
set ROOT=%~dp0..
set SrcDir="%ROOT%\Artifacts\Bin\Src"
set SrcSignedDir="%ROOT%\Artifacts\Bin\Src-signed"

if exist "%StrongNameSignFile%" (
echo Build signed binaries with key: %StrongNameSignFile%
"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-signed.msbuild /verbosity:Normal /p:Configuration=Release /target:Clean;Rebuild /p:RestorePackages=false /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=%StrongNameSignFile%

if %errorlevel% neq 0 (
echo Error: %errorlevel%
exit /b %errorlevel%
)

echo %SrcDir%
echo Move signed binaries to: %SrcSignedDir%
@echo on
if exist %SrcSignedDir% rmdir /Q /S %SrcSignedDir%
ren %SrcDir% "Src-signed"
@echo off
) else (
echo NO STRONG NAME SIGNING FILE: %StrongNameSignFile%
)
39 changes: 39 additions & 0 deletions Build/build-signed.msbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CompileProjects" ToolsVersion="14.0">

<PropertyGroup>
<Platform>AnyCPU</Platform>
<Configuration>Release</Configuration>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<RootPath>$(MSBuildProjectDirectory)\..\</RootPath>
<Projects>
$(RootPath)\UnitsNet\UnitsNet.Net35.csproj;
$(RootPath)\UnitsNet\UnitsNet.Portable40.csproj;
$(RootPath)\UnitsNet\UnitsNet.NetStandard10.csproj;
$(RootPath)\UnitsNet\UnitsNet.WindowsRuntimeComponent.csproj;
$(RootPath)\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Net35.csproj
</Projects>
</PropertyGroup>

<Target Name="Clean">
<MSBuild
Projects="$(Projects)"
Targets="Clean" />
</Target>

<Target Name="Build">
<MSBuild
Projects="$(Projects)"
Targets="Build"
Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion);SkipGenerateUnits=True" />
</Target>

<Target Name="Rebuild">
<MSBuild
Projects="$(Projects)"
Targets="Rebuild"
Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion);SkipGenerateUnits=True"
/>
</Target>

</Project>
33 changes: 32 additions & 1 deletion Build/build.bat
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
@echo off
SET ROOT=%~dp0..
rem This file builds everything and is run on the build server as part of
rem building, testing and packing nugets for all master commits and pull requests.

rem Publishing nugets is handled by nuget-publish.bat and run by the build server
rem on the master branch.

rem Optional strong name signing .pfx key file to produce signed binaries and nugets.
set StrongNameSignFile="%1"

set ROOT=%~dp0..

if exist %StrongNameSignFile% (
echo Using strong name signing key file: %StrongNameSignFile%
) else (
echo No strong name signing key file specified. Will only build unsigned binaries and nugets.
)

if exist %ROOT%\Artifacts rmdir /Q /S %ROOT%\Artifacts

rem Regenerate all source code and test stubs before building
rem since there is no guarantee that merged pull requests
rem have properly regenerated code.
call %ROOT%\GenerateUnits.bat
if %errorlevel% neq 0 exit /b %errorlevel%

rem Update AsseemblyInfo.cs versions from .nuspec files
call powershell -NoProfile %ROOT%\Build\UpdateAssemblyInfo.ps1
if %errorlevel% neq 0 exit /b %errorlevel%

rem Restore nugets
call %ROOT%\Build\nuget-restore.bat
if %errorlevel% neq 0 exit /b %errorlevel%

rem Build source and tests
call %ROOT%\Build\build-all-release.bat
if %errorlevel% neq 0 exit /b %errorlevel%

rem Run all tests
call %ROOT%\Build\run-tests.bat
if %errorlevel% neq 0 exit /b %errorlevel%

rem Only build signed binaries if tests pass
call %ROOT%\Build\build-signed-release.bat %StrongNameSignFile%
if %errorlevel% neq 0 exit /b %errorlevel%

rem Pack nugets for both signed and unsigned binaries
call %ROOT%\Build\pack-nuget.bat
if %errorlevel% neq 0 exit /b %errorlevel%

rem Create a zip bundle of everything, becomes available in TeamCity for download
call %ROOT%\Build\zip-artifacts.bat
if %errorlevel% neq 0 exit /b %errorlevel%
26 changes: 26 additions & 0 deletions Build/msbuild-signed.msbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CompileProjects" ToolsVersion="14.0">

<PropertyGroup>
<Platform>AnyCPU</Platform>
<Configuration>Release</Configuration>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<RootPath>$(MSBuildProjectDirectory)\..\</RootPath>
</PropertyGroup>

<Target Name="CleanAndBuild" DependsOnTargets="Clean;Build" />

<Target Name="Clean">
<MSBuild Projects="@(AllProjects)" Targets="Clean" />
</Target>

<Target Name="Build">
<MSBuild Projects="
$(RootPath)\UnitsNet\UnitsNet.Net35.csproj"

Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion);SkipGenerateUnits=True"
Targets="Build">
</MSBuild>
</Target>

</Project>
6 changes: 6 additions & 0 deletions Build/pack-nuget.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@echo off
SET ROOT=%~dp0..
SET MainNuspec=%ROOT%\Build\UnitsNet.nuspec
SET MainSignedNuspec=%ROOT%\Build\UnitsNet.Signed.nuspec
SET UwpNuspec=%ROOT%\Build\UnitsNet.WindowsRuntimeComponent.nuspec
SET SerializationNuspec=%ROOT%\Build\UnitsNet.Serialization.JsonNet.nuspec
SET NuGetExe=%ROOT%\Tools\NuGet.exe
Expand All @@ -10,7 +11,12 @@ mkdir "%NuGetOutDir%"

%NuGetExe% pack %MainNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%

%NuGetExe% pack %MainSignedNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%

%NuGetExe% pack %UwpNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%

%NuGetExe% pack %SerializationNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%
1 change: 0 additions & 1 deletion GenerateUnits.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@echo off
SET scriptdir=%~dp0
powershell -ExecutionPolicy Bypass -NoProfile -File %scriptdir%UnitsNet\Scripts\GenerateUnits.ps1
pause
4 changes: 2 additions & 2 deletions UnitsNet.Tests/CustomCode/ForceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public class ForceTests : ForceTestsBase
{
protected override double DyneInOneNewton => 1E5;

protected override double KilogramsForceInOneNewton => 1/Constants.Gravity;
protected override double KilogramsForceInOneNewton => 0.101972;

protected override double KilonewtonsInOneNewton => 1E-3;

protected override double KiloPondsInOneNewton => 1/Constants.Gravity;
protected override double KiloPondsInOneNewton => 0.101972;

protected override double NewtonsInOneNewton => 1;

Expand Down
Loading