Skip to content

Commit 01effc3

Browse files
maca88fredericDelaporte
authored andcommitted
Upgrade AsyncGenerator to 0.17.1 (#2182)
* Use .NET Core for async generation * Add packages.csproj for AsyncGenerator to avoid using nuget
1 parent 2c53c34 commit 01effc3

23 files changed

+192
-193
lines changed

ReleaseProcedure.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ These are the tasks typically needed to create an official NHibernate release.
44
that is about to happen (as these will show in the milestone).
55

66
* Create a draft release in Github with GitReleaseManager. If you have used
7-
the NHibernate build menu, it should be available in Tools\gitreleasemanage.x.x.x\
7+
the NHibernate build menu, it should be available in Tools\gitreleasemanager\x.x.x\
88
(change x.x.x by its current version in tools).
99
By example:
1010

11-
Tools\gitreleasemanager.0.7.0\tools\GitReleaseManager.exe create -o nhibernate -r nhibernate-core -m 5.1 -u username -p password
11+
Tools\gitreleasemanager\0.7.0\tools\GitReleaseManager.exe create -o nhibernate -r nhibernate-core -m 5.1 -u username -p password
1212

1313
(Adjust the -m milestone parameter above, and add "-c branchname" if
1414
releasing another branch than master)

ShowBuildMenu.bat

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
@echo off
22
pushd %~dp0
33

4+
for /f "tokens=* USEBACKQ delims= " %%i in (`findstr /c:"NUnit.Console" "Tools\packages.csproj"`) do set NUNIT_VERSION=%%i
5+
set NUNIT_VERSION=%NUNIT_VERSION:~51%
6+
set NUNIT_VERSION=%NUNIT_VERSION:" />=%
7+
48
set NANT="%~dp0Tools\nant\bin\NAnt.exe" -t:net-4.0
59
set BUILD_TOOL_PATH=%~dp0Tools\BuildTool\bin\BuildTool.dll
610
set BUILDTOOL=dotnet %BUILD_TOOL_PATH%
711
set AVAILABLE_CONFIGURATIONS=%~dp0available-test-configurations
812
set CURRENT_CONFIGURATION=%~dp0current-test-configuration
9-
set NUNIT="%~dp0Tools\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe"
13+
set NUNIT="%~dp0Tools\NUnit.ConsoleRunner\%NUNIT_VERSION%\tools\nunit3-console.exe"
1014

1115
if not exist %BUILD_TOOL_PATH% (
1216
pushd %~dp0Tools\BuildTool
@@ -184,6 +188,7 @@ SET NUNITPLATFORM=
184188
goto test-run
185189

186190
:test-run
191+
%NANT% common.tools-restore
187192
start "nunit3-console" cmd /K %NUNIT% %NUNITPLATFORM% --agents=1 NHibernate.nunit
188193
goto main-menu
189194

ShowBuildMenu.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ LIB_FILES2=""
1212
CURRENT_CONFIGURATION="./current-test-configuration"
1313
OPTION=0
1414
async_generator_path=""
15+
async_generator_version=""
1516

1617
if [ ! -f $BUILD_TOOL_PATH ]
1718
then
@@ -177,11 +178,11 @@ testRun(){
177178
}
178179

179180
generateAsync(){
180-
dotnet msbuild /t:Restore ./src/NHibernate.sln
181+
dotnet restore ./src/NHibernate.sln
181182

182183
getAsyncGeneratorPath
183184
cd src
184-
mono ../"$async_generator_path"
185+
dotnet ../"$async_generator_path"
185186
cd ..
186187

187188
mainMenu
@@ -195,27 +196,15 @@ getAsyncGeneratorPath(){
195196

196197
cd Tools
197198

198-
if [ ! -f nuget.exe ]
199-
then
200-
wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
201-
fi
202-
203-
async_generator_path="CSharpAsyncGenerator.CommandLine.$(cat packages.config | grep id=\"CSharpAsyncGenerator.CommandLine | cut -d\" -f4)/tools"
199+
async_generator_version="$(cat packages.csproj | grep Include=\"CSharpAsyncGenerator.CommandLine | cut -d\" -f4)"
200+
async_generator_path="csharpasyncgenerator.commandline/$async_generator_version/tools"
204201

205202
if [ ! -d $async_generator_path ]
206203
then
207-
mono nuget.exe install
204+
dotnet restore "./packages.csproj" --packages .
208205
fi
209206

210-
if [ ! -f $async_generator_path/SQLitePCLRaw.core.dll ]
211-
then
212-
# This "hidden" dependency causes a failure under some Mono setup, add it explicitly
213-
mono nuget.exe install SQLitePCLRaw.core -Version 1.0.0
214-
cp SQLitePCLRaw.core.1.0.0/lib/net45/SQLitePCLRaw.core.dll $async_generator_path/
215-
fi
216-
217-
async_generator_path="Tools/$async_generator_path/AsyncGenerator.CommandLine.exe"
218-
207+
async_generator_path="Tools/$async_generator_path/netcoreapp2.1/AsyncGenerator.CommandLine.dll"
219208
cd ..
220209
}
221210

Tools/.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
nuget.exe
2-
NUnit.*
3-
vswhere.*
4-
CSharpAsyncGenerator.CommandLine.*
5-
gitreleasemanager.*
6-
SQLitePCLRaw.core.*
2+
nunit.*
3+
vswhere/
4+
csharpasyncgenerator.commandline/
5+
gitreleasemanager/
6+
obj/
7+
microsoft.*

Tools/actual_msbuild.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@echo off
22

3-
for /f "usebackq tokens=*" %%i in (`%~dp0\vswhere.2.1.4\tools\vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
3+
for /f "usebackq tokens=*" %%i in (`%~dp0\vswhere\2.1.4\tools\vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
44
set InstallDir=%%i
55
)
66

Tools/packages.config

Lines changed: 0 additions & 13 deletions
This file was deleted.

Tools/packages.csproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Compile Remove="**\*" />
9+
<EmbeddedResource Remove="**\*" />
10+
<None Remove="**\*" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="CSharpAsyncGenerator.CommandLine" Version="0.17.1" />
15+
<PackageReference Include="vswhere" Version="2.1.4" />
16+
<PackageReference Include="NUnit.Console" Version="3.10.0" />
17+
<PackageReference Include="GitReleaseManager" Version="0.7.0" />
18+
</ItemGroup>
19+
20+
</Project>

build-common/common.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
/>
4040
</target>
4141

42-
<target name="common.nuget-restore" depends="common.init common.download-nuget">
43-
<exec basedir="${tools.dir}" workingdir="${root.dir}/Tools" program="NuGet.exe">
44-
<arg value="install" />
45-
</exec>
42+
<target name="common.tools-restore" depends="common.init">
43+
<exec workingdir="${root.dir}/Tools" program="dotnet" verbose="true">
44+
<arg line="restore ./packages.csproj --packages ." />
45+
</exec>
4646
</target>
4747

4848
</project>

default.build

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,32 @@
4646
</exec>
4747
</target>
4848

49-
<target name="solution-restore" depends="common.nuget-restore">
49+
<target name="solution-restore" depends="common.tools-restore">
5050
<exec program="dotnet" verbose="true">
5151
<arg value="msbuild" />
5252
<arg value="/t:Restore" />
5353
<arg value="${root.dir}/src/NHibernate.sln" />
5454
</exec>
5555
</target>
5656

57-
<target name="get-nuget-package-path" depends="common.nuget-restore">
57+
<target name="get-tool-info" depends="common.tools-restore">
5858
<xmlpeek
59-
file="${tools.dir}/packages.config"
60-
xpath="/packages/package[@id = '${nuget-package-id}']/@version"
61-
property="nuget-package-version" />
62-
<property name="nuget-package-path" value="${tools.dir}/${nuget-package-id}.${nuget-package-version}/" />
59+
file="${tools.dir}/packages.csproj"
60+
xpath="/Project/ItemGroup/PackageReference[@Include = '${tool.id}']/@Version"
61+
property="tool.version" />
62+
<property name="tool.path" value="${tools.dir}/${tool.id}/${tool.version}/" />
6363
</target>
6464

6565
<target name="find-async-generator-console">
66-
<property name="nuget-package-id" value="CSharpAsyncGenerator.CommandLine" />
67-
<call target="get-nuget-package-path" />
68-
<property name="async-generator-console" value="${nuget-package-path}/tools/AsyncGenerator.CommandLine.exe" />
66+
<property name="tool.id" value="CSharpAsyncGenerator.CommandLine" />
67+
<call target="get-tool-info" />
68+
<property name="async-generator-console" value="${tool.path}tools/netcoreapp2.1/AsyncGenerator.CommandLine.dll" />
6969
</target>
7070

71-
<target name="generate-async" depends="common.nuget-restore solution-restore find-async-generator-console">
72-
<exec
73-
workingdir="${root.dir}/src"
74-
program="${async-generator-console}" />
71+
<target name="generate-async" depends="solution-restore find-async-generator-console">
72+
<exec workingdir="${root.dir}/src" program="dotnet" verbose="true">
73+
<arg line=".${async-generator-console}" />
74+
</exec>
7575
</target>
7676

7777
<target name="put-connection-settings-into-defined-app-config">
@@ -150,9 +150,9 @@
150150
</target>
151151

152152
<target name="find-nunit">
153-
<property name="nuget-package-id" value="NUnit.ConsoleRunner" />
154-
<call target="get-nuget-package-path" />
155-
<property name="nunit-console" value="${nuget-package-path}/tools/nunit3-console.exe" />
153+
<property name="tool.id" value="NUnit.Console" />
154+
<call target="get-tool-info" />
155+
<property name="nunit-console" value="${tools.dir}/NUnit.ConsoleRunner/${tool.version}/tools/nunit3-console.exe" />
156156
</target>
157157

158158
<target name="run-tests" depends="find-nunit" description="Run NUnit tests">

doc/documentation.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<property name="root.dir" value=".." />
1010
<include buildfile="${root.dir}/build-common/common.xml" />
1111

12-
<target name="init" depends="common.init common.nuget-restore">
12+
<target name="init" depends="common.init common.tools-restore">
1313
<property name="doc.out.dir" value="${build.dir}/doc" />
1414
<property name="doc.help2.out.dir" value="${doc.out.dir}/help2" />
1515
<property name="doc.chm.out.dir" value="${doc.out.dir}" />

0 commit comments

Comments
 (0)