Skip to content

Commit

Permalink
Build Arcade compatibility improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haplois committed May 21, 2021
1 parent 9e62a25 commit fc34df5
Show file tree
Hide file tree
Showing 58 changed files with 537 additions and 612 deletions.
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="scripts\build\TestFx.props" />
</Project>
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="scripts\build\TestFx.targets" />
</Project>
6 changes: 3 additions & 3 deletions TestFx.sln
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stylecop", "stylecop", "{FE
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "targets", "targets", "{F60B647A-E14C-48AF-9BD6-89F44EB60115}"
ProjectSection(SolutionItems) = preProject
scripts\build\TestFx.Loc.targets = scripts\build\TestFx.Loc.targets
scripts\build\TestFx.Settings.targets = scripts\build\TestFx.Settings.targets
scripts\build\TestFx.Loc.props = scripts\build\TestFx.Loc.props
scripts\build\TestFx.props = scripts\build\TestFx.props
scripts\build\TestFx.targets = scripts\build\TestFx.targets
scripts\build\TestFx.Versions.targets = scripts\build\TestFx.Versions.targets
scripts\build\TestFx.Versions.props = scripts\build\TestFx.Versions.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{BCF525B1-E67F-486D-B091-06A8BB8A2793}"
Expand Down
17 changes: 17 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"tools": {
"vs": {
"version": "16.0",
"components": [
"Microsoft.Net.Component.4.5.2.TargetingPack",
"Microsoft.VisualStudio.Windows.Build",
"Microsoft.VisualStudio.Component.VSSDK"
]
},
"vswhere": "2.5.2"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21264.2",
"Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21264.2"
}
}
12 changes: 6 additions & 6 deletions samples/FxExtensibility/FxExtensibility.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TestFxRoot Condition=" '$(TestFxRoot)' == '' ">..\..\</TestFxRoot>
</PropertyGroup>
<Import Project="$(TestFxRoot)scripts\build\TestFx.Settings.targets" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -15,7 +12,9 @@
<AssemblyName>MSTest.Extensibility.Samples</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
Expand All @@ -40,10 +39,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(TestFxRoot)src\TestFramework\MSTest.Core\MSTest.Core.csproj">
<ProjectReference Include="$(RepoRoot)src\TestFramework\MSTest.Core\MSTest.Core.csproj">
<Project>{7252d9e3-267d-442c-96bc-c73aef3241d6}</Project>
<Name>MSTest.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(TestFxRoot)scripts\build\TestFx.targets" />

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
58 changes: 26 additions & 32 deletions scripts/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ function Perform-Restore {

$nuget = Locate-NuGet
$nugetConfig = Locate-NuGetConfig
$toolset = Locate-Toolset

$toolset = ".\scripts\Toolset\tools.proj"
if ($TFB_ClearPackageCache) {
Write-Log "Clearing local package cache..."
& $nuget locals all -clear
Expand All @@ -145,27 +144,7 @@ function Perform-Restore {
Write-Log "Starting toolset restore..."
Write-Verbose "$nuget restore -verbosity normal -nonInteractive -configFile $nugetConfig $toolset"
& $nuget restore -verbosity normal -nonInteractive -configFile $nugetConfig $toolset

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}

Write-Verbose "Locating MSBuild install path..."
$msbuildPath = Locate-MSBuildPath
Write-Verbose "MSBuild install path: $msbuildPath"

Write-Verbose "Starting solution restore..."
foreach ($solution in $TFB_Solutions) {
$solutionPath = Locate-Item -relativePath $solution

Write-Verbose "$nuget restore -msbuildPath $msbuildPath -verbosity normal -nonInteractive -configFile $nugetConfig $solutionPath"
& $nuget restore -msbuildPath $msbuildPath -verbosity normal -nonInteractive -configFile $nugetConfig $solutionPath
}

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}

if ($lastExitCode -ne 0) {
throw "The restore failed with an exit code of '$lastExitCode'."
}
Expand Down Expand Up @@ -194,22 +173,37 @@ function Perform-Build {
}
}

Invoke-Build -solution "TestFx.sln"
Invoke-MSBuild -solution "TestFx.sln"

Write-Log "Perform-Build: Completed. {$(Get-ElapsedTime($timer))}"
}

function Invoke-Build([string] $solution, $hasVsixExtension = "false") {
function Invoke-MSBuild([string]$solution, $buildTarget = $Target, $hasVsixExtension = "false", [switch]$NoRestore) {
$msbuild = Locate-MSBuild -hasVsixExtension $hasVsixExtension
$solutionPath = Locate-Item -relativePath $solution
$solutionDir = [System.IO.Path]::GetDirectoryName($solutionPath)
$solutionSummaryLog = Join-Path -path $solutionDir -childPath "msbuild.log"
$solutionWarningLog = Join-Path -path $solutionDir -childPath "msbuild.wrn"
$solutionFailureLog = Join-Path -path $solutionDir -childPath "msbuild.err"

Write-Log " Building $solution..."
Write-Verbose "$msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath /bl /m"
& $msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath /bl /m
$logsDir = Get-LogsPath

$fileName = [System.IO.Path]::GetFileNameWithoutExtension($solution)
$binLog = Join-Path -path $logsDir -childPath "$fileName.$buildTarget.binlog"

$restore = "True"
if($NoRestore) {
$restore = "False"
}

$argument = @("-t:$buildTarget",
"-p:Configuration=$configuration",
"-v:m",
"-p:IsLocalizedBuild=$TFB_IsLocalizedBuild",
"-p:UpdateXlf=$TFB_UpdateXlf",
"-p:BuildVersion=$TFB_BuildVersion",
"-restore:$restore",
"`"$solutionPath`"",
"-bl:`"$binLog`"",
"-m")

Write-Log " $buildTarget`: $solution..."
& "$msbuild" $argument;

if ($lastExitCode -ne 0) {
throw "Build failed with an exit code of '$lastExitCode'."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(ResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(ResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
</Target>

<!-- Generate xlf files from Resources.resx for shared resources by using command Build.cmd -uxlf -->
<Target Name="CreateLocalizeXLFShared" Condition=" '$(UpdateXlf)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(LocResourceFile.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe update -Resx %(ResxResources.Identity) -Xlf $(SharedResourceDirectory)\xlf\%(ResxResources.Filename).xlf" />
</Target>

<!-- Generate language specific resx files from the xlf files -->
<Target Name="CreateLocalizeResx" Condition=" '$(IsLocalizedBuild)' == 'true' ">
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(ResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<ItemGroup>
<EmbeddedResource Include="$(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx" />
</ItemGroup>
Expand All @@ -62,7 +62,7 @@
<CreateItem Include="@(ResxResources)" AdditionalMetadata="Language=%(ResxLang.Identity)">
<Output ItemName="LocResourceFile" TaskParameter="Include"/>
</CreateItem>
<Exec Command="$(TestFxPackagesRoot)fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<Exec Command="$(NuGetPackageRoot)\fmdev.xlftool\$(FmDevXlfToolVersion)\tools\xlftool.exe writeTarget -Xlf $(SharedResourceDirectory)\xlf\%(LocResourceFile.Filename).%(LocResourceFile.Language).xlf -Resx $(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx -verbose" />
<ItemGroup>
<EmbeddedResource Include="$(ResourceDirectory)\%(LocResourceFile.Filename).%(LocResourceFile.Language).resx" />
</ItemGroup>
Expand All @@ -71,7 +71,7 @@
<!-- Localization for documentation files. -->
<Target Name="CopyLocalizedXmls" BeforeTargets="BeforeBuild" Condition=" '$(LocDocumentationSubPath)' != ''">
<PropertyGroup>
<_SourcePath>$(TestFxPackagesRoot)MSTest.Internal.TestFx.Localized.Documentation\$(MsTestInternalTestFxLocalizedDocumentationVersion)\contentFiles\any\any\$(LocDocumentationSubPath)</_SourcePath>
<_SourcePath>$(NuGetPackageRoot)\MSTest.Internal.TestFx.Localized.Documentation\$(MsTestInternalTestFxLocalizedDocumentationVersion)\contentFiles\any\any\$(LocDocumentationSubPath)</_SourcePath>
</PropertyGroup>
<ItemGroup>
<_LocalizedFiles Include="$(_SourcePath)\**\*.*" />
Expand All @@ -80,9 +80,17 @@
<Copy SourceFiles="@(_LocalizedFiles)" DestinationFiles="@(_LocalizedFiles->'$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)')" Condition="Exists('$(_SourcePath)')" />
</Target>

<Target Name ="CopyStaticResourcesToOutput">
<Target Name="CopyStaticResourcesToOutput">
<!-- Until we have a process of converting to/from loc friendly file formats like resx files, the already localized vsixlangpacks are checked in and packaged in the vsix.-->
<!-- If we have new vsix projects before we have a process setup, they would not contain localized descriptive infromation until the above process is setup.-->
<Exec Command="xcopy /Y /I /S /E $(ProjectDir)Resources $(OutDir)localize" Condition="Exists('$(ProjectDir)Resources')" />
<Copy SourceFiles="$(ProjectDir)Resources"
DestinationFolder="$(OutDir)localize"
SkipUnchangedFiles="True" OverwriteReadOnlyFiles="True" Retries="3" RetryDelayMilliseconds="500"
UseHardlinksIfPossible="False" UseSymboliclinksIfPossible="False" ErrorIfLinkFails="True"

Condition="Exists('$(ProjectDir)Resources')">

<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
</Project>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TestFxRoot Condition=" '$(TestFxRoot)' == '' ">..\..\</TestFxRoot>
<RepoRoot Condition=" '$(RepoRoot)' == '' ">$(MSBuildThisFileDirectory)..\..\</RepoRoot>
<IncludeMicrosoftCommon Condition=" '$(IncludeMicrosoftCommon)' == '' ">true</IncludeMicrosoftCommon>
<ArtifactsBinDir Condition=" '$(ArtifactsBinDir)' == '' ">$(RepoRoot)artifacts\$(Configuration)\</ArtifactsBinDir>
<IsLocalizationEnabled Condition=" '$(UpdateXlf)' == 'true' or '$(IsLocalizedBuild)' == 'true' ">true</IsLocalizationEnabled>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props') and $(FrameworkIdentifier) != 'NetCore' and $(IncludeMicrosoftCommon) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)TestFx.Versions.targets" />
<Import Project="$(MSBuildThisFileDirectory)TestFx.Versions.props" />

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -20,8 +19,8 @@
<PublicSign Condition=" '$(IsLocalizedBuild)' == '' or '$(IsLocalizedBuild)' != 'true'">true</PublicSign>
<!-- Temporarily turning on Delay signing for Localized builds because publickey = true is not passed on to the assembler to create resource assmblies.-->
<DelaySign Condition=" '$(IsLocalizedBuild)' == 'true' ">true</DelaySign>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<IntermediatePath Condition=" '$(IntermediatePath)' == '' ">$(TestFxRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\obj\</IntermediatePath>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(RepoRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<IntermediatePath Condition=" '$(IntermediatePath)' == '' ">$(RepoRoot)artifacts\$(Configuration)\$(MSBuildProjectName)\obj\</IntermediatePath>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
21 changes: 5 additions & 16 deletions scripts/build/TestFx.targets
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" Condition=" '$(TargetFrameworkProfile)' == 'Profile259' " />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition=" '$(TargetPlatformIdentifier)' == 'UAP' " />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="($(TargetFrameworkProfile) == '' or $(TargetFrameworkProfile) != 'Profile259') and $(TargetPlatformIdentifier) != 'UAP' and $(FrameworkIdentifier) != 'NetCore' and $(IncludeMicrosoftCommon) == 'true'"/>

<PropertyGroup>
<TestFxRoot Condition=" '$(TestFxRoot)' == '' ">..\..\</TestFxRoot>
<RepoRoot Condition=" '$(RepoRoot)' == '' ">..\..\</RepoRoot>
<TestFxPackagesRoot>$(TestFxRoot)packages\</TestFxPackagesRoot>
<IsLocalizationEnabled Condition=" '$(UpdateXlf)' == 'true' or '$(IsLocalizedBuild)' == 'true' ">true</IsLocalizationEnabled>
</PropertyGroup>

<!-- Import localization specific Targets if enabled. -->
<Import Project="$(MSBuildThisFileDirectory)TestFx.Loc.targets" Condition=" ('$(IsTest)' == '' or '$(IsTest)' == 'false') and '$(IsLocalizationEnabled)' == 'true' "/>
<Import Project="$(MSBuildThisFileDirectory)TestFx.Loc.props" Condition=" ('$(IsTest)' == '' or '$(IsTest)' == 'false') and '$(IsLocalizationEnabled)' == 'true' "/>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)key.snk">
Expand All @@ -23,13 +12,13 @@

<!-- StyleCop settings. -->
<ItemGroup Condition=" '$(ShouldEnableStyleCop)' != 'false' and '$(IsVsixProj)' != 'true'">
<AdditionalFiles Include="$(TestFxRoot)scripts\build\stylecop.json">
<AdditionalFiles Include="$(RepoRoot)scripts\build\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>

<Analyzer Include="$(TestFxPackagesRoot)StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\Newtonsoft.Json.dll" />
<Analyzer Include="$(TestFxPackagesRoot)StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="$(TestFxPackagesRoot)StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="$(NuGetPackageRoot)\StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\Newtonsoft.Json.dll" />
<Analyzer Include="$(NuGetPackageRoot)\StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="$(NuGetPackageRoot)\StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>

<!-- Signing and Localization. -->
Expand Down

0 comments on commit fc34df5

Please sign in to comment.