Skip to content

Commit

Permalink
added: NuSpecs
Browse files Browse the repository at this point in the history
added: Build scripts.
ready to publish package.
  • Loading branch information
dadhi committed Mar 3, 2017
1 parent 058a222 commit e71e015
Show file tree
Hide file tree
Showing 21 changed files with 551 additions and 14 deletions.
33 changes: 33 additions & 0 deletions BuildScripts/Build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@echo off
setlocal EnableDelayedExpansion

set SLN="..\src\ImTools.sln"
set OUTDIR="..\bin\Release"

set MSBUILDVER=%2
if "%MSBUILDVER%"=="" set MSBUILDVER=14
echo:MsBuild version: %MSBUILDVER%

echo:
echo:Building %SLN% into %OUTDIR% . . .

for /f "tokens=2*" %%S in ('reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\%MSBUILDVER%.0 /v MSBuildToolsPath') do (

if exist "%%T" (

echo:
echo:Using MSBuild from "%%T"

"%%T\MSBuild.exe" %SLN% /t:Rebuild /v:minimal /m /fl /flp:LogFile=MSBuild.log ^
/p:OutDir=%OUTDIR% ^
/p:GenerateProjectSpecificOutputFolder=false ^
/p:Configuration=Release ^
/p:RestorePackages=false ^
/p:BuildInParallel=true

find /C "Build succeeded." MSBuild.log
)
)

endlocal
if not "%1"=="-nopause" pause
25 changes: 25 additions & 0 deletions BuildScripts/Clean.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off

echo:
echo:Deleting Release and Debug folders . . .

echo:
echo:Switch to solution folder first . . .
pushd "..\src"

if not exist *.sln (
echo:
echo:ERROR: Cleaned folder does not contain solution files, that means it is probably wrong folder. So no cleaning.
popd & exit 1
)

for /d /r %%D IN (b?n;o?j) do (
if exist "%%D\Release" echo "%%D\Release" & rd /s /q "%%D\Release"
if exist "%%D\Debug" echo "%%D\Debug" & rd /s /q "%%D\Debug"
)

echo:
echo:Cleaning succeeded.
popd

if not "%1"=="-nopause" pause
32 changes: 32 additions & 0 deletions BuildScripts/NuGetPack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo off
pushd "..\src"

set NUGET=".nuget\NuGet.exe"
set PACKAGEDIR="bin\NuGetPackages"

echo:
echo:Packing NuGet packages into %PACKAGEDIR% . . .

if exist %PACKAGEDIR% rd /s /q %PACKAGEDIR%
md %PACKAGEDIR%

echo:
call :ParseVersion "ImTools\Properties\AssemblyInfo.cs"
echo:ImTools v%VER%
echo:================
%NUGET% pack "..\NuGet\ImTools.dll.nuspec" -Version %VER% -OutputDirectory %PACKAGEDIR% -NonInteractive -Symbols
%NUGET% pack "..\NuGet\ImTools.nuspec" -Version %VER% -OutputDirectory %PACKAGEDIR% -NonInteractive

echo:
echo:Packaging succeeded.
popd

if not "%1"=="-nopause" pause
goto:eof

:ParseVersion
set VERFILE=%~1
for /f "usebackq tokens=2,3 delims=:() " %%A in ("%VERFILE%") do (
if "%%A"=="AssemblyInformationalVersion" set VER=%%~B
)
exit /b
15 changes: 15 additions & 0 deletions BuildScripts/NuGetPublish.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
pushd "..\src"

set NUGET=".nuget\NuGet.exe"
set PACKAGEDIR="bin\NuGetPackages"
set /p APIKEY=<ApiKey.txt

%NUGET% push "%PACKAGEDIR%\ImTools.dll.1.0.0-preview-01.nupkg" -Source https://nuget.org -ApiKey %APIKEY%
%NUGET% push "%PACKAGEDIR%\ImTools.1.0.0-preview-01.nupkg" -Source https://nuget.org -ApiKey %APIKEY%

popd
pause

echo:
echo:Packaging succeeded.
51 changes: 51 additions & 0 deletions BuildScripts/RunTestsWithCoverage.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@echo off
pushd "..\src"

setlocal EnableDelayedExpansion

set NUNIT="packages\NUnit.ConsoleRunner.3.6.0\tools\nunit3-console.exe"
set OPENCOVER="packages\OpenCover.4.6.519\tools\OpenCover.Console.exe"
set REPORTGEN="packages\ReportGenerator.2.5.5\tools\ReportGenerator.exe"
set REPORTS=bin\Reports
set COVERAGE="%REPORTS%\Coverage.xml"

if not exist %REPORTS% md %REPORTS%

for %%P in (".") do (
for %%T in ("%%P\bin\Release\*Tests.dll") do (
set TESTLIBS=!TESTLIBS! %%T
))

echo:
echo:Running tests with coverage. Results are collected in %COVERAGE% . . .
echo:
echo:from assemblies: %TESTLIBS%
echo:

%OPENCOVER%^
-register:user^
-target:%NUNIT%^
-targetargs:"%TESTLIBS%"^
-filter:"+[*]* -[*Test*]* -[Microsoft*]*"^
-excludebyattribute:*.ExcludeFromCodeCoverageAttribute^
-hideskipped:all^
-output:%COVERAGE%

echo:
echo:Generating HTML coverage report in "%REPORTS%" . . .
echo:

%REPORTGEN%^
-reports:%COVERAGE%^
-targetdir:%REPORTS%^
-reporttypes:Html;HtmlSummary;Badges^
-assemblyfilters:-*Test*^

rem start %REPORTS%\index.htm

echo:
echo:Succeeded.
endlocal
popd

if not "%1"=="-nopause" pause
63 changes: 63 additions & 0 deletions BuildScripts/_main.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@echo off
setlocal

rem Parse arguments:
for %%A in (%*) do (
if /i "%%A"=="-NOPAUSE" (set NOPAUSE=1) else (
if /i "%%A"=="-PUBLISH" (set PUBLISH=1) else (
set UNKNOWNARG=1 & echo:Unknown script argument: "%%A"
))
)
if defined UNKNOWNARG (
echo:ERROR: Unknown script arguments, allowed arguments: "-nopause", "-publish"
exit 1
)

echo:
echo:Clean, build, run tests, etc. . .
if defined PUBLISH echo:. . . and publish NuGet packages!
echo:---------------------------------

set SCRIPTDIR="%~dp0"
echo:
echo:Switching to %SCRIPTDIR% . . .
cd /d %SCRIPTDIR%

call Clean -nopause
call :Check

call Build -nopause
call :Check

call RunTestsWithCoverage -nopause
call :Check

call NuGetPack -nopause
call :Check

if defined PUBLISH (
call NuGetPublish -nopause
call :Check
)

echo:------------
echo:All Success.

if not defined NOPAUSE pause
goto:eof

:Check

if %ERRORLEVEL% EQU 123 (
echo:"* Strange MSBuild error 123 that could be ignored."
exit /b
)

if ERRORLEVEL 1 (
echo:
echo:ERROR: One of steps is failed with ERRORLEVEL==%ERRORLEVEL%!
if not defined NOPAUSE pause
exit 1
) else (
exit /b
)
File renamed without changes.
67 changes: 67 additions & 0 deletions NuGet/ImTools.dll.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>ImTools.dll</id>
<version>0.0.0</version>
<!-- overridden by "NuGet pack -Version" flag -->
<authors>Maksim Volkau</authors>
<copyright>Copyright © 2016 Maksim Volkau</copyright>
<projectUrl>https://github.com/dadhi/ImTools</projectUrl>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Collection of Immutable persistent data structures, Ref, and array manipulations.
Split from DryIoc: https://bitbucket.org/dadhi/dryioc
</description>
<tags>Immutability Persistent HashMap Avl Balanced Tree Map Dictionary Thread-safe Concurrency Functional Atomic</tags>
<releaseNotes>Initial version.</releaseNotes>
<dependencies>
<group targetFramework="netstandard1.0">
<dependency id="System.Collections" version="4.0.11" />
<dependency id="System.Diagnostics.Debug" version="4.0.11" />
<dependency id="System.Diagnostics.Tools" version="4.0.1" />
<dependency id="System.Linq" version="4.1.0" />
<dependency id="System.Linq.Expressions" version="4.1.0" />
<dependency id="System.Reflection" version="4.1.0" />
<dependency id="System.Reflection.Extensions" version="4.0.1" />
<dependency id="System.Runtime" version="4.1.0" />
<dependency id="System.Runtime.Extensions" version="4.1.0" />
<dependency id="System.Threading" version="4.0.11" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\LICENSE.txt" />

<!-- netstandard1.0 (based on PCL 259) -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\netstandard1.0" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\netstandard1.0" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\netstandard1.0" />

<!-- net35 -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\net35" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\net35" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\net35" />

<!-- net40 -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\net40" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\net40" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\net40" />

<!-- net45 -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\net45" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\net45" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\net45" />

<!-- PCL Profile328 .NET Portable Subset (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />

<!-- PCL Profile259 .NET Portable Subset (.NET Framework 4.5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) -->
<file src="..\src\bin\Release\ImTools.dll" target="lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />
<file src="..\src\bin\Release\ImTools.pdb" target="lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />
<file src="..\src\bin\Release\ImTools.xml" target="lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" />

</files>
</package>
49 changes: 49 additions & 0 deletions NuGet/ImTools.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>ImTools</id>
<version>0.0.0</version>
<!-- overridden by "NuGet pack -Version" flag -->
<authors>Maksim Volkau</authors>
<copyright>Copyright © 2016 Maksim Volkau</copyright>
<projectUrl>https://github.com/dadhi/ImTools</projectUrl>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Collection of Immutable persistent data structures, Ref, and array manipulations.
Split from DryIoc: https://bitbucket.org/dadhi/dryioc
</description>
<tags>Immutability Persistent HashMap Avl Balanced Tree Map Dictionary Thread-safe Concurrency Functional Atomic</tags>
<releaseNotes>Initial version.</releaseNotes>
<contentFiles>
<files include="cs/any/*.*" buildAction="Compile" />
</contentFiles>
</metadata>
<files>
<file src="..\LICENSE.txt" />

<!--net35-->
<file src="..\src\ImTools\ImTools.cs" target="content\net35\ImTools" />
<file src="..\src\ImTools\ImHashMap.cs" target="content\net35\ImTools" />

<!--net40-->
<file src="..\src\ImTools\ImTools.cs" target="content\net40\ImTools" />
<file src="..\src\ImTools\ImHashMap.cs" target="content\net40\ImTools" />

<!--net45-->
<file src="..\src\ImTools\ImTools.cs" target="content\net45\ImTools" />
<file src="..\src\ImTools\ImHashMap.cs" target="content\net45\ImTools" />

<!-- PCL Profile328: .NET Portable Subset (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) -->
<file src="..\src\ImTools\ImTools.cs" target="content\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\ImTools" />
<file src="..\src\ImTools\ImHashMap.cs" target="content\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\ImTools" />

<!-- PCL Profile259: .NET Portable Subset (.NET Framework 4.5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) -->
<file src="..\src\ImTools\ImTools.cs" target="content\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\ImTools" />
<file src="..\src\ImTools\ImHashMap.cs" target="content\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\ImTools" />

<!--uap10.0: Universal Windows Platform-->
<file src="..\src\ImTools\ImTools.cs" target="contentFiles\cs\any" />
<file src="..\src\ImTools\ImHashMap.cs" target="contentFiles\cs\any" />
</files>
</package>
1 change: 1 addition & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.\BuildScripts\_main.bat
6 changes: 6 additions & 0 deletions src/.nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="false" />
</solution>
</configuration>
Binary file added src/.nuget/NuGet.exe
Binary file not shown.
Loading

0 comments on commit e71e015

Please sign in to comment.