Skip to content

Commit

Permalink
Add .NET Standard 2.0 target (4.0.x) (#15)
Browse files Browse the repository at this point in the history
* Add .NET Standard 2.0 target
* Run tests using .NET Core 3.1
* Fix NuGetPush.bat file generation
* Remove gutter from build scripts
* Add SourceLink
* Enable deterministic builds
* Set version 4.0.5
  • Loading branch information
hazzik authored Oct 18, 2022
1 parent 269ec07 commit a21233d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 125 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Iesi.Collections
================

Current version: 4.0.4
Current version: 4.0.5

Some additional `ISet<T>` implementations for .Net 4.

Expand Down
1 change: 0 additions & 1 deletion Tools/.gitignore

This file was deleted.

176 changes: 63 additions & 113 deletions default.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,30 @@
<project name="Iesi.Collections" default="build" xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd">

<property name="root.dir" value="." />
<property name="project.version" value="4.0.4" overwrite="false" />
<property name="project.version" value="4.0.5" overwrite="false" />

<!-- Pass -D:skip.tests=true to NAnt to skip running tests when building -->
<property name="skip.tests" value="false" overwrite="false" />

<target name="dotnet-restore">
<exec workingdir="${root.dir}/src" program="dotnet">
<arg value="restore" />
<arg value="Iesi.Collections.sln" />
</exec>
<target name="init" description="Initializes build properties">
<property name="project.config" value="debug" overwrite="false" />
<property name="build.name" value="Iesi.Collections-${project.version}-${project.config}" />
<property name="build.dir" value="${root.dir}/build/${build.name}" />
</target>

<target name="dotnet-build" depends="dotnet-restore">
<target name="build"
depends="init nuget.set-properties"
description="Builds Iesi.Collections in the current configuration">

<exec workingdir="${root.dir}/src" program="dotnet">
<arg value="build" />
<arg value="-c" />
<arg value="${project.config}" />
<arg value="/p:PackageOutputPath=&quot;${path::get-full-path(nuget.nupackages.dir)}&quot;" />
<arg value="Iesi.Collections.sln" />
</exec>
</target>

<target name="set-project-configuration">
<property name="project.config" value="debug" overwrite="false" />
<property name="build.name" value="Iesi.Collections-${project.version}-${project.config}" />
<property name="build.dir" value="${root.dir}/build/${build.name}" />
<property name="tools.dir" value="${root.dir}/Tools"/>
</target>

<target name="init"
depends="set-project-configuration"
description="Initializes build properties" />

<target name="build"
depends="init dotnet-build"
description="Builds Iesi.Collections in the current configuration" />

<target name="run-tests" description="Run NUnitLite tests">
<exec program="${test.file}">
<arg value="--result=test-results.xml;format=nunit2" />
Expand All @@ -60,43 +48,12 @@
<call target="run-tests" />
<property name="test.file" value="${tests.basedir}/net461/Iesi.Collections.Test.exe" />
<call target="run-tests" />
<property name="test.file" value="${tests.basedir}/netcoreapp1.0/Iesi.Collections.Test.dll" />
<property name="test.file" value="${tests.basedir}/netcoreapp3.1/Iesi.Collections.Test.dll" />
<call target="run-core-tests" />
</target>

<target name="binaries" depends="init">
<call target="build" />
</target>

<target name="sources">
<property name="source.tmpdir" value="${build.dir}/tmp-src" />
<copy todir="${source.tmpdir}">
<fileset>
<!-- copy all of the Iesi.Collections source -->
<include name="src/Iesi*/**" />
<include name="src/*.*" />
<include name="*.build" />
<include name="LICENSE.txt" />
<include name="readme.html" />
<!-- exclude ReSharper stuff -->
<exclude name="**/_ReSharper*/**" />
<exclude name="**/*.resharperoptions" />
<exclude name="**/*resharper*" />
<!-- exclude VS.NET stuff -->
<exclude name="**/*.suo" />
<exclude name="**/*.user" />
<exclude name="**/bin/**" />
<exclude name="**/obj/**" />
</fileset>
</copy>
</target>

<target name="sources-zip" depends="init sources">
<zip zipfile="${build.dir}/Iesi.Collections-${project.version}-src.zip">
<fileset basedir="${source.tmpdir}">
<include name="**/*" />
</fileset>
</zip>
<target name="sources-zip" depends="init">
<exec program="git" commandline="archive HEAD --format zip --output &quot;${build.dir}/Iesi.Collections-${project.version}-src.zip&quot;"/>
</target>

<target name="binaries-zip" depends="init bin-pack">
Expand All @@ -107,7 +64,7 @@
</zip>
</target>

<target name="bin-pack" depends="init binaries">
<target name="bin-pack" depends="init build">
<property name="bin-pack.tmpdir" value="${build.dir}/tmp-bin" />
<property name="bin-pack.bins" value="${bin-pack.tmpdir}/Bins" />
<property name="bin-pack.tests" value="${bin-pack.tmpdir}/Tests" />
Expand All @@ -130,11 +87,11 @@
</copy>
</target>

<target name="package" depends="init binaries test sources-zip binaries-zip" description="Creates files for the General Available Release on SourceForge">
<target name="package" depends="init build test sources-zip binaries-zip" description="Creates files for the General Available Release on SourceForge">
<echo message="Created a '${project.config}' package in ${build.dir}" />
</target>

<target name="release" depends="init binaries binaries-zip sources-zip" description="Creates files for the partial (Alpha-Beta-Candidate) Release on SourceForge">
<target name="release" depends="init build binaries-zip sources-zip" description="Creates files for the partial (Alpha-Beta-Candidate) Release on SourceForge">
<echo message="Created a '${project.config}' package in ${build.dir}" />
</target>

Expand All @@ -148,63 +105,56 @@
</target>

<target name="nuget.set-properties">
<property name="nuget.nupackages.relative-dir" value="nuget_gallery" />
<property name="nuget.workingdir" value="${build.dir}/tmp_nugetdeploy" />
<property name="nuget.nupackages.dir" value="${build.dir}/${nuget.nupackages.relative-dir}" />
<property name="nuget.nupackages.dir" value="${build.dir}/nuget_gallery" />
<property name="nuget.nupackages.pushbatfile" value="${nuget.nupackages.dir}/NuGetPush.bat" />
</target>

<target name="nuget" depends="init binaries nuget.set-properties" description="Creates files for the release on nuget gallery.">
<mkdir dir="${nuget.nupackages.dir}" />
<move todir="${nuget.nupackages.dir}">
<fileset basedir="${root.dir}/src/Iesi.Collections/bin/${project.config}">
<include name="*.nupkg" />
</fileset>
</move>
</target>

<target name="download-nuget" depends="init">
<get
src="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
dest="${tools.dir}/nuget.exe"
usetimestamp="true"
/>
<target name="nugetpushbat" depends="init build"
description="Creates files for the release on nuget gallery.">

<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
<exclude name="${nuget.nupackages.dir}/*.symbols.nupkg"/>
</items>
</in>
<do>
<echo message="dotnet nuget push -s https://nuget.org/ ${path::get-file-name(filename)} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.symbols.nupkg"/>
</items>
</in>
<do>
<echo message="nuget push -source https://nuget.smbsrc.net/ ${path::get-file-name(filename)} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>

<target name="nugetpush" depends="init build"
description="Push packages on nuget gallery.">
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<exec workingdir="${nuget.nupackages.dir}" program="dotnet">
<arg value="nuget" />
<arg value="push" />
<arg value="-s" />
<arg value="https://nuget.org" />
<arg value="${filename}" />
</exec>
</do>
</foreach>
</target>

<target name="nugetpushbat" depends="init binaries download-nuget nuget.set-properties nuget"
description="Creates files for the release on nuget gallery.">

<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>

<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename" >
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<echo message="nuget push ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>

<target name="nugetpush" depends="init binaries download-nuget nuget.set-properties nuget"
description="Push packages on nuget gallery.">
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
<arg value="push" />
<arg value="${filename}" />
</exec>
</do>
</foreach>
</target>

</project>
6 changes: 1 addition & 5 deletions src/Iesi.Collections.Test/Iesi.Collections.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net40;net461</TargetFrameworks>
<TargetFrameworks>net40;net461;netcoreapp3.1</TargetFrameworks>
<Company>NHibernate community</Company>
<Description>The Unit Tests for Iesi.Collections.</Description>
<OutputType>exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="NUnitLite" Version="3.6.1" />
Expand Down
1 change: 1 addition & 0 deletions src/Iesi.Collections.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{46EEA13E-9366-4A18-AC82-C0F4C516A301}"
ProjectSection(SolutionItems) = preProject
..\LICENSE.txt = ..\LICENSE.txt
..\default.build = ..\default.build
EndProjectSection
EndProject
Global
Expand Down
18 changes: 14 additions & 4 deletions src/Iesi.Collections/Iesi.Collections.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard1.3;net40;net461</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard1.3;netstandard2.0;net40;net461</TargetFrameworks>
<Company>NHibernate community</Company>
<Summary>Additional implementations of System.Collections.Generic.ISet&lt;T&gt;.</Summary>
<Description>The System.Collections namespace in the .NET Framework provides a number of collection types that are extremely useful for manipulating data in memory. However, some specialized implementations of ISet are not available. Iesi.Collections 4.0 for .Net 4.0 contains the LinkedHashSet (preserves insertion order), the ReadOnlySet and the SynchronizedSet. The latter two wrap an actual set.</Description>
<Version>4.0.4</Version>
<FileVersion>4.0.4.0</FileVersion>
<Version>4.0.5</Version>
<FileVersion>4.0.5.0</FileVersion>
<AssemblyVersion>4.0.0.4000</AssemblyVersion>
<Copyright>Declaration of code in public domain can be found in comment by Jason Smith at https://www.codeproject.com/Messages/1622667/Re-Licensing-terms.aspx.
Copyright © 2002-2004 by Aidant Systems, Inc., and by Jason Smith.
Expand All @@ -18,9 +18,19 @@ Copyright © 2012 Oskar Berggren</Copyright>
<PackageTags>Collections ISet</PackageTags>
<PackageProjectUrl>https://github.com/nhibernate/iesi.collections</PackageProjectUrl>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Iesi.Collections.xml</DocumentationFile>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<ContinuousIntegrationBuild Condition="'$(TEAMCITY_VERSION)' != ''">true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion teamcity.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

<property name="build.number" value="${CCNetLabel}" if="${property::exists('CCNetLabel')}" />

<target name="clean-configure-test" depends="cleanall init binaries test binaries-zip nuget" />
<target name="clean-configure-test" depends="cleanall init build test binaries-zip" />

</project>

0 comments on commit a21233d

Please sign in to comment.