diff options
33 files changed, 237 insertions, 221 deletions
diff --git a/Directory.Build.props b/Directory.Build.props index 419c6cb50..86a068481 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ <Project> - <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition=" '$(ArcadeBuild)' == 'true' " /> + <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(MonoBuild)' == ''" /> <PropertyGroup> <IsPackable>false</IsPackable> </PropertyGroup> diff --git a/Directory.Build.targets b/Directory.Build.targets index d11d6a117..e149bf138 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,11 +1,5 @@ <Project> - <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition=" '$(ArcadeBuild)' == 'true' " /> - - <!-- Map the Arcade "Test" target to the "VSTest" target used by "dotnet test" --> - <Target Name="Test" - Condition=" '$(ArcadeBuild)' == 'true' And '$(DisableArcadeTestFramework)' == 'true' "> - <MSBuild Projects="$(MSBuildProjectFile)" Targets="VSTest" /> - </Target> + <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(MonoBuild)' == ''" /> <Target Name="VSTestIfTestProject"> <CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" /> diff --git a/build.cmd b/build.cmd new file mode 100644 index 000000000..675fdf83f --- /dev/null +++ b/build.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*" diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..8477d5af8 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +"$scriptroot/eng/common/build.sh" --build --restore $@ diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml index 48b71a149..74a442c31 100644 --- a/eng/azure-pipelines.yml +++ b/eng/azure-pipelines.yml @@ -11,12 +11,12 @@ variables: - name: _BuildConfig value: Release - name: _BuildArgs - value: /p:ArcadeBuild=true + value: - name: _DotNetArtifactsCategory value: .NETCore - ${{ if eq(variables.officialBuild, 'true') }}: - name: _BuildArgs - value: ${{ format('{0} /p:OfficialBuildId=$(Build.BuildNumber) /p:Test=false', variables['_BuildArgs']) }} + value: ${{ format('{0} /p:OfficialBuildId=$(Build.BuildNumber) /p:Test=false /p:IntegrationTest=false', variables['_BuildArgs']) }} # Provide HelixApiAccessToken for telemetry - group: DotNet-HelixApi-Access @@ -31,7 +31,7 @@ stages: helixRepo: mono/linker enablePublishUsingPipelines: true enablePublishBuildArtifacts: true # publish build logs to pipeline storage - # enablePublishTestResults + enablePublishTestResults: true enablePublishBuildAssets: true # generate build manifests and publish to BAR in internal builds enableMicrobuild: true # only affects internal builds @@ -64,6 +64,7 @@ stages: submodules: true - script: eng\common\cibuild.cmd -projects $(Build.SourcesDirectory)\illink.sln -configuration $(_BuildConfig) $(_BuildArgs) $(_PublishArgs) + -integrationTest -warnAsError "$false" -nodeReuse "$false" # https://github.com/Microsoft/vstest/issues/1503 env: @@ -84,6 +85,7 @@ stages: submodules: true - script: eng/common/cibuild.sh --projects $(Build.SourcesDirectory)/illink.sln --configuration $(_BuildConfig) $(_BuildArgs) + --integrationTest --warnAsError false --nodeReuse false # https://github.com/Microsoft/vstest/issues/1503 env: @@ -117,6 +119,7 @@ stages: submodules: true - script: eng/common/cibuild.sh --projects $(Build.SourcesDirectory)/illink.sln --configuration $(_BuildConfig) $(_BuildArgs) + --integrationTest --warnAsError false --nodeReuse false # https://github.com/Microsoft/vstest/issues/1503 env: diff --git a/eng/ilasm.ilproj b/eng/ilasm.ilproj index 0e2dc0816..97db3594b 100644 --- a/eng/ilasm.ilproj +++ b/eng/ilasm.ilproj @@ -3,9 +3,6 @@ <!-- This project exists solely to restore ilasm for use in the test project. --> - <!-- Get version number of ilasm package --> - <Import Condition=" '$(ArcadeBuild)' != 'true' " Project="$(MSBuildThisFileDirectory)Versions.props" /> - <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup> diff --git a/external/Mono.Cecil.overrides b/external/Mono.Cecil.overrides index d49a1bef8..e4819f27c 100644 --- a/external/Mono.Cecil.overrides +++ b/external/Mono.Cecil.overrides @@ -10,7 +10,7 @@ <PublicSign>true</PublicSign> </PropertyGroup> - <PropertyGroup Condition=" '$(ArcadeBuild)' == 'true' "> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <!-- Work around https://github.com/dotnet/arcade/issues/2321. This disables arcade's selection of AssemblyOriginatorKeyFile based on the diff --git a/global.json b/global.json index 9764c6abe..378b925ce 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,9 @@ { "tools": { - "dotnet": "3.0.101" + "dotnet": "3.0.101", + "runtimes": { + "dotnet": [ "3.0.0" ] + } }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20105.2", diff --git a/illink.sln b/illink.sln index 0275f5526..3a0216dd4 100644 --- a/illink.sln +++ b/illink.sln @@ -19,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker.Tests.Cases", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker.Tests.Cases.Expectations", "test\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj", "{2C26601F-3E2F-45B9-A02F-58EE9296E19E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.Tasks.Tests", "test\ILLink.Tasks.Tests\ILLink.Tasks.Tests.csproj", "{10249F19-1B72-4087-AF7F-C95B7672B204}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.Tasks.IntegrationTests", "test\ILLink.Tasks.IntegrationTests\ILLink.Tasks.IntegrationTests.csproj", "{10249F19-1B72-4087-AF7F-C95B7672B204}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "analyzer", "analyzer", "{AA0569FB-73E9-4B42-9A19-714BB1229DAE}" EndProject @@ -59,18 +59,18 @@ Global {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x64.Build.0 = Release|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = Release|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = illink_Debug|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = illink_Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = illink_Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = illink_Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = illink_Release|Any CPU - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = illink_Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = Debug|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = Release|Any CPU + {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = Release|Any CPU {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Debug|Any CPU.Build.0 = Debug|Any CPU {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -83,42 +83,42 @@ Global {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Release|x64.Build.0 = Release|Any CPU {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Release|x86.ActiveCfg = Release|Any CPU {A7A026C4-DEB4-4EF6-963E-17E7B98A6527}.Release|x86.Build.0 = Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x64.ActiveCfg = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x64.Build.0 = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x86.ActiveCfg = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x86.Build.0 = illink_Debug|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|Any CPU.Build.0 = illink_Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x64.ActiveCfg = illink_Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x64.Build.0 = illink_Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x86.ActiveCfg = illink_Release|Any CPU - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x86.Build.0 = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x64.ActiveCfg = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x64.Build.0 = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x86.ActiveCfg = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x86.Build.0 = illink_Debug|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|Any CPU.Build.0 = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x64.ActiveCfg = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x64.Build.0 = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x86.ActiveCfg = illink_Release|Any CPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x86.Build.0 = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x64.ActiveCfg = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x64.Build.0 = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x86.ActiveCfg = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x86.Build.0 = illink_Debug|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|Any CPU.Build.0 = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x64.ActiveCfg = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x64.Build.0 = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x86.ActiveCfg = illink_Release|Any CPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x86.Build.0 = illink_Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x64.ActiveCfg = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x64.Build.0 = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x86.ActiveCfg = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Debug|x86.Build.0 = Debug|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|Any CPU.Build.0 = Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x64.ActiveCfg = Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x64.Build.0 = Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x86.ActiveCfg = Release|Any CPU + {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}.Release|x86.Build.0 = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x64.Build.0 = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|x86.Build.0 = Debug|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|Any CPU.Build.0 = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x64.ActiveCfg = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x64.Build.0 = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x86.ActiveCfg = Release|Any CPU + {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Release|x86.Build.0 = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x64.ActiveCfg = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x64.Build.0 = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x86.ActiveCfg = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Debug|x86.Build.0 = Debug|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|Any CPU.Build.0 = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x64.ActiveCfg = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x64.Build.0 = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x86.ActiveCfg = Release|Any CPU + {2C26601F-3E2F-45B9-A02F-58EE9296E19E}.Release|x86.Build.0 = Release|Any CPU {10249F19-1B72-4087-AF7F-C95B7672B204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {10249F19-1B72-4087-AF7F-C95B7672B204}.Debug|Any CPU.Build.0 = Debug|Any CPU {10249F19-1B72-4087-AF7F-C95B7672B204}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -131,18 +131,18 @@ Global {10249F19-1B72-4087-AF7F-C95B7672B204}.Release|x64.Build.0 = Release|Any CPU {10249F19-1B72-4087-AF7F-C95B7672B204}.Release|x86.ActiveCfg = Release|Any CPU {10249F19-1B72-4087-AF7F-C95B7672B204}.Release|x86.Build.0 = Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x64.ActiveCfg = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x64.Build.0 = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x86.ActiveCfg = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x86.Build.0 = illink_Debug|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|Any CPU.Build.0 = illink_Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x64.ActiveCfg = illink_Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x64.Build.0 = illink_Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.ActiveCfg = illink_Release|Any CPU - {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.Build.0 = illink_Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x64.ActiveCfg = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x64.Build.0 = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x86.ActiveCfg = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Debug|x86.Build.0 = Debug|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|Any CPU.Build.0 = Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x64.ActiveCfg = Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x64.Build.0 = Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.ActiveCfg = Release|Any CPU + {96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/monobuild/Makefile b/monobuild/Makefile index c5258a693..aff96e692 100644 --- a/monobuild/Makefile +++ b/monobuild/Makefile @@ -4,10 +4,10 @@ CONFIGURATION = Debug all: build check build: - $(MSBUILD) ../monolinker.sln /restore /p:Configuration=$(CONFIGURATION) + $(MSBUILD) ../monolinker.sln /restore /p:Configuration=$(CONFIGURATION) /p:MonoBuild=true clean: - $(MSBUILD) ../monolinker.sln /t:clean + $(MSBUILD) ../monolinker.sln /p:MonoBuild=true /t:clean check: - $(MSBUILD) ../test/Mono.Linker.Tests/Mono.Linker.Tests.csproj /t:RunTestsOnMono + $(MSBUILD) ../test/Mono.Linker.Tests/Mono.Linker.Tests.csproj /p:MonoBuild=true /t:RunTestsOnMono diff --git a/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/ILLink.Tasks/ILLink.Tasks.csproj index 401706729..73501b1bf 100644 --- a/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -1,17 +1,15 @@ <Project Sdk="Microsoft.NET.Sdk"> - <Import Project="$(MSBuildThisFileDirectory)../../eng/Versions.props" Condition=" '$(ArcadeBuild)' != 'true' " /> <PropertyGroup> - <TargetFrameworks>netcoreapp2.0;net472</TargetFrameworks> - <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks> + <TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks> <EnableDefaultCompileItems>false</EnableDefaultCompileItems> - <BaseOutputPath>bin/</BaseOutputPath> - <PackageOutputPath>$(BaseOutputPath)nupkgs</PackageOutputPath> <IsPackable>true</IsPackable> <PackageLicenseExpression>MIT</PackageLicenseExpression> <Description>MSBuild tasks for running the IL Linker</Description> <!-- Don't include the build output. Instead, we want to include the TargetFramework-specific publish output. --> <IncludeBuildOutput>false</IncludeBuildOutput> + <!-- Suppress NuGet warning for package which sets IncludeBuildOutput=false, see https://github.com/NuGet/Home/issues/8583 --> + <NoWarn>$(NoWarn);NU5128</NoWarn> <!-- We want to package the tasks package together with its transitive dependencies and the linker, without marking them as dependencies in the tasks package. @@ -77,7 +75,7 @@ </Target> <ItemGroup> - <ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" Condition=" '$(TargetFramework)' == 'netcoreapp2.0' " /> + <ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" /> <ProjectReference Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All" /> </ItemGroup> @@ -90,5 +88,6 @@ <PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" PrivateAssets="All" ExcludeAssets="Runtime" /> <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" Condition=" '$(TargetFramework)' == 'net472' " PrivateAssets="All" Publish="True" /> + <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" /> </ItemGroup> </Project> diff --git a/src/ILLink.Tasks/ILLink.Tasks.targets b/src/ILLink.Tasks/ILLink.Tasks.targets index 3a38f07f1..f5024eded 100644 --- a/src/ILLink.Tasks/ILLink.Tasks.targets +++ b/src/ILLink.Tasks/ILLink.Tasks.targets @@ -2,7 +2,7 @@ <PropertyGroup> <_LinkTaskDirectoryRoot>$(MSBuildThisFileDirectory)../tools/</_LinkTaskDirectoryRoot> - <_LinkTaskTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.0</_LinkTaskTFM> + <_LinkTaskTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp3.0</_LinkTaskTFM> <_LinkTaskTFM Condition=" '$(_LinkTaskTFM)' == '' ">net46</_LinkTaskTFM> <_LinkTaskDirectory>$(_LinkTaskDirectoryRoot)$(_LinkTaskTFM)/</_LinkTaskDirectory> <LinkTaskDllPath Condition=" '$(LinkTaskDllPath)' == '' ">$(_LinkTaskDirectory)ILLink.Tasks.dll</LinkTaskDllPath> diff --git a/src/ILLink.Tasks/LinkTask.cs b/src/ILLink.Tasks/LinkTask.cs index 6c9b15a65..f176f32d4 100644 --- a/src/ILLink.Tasks/LinkTask.cs +++ b/src/ILLink.Tasks/LinkTask.cs @@ -111,7 +111,7 @@ namespace ILLink.Tasks var taskDirectory = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location); // The linker always runs on .NET Core, even when using desktop MSBuild to host ILLink.Tasks. - _illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "netcoreapp2.0", "illink.dll"); + _illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "netcoreapp3.0", "illink.dll"); return _illinkPath; } set => _illinkPath = value; diff --git a/src/ILLink.Tasks/Sdk/Sdk.props b/src/ILLink.Tasks/Sdk/Sdk.props index 8c9c2cacd..89633629c 100644 --- a/src/ILLink.Tasks/Sdk/Sdk.props +++ b/src/ILLink.Tasks/Sdk/Sdk.props @@ -13,7 +13,7 @@ Copyright (c) .NET Foundation. All rights reserved. <PropertyGroup> <_ILLinkTasksDirectoryRoot Condition=" '$(_ILLinkTasksDirectoryRoot)' == '' ">$(MSBuildThisFileDirectory)../tools/</_ILLinkTasksDirectoryRoot> - <_ILLinkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.0</_ILLinkTasksTFM> + <_ILLinkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp3.0</_ILLinkTasksTFM> <_ILLinkTasksTFM Condition=" '$(_ILLinkTasksTFM)' == '' ">net472</_ILLinkTasksTFM> <_ILLinkTasksDirectory>$(_ILLinkTasksDirectoryRoot)$(_ILLinkTasksTFM)/</_ILLinkTasksDirectory> <ILLinkTasksAssembly Condition=" '$(ILLinkTasksAssembly)' == '' ">$(_ILLinkTasksDirectory)ILLink.Tasks.dll</ILLinkTasksAssembly> diff --git a/src/analyzer/analyzer.csproj b/src/analyzer/analyzer.csproj index 49b053be8..1d4852b68 100644 --- a/src/analyzer/analyzer.csproj +++ b/src/analyzer/analyzer.csproj @@ -4,26 +4,24 @@ <OutputType>Exe</OutputType> <RootNamespace>LinkerAnalyzer</RootNamespace> <AssemblyName>illinkanalyzer</AssemblyName> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants> - <!-- net46 build is disabled until cecil uses SDK-style projects. --> - <TargetFrameworks>netcoreapp3.0</TargetFrameworks> - <TargetFrameworks Condition="'$(MSBuildRuntimeType)' == 'Core' And '$(OS)' != 'Windows_NT'">netcoreapp3.0</TargetFrameworks> + <TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <TargetFrameworks>net471</TargetFrameworks> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.EndsWith('Debug'))"> + <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols> <Optimize Condition="'$(Optimize)' == ''">false</Optimize> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.EndsWith('Release'))"> + <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <Optimize Condition="'$(Optimize)' == ''">true</Optimize> </PropertyGroup> @@ -32,4 +30,8 @@ </ProjectReference> </ItemGroup> + <ItemGroup Condition="'$(MonoBuild)' == ''"> + <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" /> + </ItemGroup> + </Project>
\ No newline at end of file diff --git a/src/linker/Mono.Linker.csproj b/src/linker/Mono.Linker.csproj index 62dd3aecd..71cb832a4 100644 --- a/src/linker/Mono.Linker.csproj +++ b/src/linker/Mono.Linker.csproj @@ -5,37 +5,35 @@ <RootNamespace>Mono</RootNamespace> <Copyright>(C) 2006, Jb Evain</Copyright> <Version>0.2.0.0</Version> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> <LangVersion>latest</LangVersion> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <AssemblyName>illink</AssemblyName> <Description>IL Linker</Description> <DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants> - <!-- net46 build is disabled until cecil uses SDK-style projects. --> - <TargetFrameworks>netcoreapp2.0</TargetFrameworks> - <TargetFrameworks Condition="'$(MSBuildRuntimeType)' == 'Core' And '$(OS)' != 'Windows_NT'">netcoreapp2.0</TargetFrameworks> + <TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <AssemblyName>monolinker</AssemblyName> <AssemblyTitle>Mono.Linker</AssemblyTitle> <Description>Mono CIL Linker</Description> <TargetFrameworks>net471</TargetFrameworks> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.EndsWith('Debug'))"> + <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <DefineConstants>$(DefineConstants);DEBUG</DefineConstants> <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols> <Optimize Condition="'$(Optimize)' == ''">false</Optimize> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.EndsWith('Release'))"> + <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <Optimize Condition="'$(Optimize)' == ''">true</Optimize> </PropertyGroup> - <ItemGroup Condition="$(Configuration.StartsWith('illink'))"> + <ItemGroup Condition="'$(MonoBuild)' == ''"> <Compile Remove="Linker\I18nAssemblies.cs" /> <Compile Remove="Linker\XApiReader.cs" /> <Compile Remove="Linker.Steps\LoadI18nAssemblies.cs" /> @@ -48,7 +46,11 @@ <ProjectReference Include="..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj" /> </ItemGroup> - <ItemGroup Condition="!$(Configuration.StartsWith('illink'))"> + <ItemGroup Condition="'$(MonoBuild)' == ''"> + <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" /> + </ItemGroup> + + <ItemGroup Condition="'$(MonoBuild)' != ''"> <ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" /> </ItemGroup> diff --git a/test/ILLink.Tasks.Tests/CommandRunner.cs b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs index bc790c09a..bc790c09a 100644 --- a/test/ILLink.Tasks.Tests/CommandRunner.cs +++ b/test/ILLink.Tasks.IntegrationTests/CommandRunner.cs diff --git a/test/ILLink.Tasks.Tests/HelloWorldTest.cs b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs index b9d1528c5..63b0990c9 100644 --- a/test/ILLink.Tasks.Tests/HelloWorldTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/HelloWorldTest.cs @@ -17,8 +17,8 @@ namespace ILLink.Tests public string SetupProject() { - string projectRoot = "helloworld"; - string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + string projectRoot = CreateTestFolder("helloworld"); + string csproj = Path.Combine(projectRoot, $"helloworld.csproj"); if (File.Exists(csproj)) { LogMessage ($"using existing project {csproj}"); @@ -38,9 +38,10 @@ namespace ILLink.Tests AddLinkerReference(csproj); + AddNuGetConfig(projectRoot); + return csproj; } - } public class HelloWorldTest : IntegrationTestBase, IClassFixture<HelloWorldFixture> diff --git a/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj b/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj new file mode 100644 index 000000000..81a44f503 --- /dev/null +++ b/test/ILLink.Tasks.IntegrationTests/ILLink.Tasks.IntegrationTests.csproj @@ -0,0 +1,20 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.0</TargetFramework> + </PropertyGroup> + + <ItemGroup> + <Content Remove="MusicStoreReflection.xml" /> + </ItemGroup> + + <ItemGroup> + <EmbeddedResource Include="MusicStoreReflection.xml" LogicalName="MusicStoreReflection.xml" /> + </ItemGroup> + + <ItemGroup> + <!-- tell xunit to log diagnostic messages --> + <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" /> + </ItemGroup> + +</Project> diff --git a/test/ILLink.Tasks.Tests/IntegrationTestBase.cs b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs index 3027f4fca..d65990895 100644 --- a/test/ILLink.Tasks.Tests/IntegrationTestBase.cs +++ b/test/ILLink.Tasks.IntegrationTests/IntegrationTestBase.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Xml.Linq; using Xunit; @@ -32,6 +33,27 @@ namespace ILLink.Tests CommandHelper = new CommandHelper (logger); } + protected void AddNuGetConfig(string projectRoot) + { + var nugetConfig = Path.Combine(projectRoot, "NuGet.config"); + var xdoc = new XDocument(); + var configuration = new XElement("configuration"); + var packageSources = new XElement("packageSources"); + packageSources.Add(new XElement("add", + new XAttribute("key", "dotnet-core"), + new XAttribute("value", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"))); + packageSources.Add(new XElement("add", + new XAttribute("key", "local linker feed"), + new XAttribute("value", TestContext.PackageSource))); + + configuration.Add(packageSources); + xdoc.Add(configuration); + + using (var fs = new FileStream(nugetConfig, FileMode.Create)) { + xdoc.Save(fs); + } + } + protected void AddLinkerReference(string csproj) { var xdoc = XDocument.Load(csproj); @@ -59,6 +81,25 @@ namespace ILLink.Tests } } + protected string CreateTestFolder(string projectName) + { + string tempFolder = Path.GetFullPath(Path.Combine("tests-temp", projectName)); + Directory.CreateDirectory(tempFolder); + + // write empty Directory.Build.props and Directory.Build.targets to disable accidental import of arcade from repo root + File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.props"), "<Project></Project>"); + File.WriteAllText(Path.Combine(tempFolder, "Directory.Build.targets"), "<Project></Project>"); + + return Path.Combine(tempFolder, projectName); + } + + protected void WriteEmbeddedResource(string resourceName, string destination) + { + var assembly = Assembly.GetExecutingAssembly(); + var resourceStream = assembly.GetManifestResourceStream(resourceName); + resourceStream.CopyTo(File.Create(destination)); + } + static void AddLinkerRoots(string csproj, List<string> rootFiles) { var xdoc = XDocument.Load(csproj); diff --git a/test/ILLink.Tasks.Tests/Loggers.cs b/test/ILLink.Tasks.IntegrationTests/Loggers.cs index 083cb2769..083cb2769 100644 --- a/test/ILLink.Tasks.Tests/Loggers.cs +++ b/test/ILLink.Tasks.IntegrationTests/Loggers.cs diff --git a/test/ILLink.Tasks.Tests/MusicStoreReflection.xml b/test/ILLink.Tasks.IntegrationTests/MusicStoreReflection.xml index e35f91155..e35f91155 100755 --- a/test/ILLink.Tasks.Tests/MusicStoreReflection.xml +++ b/test/ILLink.Tasks.IntegrationTests/MusicStoreReflection.xml diff --git a/test/ILLink.Tasks.Tests/MusicStoreTest.cs b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs index 0ae386cf2..cbb78b62b 100644 --- a/test/ILLink.Tasks.Tests/MusicStoreTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/MusicStoreTest.cs @@ -13,7 +13,6 @@ namespace ILLink.Tests public static List<string> rootFiles = new List<string> { "MusicStoreReflection.xml" }; private static string gitRepo = "http://github.com/aspnet/JitBench"; - private static string repoName = "JitBench"; // Revision can also be a branch name. We generally // want to ensure that we are able to link the latest @@ -57,6 +56,7 @@ namespace ILLink.Tests string SetupProject() { int ret; + string repoName = CreateTestFolder("MusicStore"); string demoRoot = Path.Combine(repoName, Path.Combine("src", "MusicStore")); string csproj = Path.Combine(demoRoot, "MusicStore.csproj"); @@ -86,8 +86,10 @@ namespace ILLink.Tests Assert.True(false); } - // Copy root files into the project directory - CopyRootFiles(demoRoot); + // Write root files into the project directory + foreach (var rf in rootFiles) { + WriteEmbeddedResource(rf, Path.Combine(demoRoot, rf)); + } // This is necessary because JitBench comes with a // NuGet.Config that has a <clear /> line, preventing @@ -175,13 +177,6 @@ namespace ILLink.Tests return GetDotnetToolPath(dotnetDir); } - static void CopyRootFiles(string demoRoot) - { - foreach (var rf in rootFiles) { - File.Copy(rf, Path.Combine(demoRoot, rf)); - } - } - private void AddLocalNugetFeedAfterClear(string nugetConfig) { string localPackagePath = Path.GetFullPath(TestContext.PackageSource); @@ -211,14 +206,14 @@ namespace ILLink.Tests // context.DotnetToolPath = ObtainSDK(context.TestBin, repoName); } - [Fact] + //[Fact] // https://github.com/aspnet/JitBench/issues/96 public void RunMusicStoreStandalone() { string executablePath = BuildAndLink(MusicStoreFixture.csproj, MusicStoreFixture.rootFiles, MusicStoreFixture.VersionPublishArgs, selfContained: true); CheckOutput(executablePath, selfContained: true); } - [Fact] + //[Fact] // https://github.com/aspnet/JitBench/issues/96 public void RunMusicStorePortable() { Dictionary<string, string> extraPublishArgs = new Dictionary<string, string>(MusicStoreFixture.VersionPublishArgs); diff --git a/test/ILLink.Tasks.Tests/TestContext.cs b/test/ILLink.Tasks.IntegrationTests/TestContext.cs index 593e5ec95..d8f7f0b6d 100644 --- a/test/ILLink.Tasks.Tests/TestContext.cs +++ b/test/ILLink.Tasks.IntegrationTests/TestContext.cs @@ -69,9 +69,14 @@ namespace ILLink.Tests var testBin = Path.Combine(Environment.CurrentDirectory, "..", ".."); var repoRoot = Path.GetFullPath(Path.Combine(testBin, "..", "..", "..")); + // We want to build and link integration projects in the + // release configuration. + Configuration = "Release"; + TestBin = testBin; + // Locate task package var packageName = "ILLink.Tasks"; - var packageSource = Path.Combine(repoRoot, "src", "ILLink.Tasks", "bin", "nupkgs"); + var packageSource = Path.Combine(repoRoot, "artifacts", "packages", Configuration, "Shipping"); var tasksPackages = Directory.GetFiles(packageSource) .Where(p => Path.GetExtension(p) == ".nupkg") .Select(p => Path.GetFileNameWithoutExtension(p)) @@ -110,10 +115,6 @@ namespace ILLink.Tests { RuntimeIdentifier = "osx.10.13-x64"; } - // We want to build and link integration projects in the - // release configuration. - Configuration = "Release"; - TestBin = testBin; } } } diff --git a/test/ILLink.Tasks.Tests/WebApiTest.cs b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs index 2cdd3495a..334468167 100644 --- a/test/ILLink.Tasks.Tests/WebApiTest.cs +++ b/test/ILLink.Tasks.IntegrationTests/WebApiTest.cs @@ -16,8 +16,8 @@ namespace ILLink.Tests public string SetupProject() { - string projectRoot = "webapi"; - string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + string projectRoot = CreateTestFolder("webapi"); + string csproj = Path.Combine(projectRoot, $"webapi.csproj"); if (File.Exists(csproj)) { LogMessage($"using existing project {csproj}"); @@ -39,6 +39,8 @@ namespace ILLink.Tests AddLinkerReference(csproj); + AddNuGetConfig(projectRoot); + return csproj; } diff --git a/test/ILLink.Tasks.Tests/xunit.runner.json b/test/ILLink.Tasks.IntegrationTests/xunit.runner.json index 40be06652..40be06652 100644 --- a/test/ILLink.Tasks.Tests/xunit.runner.json +++ b/test/ILLink.Tasks.IntegrationTests/xunit.runner.json diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj deleted file mode 100644 index 5ce4708cc..000000000 --- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj +++ /dev/null @@ -1,33 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netcoreapp3.0</TargetFramework> - - <IsPackable>false</IsPackable> - <IsTestProject>false</IsTestProject> - </PropertyGroup> - - <ItemGroup> - <Content Include="MusicStoreReflection.xml"> - <!-- It doesn't seem to get copied unless we specify this - explicitly. --> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - </ItemGroup> - - <Target Name="CopyNuGetConfig" AfterTargets="AfterBuild"> - <Copy SourceFiles="nuget/NuGet.config" DestinationFolder="$(OutDir)" /> - </Target> - - <ItemGroup> - <!-- tell xunit to log diagnostic messages --> - <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" /> - </ItemGroup> - - <ItemGroup> - <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.1" /> - <PackageReference Include="xunit" Version="2.4.0" /> - <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> - </ItemGroup> - -</Project> diff --git a/test/ILLink.Tasks.Tests/nuget/NuGet.config b/test/ILLink.Tasks.Tests/nuget/NuGet.config deleted file mode 100644 index 1954d0af0..000000000 --- a/test/ILLink.Tasks.Tests/nuget/NuGet.config +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <packageSources> - <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> - <!-- When the tests are run from the repo's test bin directory, - this NuGet.config should be read to find the local package - directory. The path is relative to the test <baseoutputpath>/<config>/<tfm> - directory. --> - <add key="local linker packages" value="../../../../../src/ILLink.Tasks/bin/nupkgs" /> - </packageSources> -</configuration> diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj index db2718da3..a7faebae5 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj +++ b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj @@ -1,13 +1,13 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <TargetFramework>net471</TargetFramework> </PropertyGroup> diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index f1b5db37a..852a4a5bb 100644 --- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -6,18 +6,16 @@ <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <LangVersion>8.0</LangVersion> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <TargetFramework>netcoreapp3.0</TargetFramework> - <ILLinkBuild>true</ILLinkBuild> <DefineConstants>$(DefineConstants);ILLINK</DefineConstants> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <TargetFramework>net471</TargetFramework> - <ILLinkBuild>false</ILLinkBuild> </PropertyGroup> <ItemGroup> @@ -131,7 +129,7 @@ <EmbeddedResource Include="LinkXml\CanPreserveExcludedFeatureCom.xml" /> </ItemGroup> - <ItemGroup Condition="$(ILLinkBuild)"> + <ItemGroup Condition="'$(MonoBuild)' == ''"> <PackageReference Include="System.Security.Permissions" Version="4.5.0" /> <PackageReference Include="NUnit" Version="3.6.1" /> <PackageReference Include="NUnit.ConsoleRunner" Version="3.6.1" /> diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj index 3653c8e6b..236ff33ab 100644 --- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj +++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj @@ -1,26 +1,20 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project> + <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <PropertyGroup> - <IsTestProject>true</IsTestProject> - <Configurations>Debug;Release;illink_Debug;illink_Release</Configurations> + <Configurations>Debug;Release</Configurations> </PropertyGroup> - <PropertyGroup Condition="$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' == ''"> <TargetFramework>netcoreapp3.0</TargetFramework> - <ILLinkBuild>true</ILLinkBuild> <DefineConstants>$(DefineConstants);ILLINK</DefineConstants> - <DefineConstants Condition="'$(Configuration)' == 'illink_Debug'">$(DefineConstants);DEBUG</DefineConstants> + <DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants> <!-- Simulate https://github.com/dotnet/sdk/pull/2073 until it ships. --> <DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);NETCOREAPP</DefineConstants> - - <DefineConstants Condition="'$(ArcadeBuild)' == 'true'">$(DefineConstants);ARCADE</DefineConstants> - <!-- Arcade's custom test imports assume that we are using xunit. --> - <DisableArcadeTestFramework Condition="'$(ArcadeBuild)' == 'true'">true</DisableArcadeTestFramework> </PropertyGroup> - <PropertyGroup Condition="!$(Configuration.StartsWith('illink'))"> + <PropertyGroup Condition="'$(MonoBuild)' != ''"> <TargetFramework>net471</TargetFramework> - <ILLinkBuild>false</ILLinkBuild> </PropertyGroup> <ItemGroup> @@ -36,7 +30,7 @@ <ProjectReference Include="..\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj" /> </ItemGroup> - <ItemGroup Condition="$(ILLinkBuild)"> + <ItemGroup Condition="'$(MonoBuild)' == ''"> <PackageReference Include="System.CodeDom" Version="4.5.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" /> @@ -48,29 +42,37 @@ <PackageReference Include="System.Threading.AccessControl" Version="4.5.0" /> </ItemGroup> - <Target Name="PrepareTools" BeforeTargets="Build" Condition="$(ILLinkBuild)"> + <Target Name="PrepareTools" BeforeTargets="Build" Condition="'$(MonoBuild)' == ''"> <!-- Restore ilasm using ilasm.ilproj. Restore must be done separately from copy with a different set of input properties, to force MSBuild to re-evaluate using new props and targets from the restored package. --> <PropertyGroup> <IlasmProject>$(MSBuildThisFileDirectory)../../eng/ilasm.ilproj</IlasmProject> - <IlasmDir Condition="'$(ArcadeBuild)' == 'true'">$(ArtifactsDir)tools</IlasmDir> - <IlasmDir Condition="'$(ArcadeBuild)' != 'true'">$(MSBuildThisFileDirectory)$(BaseIntermediateOutputPath)tools</IlasmDir> + <IlasmDir>$(ArtifactsDir)tools</IlasmDir> </PropertyGroup> <MSBuild Projects="$(IlasmProject)" Targets="Restore" Properties="BaseIntermediateOutputPath=$(IlasmDir)" /> <MSBuild Projects="$(IlasmProject)" Targets="CopyILAsmTool" Properties="BaseIntermediateOutputPath=$(IlasmDir);__BuildPhase=Copy" /> </Target> - <ItemGroup Condition="!$(ILLinkBuild)"> + <ItemGroup Condition="'$(MonoBuild)' != ''"> <ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" /> <PackageReference Include="NUnit" Version="3.10.0" /> <PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" /> </ItemGroup> - <Target Name="RunTestsOnMono" Condition="!$(ILLinkBuild)"> + <Target Name="RunTestsOnMono" Condition="'$(MonoBuild)' != ''"> <Exec Command="mono $(PkgNUnit_ConsoleRunner)/tools/nunit3-console.exe --result=TestResults.xml $(OutputPath)Mono.Linker.Tests.dll" /> </Target> + <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> + + <!-- Arcade's custom test imports assume that we are using xunit. --> + <!-- Map the Arcade "Test" target to the "VSTest" target used by "dotnet test" --> + <Target Name="Test" + Condition="'$(MonoBuild)' == ''"> + <MSBuild Projects="$(MSBuildProjectFile)" Targets="VSTest" /> + </Target> + </Project> diff --git a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs index b29dd2d43..fbb516153 100644 --- a/test/Mono.Linker.Tests/TestCases/TestDatabase.cs +++ b/test/Mono.Linker.Tests/TestCases/TestDatabase.cs @@ -193,19 +193,11 @@ namespace Mono.Linker.Tests.TestCases static void GetDirectoryPaths(out string rootSourceDirectory, out string testCaseAssemblyPath, [CallerFilePath] string thisFile = null) { -#if ILLINK -#if DEBUG - var configDirectoryName = "illink_Debug"; -#else - var configDirectoryName = "illink_Release"; -#endif -#else #if DEBUG var configDirectoryName = "Debug"; #else var configDirectoryName = "Release"; #endif -#endif #if NETCOREAPP3_0 var tfm = "netcoreapp3.0"; @@ -218,19 +210,12 @@ namespace Mono.Linker.Tests.TestCases #if ILLINK // Deterministic builds sanitize source paths, so CallerFilePathAttribute gives an incorrect path. // Instead, get the testcase dll based on the working directory of the test runner. -#if ARCADE + // working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm> var artifactsBinDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", ".."); rootSourceDirectory = Path.GetFullPath (Path.Combine (artifactsBinDir, "..", "..", "test", "Mono.Linker.Tests.Cases")); testCaseAssemblyPath = Path.GetFullPath (Path.Combine (artifactsBinDir, "Mono.Linker.Tests.Cases", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); #else - // working directory is test/Mono.Linker.Tests/bin/<config>/<tfm> - var testDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", ".."); - rootSourceDirectory = Path.GetFullPath (Path.Combine (testDir, "Mono.Linker.Tests.Cases")); - testCaseAssemblyPath = Path.GetFullPath (Path.Combine (rootSourceDirectory, "bin", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); -#endif // ARCADE - -#else var thisDirectory = Path.GetDirectoryName (thisFile); rootSourceDirectory = Path.GetFullPath (Path.Combine (thisDirectory, "..", "..", "Mono.Linker.Tests.Cases")); testCaseAssemblyPath = Path.GetFullPath (Path.Combine (rootSourceDirectory, "bin", configDirectoryName, tfm, "Mono.Linker.Tests.Cases.dll")); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs index 14ec56d9e..a35c10787 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs @@ -68,13 +68,10 @@ namespace Mono.Linker.Tests.TestCasesRunner { { #if ILLINK var extension = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? ".exe" : ""; -#if ARCADE + // working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm> var toolsDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "..", "tools"); -#else - // working directory is test/Mono.Linker.Tests/bin/<config>/<tfm> - var toolsDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "obj", "tools"); -#endif // ARCADE + var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, "ilasm", $"ilasm{extension}")).ToNPath (); if (ilasmPath.FileExists ()) return ilasmPath; |