Per-Slice NuGet artifacts in CI (#9019)

* Depends on #9017 to be merged first to avoid failures of the CI pipeline

We currently aggregate the various universal flavors into a UniversalBuild job, which must be completed before NuGet package based jobs. This means we may be waiting to start debug-flavor NuGet CLI tests until the longer release is also finished. It also adds a bit of extra latency.

This removes the step, and instead relies on only the flavors needed. In doing so we also move NuGet header layout to package creation time, instead of depending on a single job to also upload header artifacts. We no longer rely on MSBuild to patch react, so this can now be done without building.

This also partitions pipeline artifacts per-slice, to let NuGet init tests only download a single platform.

* remove changefile

* Change files

* PublishToolDuringBuild non-x64

* Add Microsoft.ReactNative.Managed.CodeGen.UnitTests

* MSBuild condition fix

* Typed slices with isolated artifacts

* yaml

* yaml

* convertToJson

* ARM casing in matrix names

* Update UniversalTest download path

* yaml

* Move PackDesktop to agent pool
This commit is contained in:
Nick Gerleman 2021-11-02 12:17:45 -07:00 коммит произвёл GitHub
Родитель 27bf6651f8
Коммит 9440c876b2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
22 изменённых файлов: 443 добавлений и 366 удалений

Просмотреть файл

@ -73,10 +73,10 @@ parameters:
projectType: app
additionalInitArguments: --useHermes
runWack: true
- Name: ARM64ReleaseCsHermes
- Name: Arm64ReleaseCsHermes
language: cs
configuration: Release
platform: arm64
platform: ARM64
projectType: app
additionalInitArguments: --useHermes
additionalRunArguments: --no-deploy
@ -87,13 +87,13 @@ parameters:
projectType: app
additionalInitArguments: --useHermes
runWack: true
- Name: X64DebugCppNuget
- Name: X86DebugCppNuget
language: cpp
configuration: Debug
platform: x86
projectType: app
useNuGet: true
- Name: X64DebugCsNuget
- Name: X86DebugCsNuget
language: cs
configuration: Debug
platform: x86
@ -168,10 +168,10 @@ parameters:
projectType: app
additionalInitArguments: --useHermes
runWack: true
- Name: ARM64ReleaseCsHermes
- Name: Arm64ReleaseCsHermes
language: cs
configuration: Release
platform: arm64
platform: ARM64
projectType: app
additionalInitArguments: --useHermes
additionalRunArguments: --no-deploy
@ -182,13 +182,13 @@ parameters:
projectType: app
additionalInitArguments: --useHermes
runWack: true
- Name: X64DebugCppNuget
- Name: X86DebugCppNuget
language: cpp
configuration: Debug
platform: x86
projectType: app
useNuGet: true
- Name: X64DebugCsNuget
- Name: X86DebugCsNuget
language: cs
configuration: Debug
platform: x86
@ -197,25 +197,25 @@ parameters:
- Name: Arm64DebugCpp
language: cpp
configuration: Debug
platform: arm64
platform: ARM64
projectType: app
additionalRunArguments: --no-deploy # We don't have Arm agents
- Name: Arm64DebugCs
language: cs
configuration: Debug
platform: arm64
platform: ARM64
projectType: app
additionalRunArguments: --no-deploy # We don't have Arm agents
- Name: Arm64ReleaseCpp
language: cpp
configuration: Release
platform: arm64
platform: ARM64
projectType: app
additionalRunArguments: --no-deploy # We don't have Arm agents
- Name: Arm64ReleaseCs
language: cs
configuration: Release
platform: arm64
platform: ARM64
projectType: app
additionalRunArguments: --no-deploy # We don't have Arm agents
- Name: X86ReleaseCpp
@ -262,7 +262,7 @@ jobs:
${{ if eq(matrix.useNuGet, true) }}:
dependsOn:
- UniversalBuild
- UniversalBuild${{ matrix.platform }}${{ matrix.configuration }}
variables:
- template: ../variables/windows.yml

Просмотреть файл

@ -32,10 +32,10 @@ parameters:
BuildPlatform: x86
- Name: Arm64Debug
BuildConfiguration: Debug
BuildPlatform: arm64
BuildPlatform: ARM64
- Name: Arm64Release
BuildConfiguration: Release
BuildPlatform: arm64
BuildPlatform: ARM64
- Name: X86Release
BuildConfiguration: Release
BuildPlatform: x86
@ -113,7 +113,7 @@ jobs:
- template: ../templates/discover-google-test-adapter.yml
- ${{ if ne(matrix.BuildPlatform, 'arm64') }}:
- ${{ if ne(matrix.BuildPlatform, 'ARM64') }}:
- task: VSTest@2
displayName: Run Desktop Unit Tests
timeoutInMinutes: 5 # Set smaller timeout , due to hangs
@ -135,7 +135,7 @@ jobs:
failOnMinTestsNotRun: true
# Suspected debug assert in TestRunner hanging tests randomly. Run only on Release for now.
- ${{ if and(eq(matrix.BuildConfiguration, 'Release'), ne(variables['Desktop.IntegrationTests.SkipRNTester'], true), ne(matrix.BuildPlatform, 'arm64')) }}:
- ${{ if and(eq(matrix.BuildConfiguration, 'Release'), ne(variables['Desktop.IntegrationTests.SkipRNTester'], true), ne(matrix.BuildPlatform, 'ARM64')) }}:
- task: PowerShell@2
displayName: Set up test servers
inputs:
@ -167,9 +167,9 @@ jobs:
- template: ../templates/stop-packagers.yml
- template: ../templates/publish-build-artifacts-for-nuget.yml
- template: ../templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindows
artifactName: Desktop
buildPlatform: ${{ matrix.BuildPlatform }}
buildConfiguration: ${{ matrix.BuildConfiguration }}
contents: |

Просмотреть файл

@ -24,7 +24,7 @@ parameters:
- BuildEnvironment: Continuous
Matrix:
- Name: Arm64Debug
BuildPlatform: arm64
BuildPlatform: ARM64
BuildConfiguration: Debug
DeployOptions: --no-deploy # We don't have Arm agents
UseHermes: false

Просмотреть файл

@ -7,9 +7,9 @@ jobs:
dependsOn:
- DesktopX64Release
- DesktopX86Debug
- UniversalBuild # Needed to have artifacts uploaded from LayoutHeaders
pool:
vmImage: windows-2019
name: ${{ variables['AgentPool.Small'] }}
demands: ${{ variables['AgentImage'] }}
timeoutInMinutes: 30 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
steps:
@ -20,15 +20,22 @@ jobs:
submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch
- template: ../templates/yarn-install.yml
- task: NuGetToolInstaller@1
inputs:
versionSpec: ">=5.8.0"
- template: ../templates/prep-and-pack-nuget.yml
parameters:
artifactName: Desktop
packDesktop: true
packMicrosoftReactNative: false
packMicrosoftReactNativeCxx: false
packMicrosoftReactNativeManaged: false
packMicrosoftReactNativeManagedCodeGen: false
slices: '("x64.Release", "x86.Debug")'
slices:
- platform: x64
configuration: Release
- platform: x86
configuration: Debug

Просмотреть файл

@ -58,42 +58,27 @@ jobs:
msbuildArguments: /p:UseWinUI3=true
warnAsError: false # Disable warn as error until we fix #8312
- task: CopyFiles@2
displayName: Copy NuGet artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)\vnext\scripts
targetFolder: $(Build.StagingDirectory)
contents: Microsoft.ReactNative.ProjectReunion.nuspec
- task: CopyFiles@2
displayName: Copy NuGet artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)/vnext/target/${{ matrix.BuildPlatform }}/${{ matrix.BuildConfiguration}}
targetFolder: $(Build.StagingDirectory)/reunion/${{ matrix.BuildPlatform }}/${{ matrix.BuildConfiguration}}
- template: ../templates/publish-build-artifacts.yml
parameters:
artifactName: ProjectReunion
buildPlatform: ${{ matrix.BuildPlatform }}
buildConfiguration: ${{ matrix.BuildConfiguration}}
contents: |
Microsoft.ReactNative\**
Microsoft.ReactNative.ProjectReunion\**
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: Project Reunion"
inputs:
artifactName: ReactWindows
pathToPublish: $(Build.StagingDirectory)
parallel: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: ">=5.8.0"
- template: ../templates/prep-and-pack-nuget.yml
parameters:
artifactName: ProjectReunion
packDesktop: false
packMicrosoftReactNative: false
packMicrosoftReactNativeCxx: false
packMicrosoftReactNativeManaged: false
packMicrosoftReactNativeManagedCodeGen: false
packMicrosoftReactNativeProjectReunion: true
slices: '("x64.Release")'
slices:
- platform: x64
configuration: Release
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: Project Reunion NuGet"

Просмотреть файл

@ -30,11 +30,11 @@ parameters:
DeployOption:
- Name: Arm64Debug
BuildConfiguration: Debug
BuildPlatform: arm64
BuildPlatform: ARM64
DeployOption: --no-deploy # We don't have Arm agents
- Name: Arm64Release
BuildConfiguration: Release
BuildPlatform: arm64
BuildPlatform: ARM64
DeployOption: --no-deploy # We don't have Arm agents
- Name: X64Debug
BuildConfiguration: Debug

Просмотреть файл

@ -13,30 +13,28 @@
- Name: X64Release
BuildConfiguration: Release
BuildPlatform: x64
CreateApiDocs: true
- Name: X86Debug
BuildConfiguration: Debug
BuildPlatform: x86
LayoutHeaders: true
CreateApiDocs: true
- BuildEnvironment: Continuous
Matrix:
- Name: Arm64Debug
BuildConfiguration: Debug
BuildPlatform: arm64
BuildPlatform: ARM64
- Name: Arm64Release
BuildConfiguration: Release
BuildPlatform: arm64
BuildPlatform: ARM64
- Name: X64Debug
BuildConfiguration: Debug
BuildPlatform: x64
- Name: X64Release
BuildConfiguration: Release
BuildPlatform: x64
CreateApiDocs: true
- Name: X86Debug
BuildConfiguration: Debug
BuildPlatform: x86
LayoutHeaders: true
CreateApiDocs: true
- Name: X86Release
BuildConfiguration: Release
BuildPlatform: x86
@ -45,7 +43,7 @@
- ${{ each config in parameters.buildMatrix }}:
- ${{ if eq(config.BuildEnvironment, parameters.buildEnvironment) }}:
- ${{ each matrix in config.Matrix }}:
- job: UniversalBuild${{ matrix.Name }}
- job: UniversalBuild${{ matrix.BuildPlatform }}${{ matrix.BuildConfiguration }}
variables:
- template: ../variables/windows.yml
displayName: Universal Build ${{ matrix.Name }}
@ -80,7 +78,7 @@
- powershell: |
$winmd2md_url = "https://github.com/asklar/winmd2md/releases/download/v0.1.13/winmd2md.exe"
Invoke-WebRequest -UseBasicParsing $winmd2md_url -OutFile $env:TEMP\winmd2md.exe
& $env:TEMP\winmd2md.exe /experimental /outputDirectory vnext\target\winmd2md vnext\target\x86\Debug\Microsoft.ReactNative\Microsoft.ReactNative.winmd
& $env:TEMP\winmd2md.exe /experimental /outputDirectory vnext\target\winmd2md vnext\target\x64\Release\Microsoft.ReactNative\Microsoft.ReactNative.winmd
displayName: "Generate WinRT API docs"
- task: PublishBuildArtifacts@1
@ -89,31 +87,34 @@
pathtoPublish: 'vnext\target\winmd2md'
artifactName: 'WinRT API docs - $(Agent.JobName)-$(System.JobAttempt)'
- task: PublishPipelineArtifact@1
displayName: "Publish binaries for testing"
- task: PowerShell@2
displayName: Make AnyCPU Reference Assemblies
inputs:
targetPath: $(Build.SourcesDirectory)/vnext/target/${{ matrix.BuildPlatform }}/${{ matrix.BuildConfiguration }}
artifactName: "Universal-${{ matrix.BuildPlatform }}-${{ matrix.BuildConfiguration }}-fast_${{ matrix.FastBuild }}"
filePath: vnext/Scripts/Tfs/Make-AnyCPU-RefAssemblies.ps1
arguments: -TargetRoot $(Build.SourcesDirectory)\vnext\target -BuildRoot $(Build.SourcesDirectory)\vnext\target
- template: ../templates/publish-build-artifacts-for-nuget.yml
- template: ../templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindows
buildPlatform: ${{ matrix.BuildPlatform }}
buildConfiguration: ${{ matrix.BuildConfiguration }}
layoutHeaders: ${{ matrix.LayoutHeaders }}
contents: |
Microsoft.ReactNative\**
Microsoft.ReactNative.Cxx.UnitTests\**
Microsoft.ReactNative.IntegrationTests\**
Microsoft.ReactNative.ComponentTests\**
Microsoft.ReactNative.Managed\**
Microsoft.ReactNative.Managed.CodeGen\**
- template: ../templates/component-governance.yml
Microsoft.ReactNative.Managed.CodeGen.UnitTests\**
Microsoft.ReactNative.Managed.UnitTests\**
Mso.UnitTests\**
- job: UniversalTest${{ matrix.Name }}
variables:
- template: ../variables/windows.yml
displayName: Universal Test ${{ matrix.Name }}
dependsOn:
- UniversalBuild${{ matrix.Name }}
- UniversalBuild${{ matrix.BuildPlatform }}${{ matrix.BuildConfiguration }}
pool:
name: ${{ variables['AgentPool.Medium'] }}
@ -135,7 +136,7 @@
buildEnvironment: ${{ config.BuildEnvironment }}
- task: PowerShell@2
displayName: "Check if this environment meets the development dependencies"
displayName: Check if this environment meets the development dependencies
inputs:
targetType: filePath
filePath: $(Build.SourcesDirectory)\vnext\Scripts\rnw-dependencies.ps1
@ -152,14 +153,14 @@
verbosityRestore: Detailed # Options: quiet, normal, detailed
- task: DownloadPipelineArtifact@1
displayName: "Download binaries for testing"
displayName: Download "ReactWindows.${{ matrix.buildPlatform }}.${{ matrix.buildConfiguration }}"
inputs:
targetPath: $(Build.SourcesDirectory)/vnext/target/${{ matrix.BuildPlatform }}/${{ matrix.BuildConfiguration }}
artifactName: "Universal-${{ matrix.BuildPlatform }}-${{ matrix.BuildConfiguration }}-fast_${{ matrix.FastBuild }}"
targetPath: $(Build.SourcesDirectory)/vnext/target/${{ matrix.buildPlatform }}/${{ matrix.buildConfiguration }}
artifactName: ReactWindows.${{ matrix.buildPlatform }}.${{ matrix.buildConfiguration }}
- task: BinSkim@3
displayName: "Run Binskim Analysis"
condition: and(succeeded(), eq('${{ matrix.BuildConfiguration }}', 'Release'), eq('${{ matrix.FastBuild }}', 'false'), ne('${{ matrix.BuildPlatform }}', 'arm64'))
displayName: Run Binskim Analysis
condition: and(succeeded(), eq('${{ matrix.BuildConfiguration }}', 'Release'), eq('${{ matrix.FastBuild }}', 'false'), ne('${{ matrix.BuildPlatform }}', 'ARM64'))
inputs:
InputType: 'Basic'
Function: 'analyze'
@ -167,6 +168,8 @@
AnalyzeVerbose: true
toolVersion: 'LatestPreRelease'
- template: ../templates/component-governance.yml
- template: ../templates/discover-google-test-adapter.yml
- task: VSTest@2
@ -188,7 +191,7 @@
vsTestVersion: latest
failOnMinTestsNotRun: true
# Issue #8003 Tracks restoring this test whose condition should be resotred disabled as it times out on releasex64...
# condition: and(succeeded(), not(eq('${{ matrix.BuildPlatform }}', 'arm64')))
# condition: and(succeeded(), not(eq('${{ matrix.BuildPlatform }}', 'ARM64')))
condition: and(succeeded(), eq('${{ matrix.BuildPlatform }}', 'x86'))
- task: VSTest@2
@ -207,7 +210,7 @@
collectDumpOn: onAbortOnly
vsTestVersion: latest
failOnMinTestsNotRun: true
condition: and(succeeded(), not(eq('${{ matrix.BuildPlatform }}', 'arm64')))
condition: and(succeeded(), not(eq('${{ matrix.BuildPlatform }}', 'ARM64')))
- task: VSTest@2
displayName: Run Universal Unit Tests (NetCore)
@ -226,25 +229,3 @@
vsTestVersion: latest
failOnMinTestsNotRun: true
condition: and(succeeded(), eq('${{ matrix.BuildPlatform }}', 'x64'))
# This job is the one that accumulates the spread out build tasks into one dependency
- job: UniversalBuild
displayName: Universal Build 🏗
variables:
- template: ../variables/windows.yml
dependsOn:
- ${{ each config in parameters.buildMatrix }}:
- ${{ if eq(config.BuildEnvironment, parameters.buildEnvironment) }}:
- ${{ each matrix in config.Matrix }}:
- UniversalBuild${{ matrix.Name }}
pool:
vmImage: ubuntu-latest
timeoutInMinutes: 60
cancelTimeoutInMinutes: 5
steps:
- checkout: none
clean: false
- powershell: |
Write-Host "Waited for all Universal Build steps"
displayName: Waiting for all Universal Build steps

Просмотреть файл

@ -182,7 +182,7 @@ jobs:
buildPlatform: $(BuildPlatform)
buildConfiguration: $(BuildConfiguration)
- template: templates/publish-build-artifacts-for-nuget.yml
- template: templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindows
buildPlatform: $(BuildPlatform)
@ -207,17 +207,16 @@ jobs:
BuildPlatform: x86
Arm64Debug:
BuildConfiguration: Debug
BuildPlatform: arm64
BuildPlatform: ARM64
X64Release:
BuildConfiguration: Release
BuildPlatform: x64
LayoutHeaders: true
X86Release:
BuildConfiguration: Release
BuildPlatform: x86
Arm64Release:
BuildConfiguration: Release
BuildPlatform: arm64
BuildPlatform: ARM64
pool:
name: ${{ variables['AgentPool.Large.Publish'] }}
demands: ${{ variables['AgentImage'] }}
@ -239,12 +238,17 @@ jobs:
buildPlatform: $(BuildPlatform)
buildConfiguration: $(BuildConfiguration)
- template: templates/publish-build-artifacts-for-nuget.yml
- task: PowerShell@2
displayName: Make AnyCPU Reference Assemblies
inputs:
filePath: vnext/Scripts/Tfs/Make-AnyCPU-RefAssemblies.ps1
arguments: -TargetRoot $(Build.SourcesDirectory)\vnext\target -BuildRoot $(Build.SourcesDirectory)\vnext\target
- template: templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindows
buildPlatform: $(BuildPlatform)
buildConfiguration: $(BuildConfiguration)
layoutHeaders: eq('true', variables['LayoutHeaders'])
contents: |
Microsoft.ReactNative\**
Microsoft.ReactNative.Managed\**
@ -291,21 +295,13 @@ jobs:
/p:UseWinUI3=true
warnAsError: false # Disable warn as error until we fix #8312
- task: CopyFiles@2
displayName: Copy NuGet artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)/vnext/target/$(BuildPlatform)/$(BuildConfiguration)
targetFolder: $(Build.StagingDirectory)/reunion/$(BuildPlatform)/$(BuildConfiguration)
contents: |
Microsoft.ReactNative\**
Microsoft.ReactNative.ProjectReunion\**
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: ReactWindows"
inputs:
- template: templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindows
pathToPublish: $(Build.StagingDirectory)
parallel: true
buildPlatform: $(BuildPlatform)
buildConfiguration: $(BuildConfiguration)
contents: |
Microsoft.ReactNative.ProjectReunion\**
- template: templates/component-governance.yml
@ -328,7 +324,11 @@ jobs:
demands: ${{ variables['AgentImage'] }}
steps:
- checkout: none
- checkout: self
clean: true
submodules: false
- template: templates/yarn-install.yml
- template: templates/apply-published-version-vars.yml
@ -339,6 +339,7 @@ jobs:
- template: templates/prep-and-pack-nuget.yml
parameters:
artifactName: ReactWindows
publishCommitId: $(publishCommitId)
npmVersion: $(npmVersion)
packMicrosoftReactNativeProjectReunion: true

Просмотреть файл

@ -1,11 +1,12 @@
parameters:
artifactName: ''
publishCommitId: '0'
npmVersion: '0.0.1-pr'
# Note: NuGet pack expects platform-specific file separators ('\' on Windows).
nugetroot: $(System.DefaultWorkingDirectory)\ReactWindows
desktopId: 'OfficeReact.Win32'
microsoftRNId: 'Microsoft.ReactNative'
slices: ''
slices: []
packDesktop: true
packMicrosoftReactNative: true
packMicrosoftReactNativeCxx: true
@ -14,12 +15,59 @@ parameters:
packMicrosoftReactNativeProjectReunion: false
signMicrosoft: false
defaultDesktopSlices:
- platform: x64
configuration: Debug
- platform: x86
configuration: Debug
- platform: ARM64
configuration: Debug
- platform: x64
configuration: Release
- platform: x86
configuration: Release
- platform: ARM64
configuration: Release
defaultMSRNSlices:
- platform: x64
configuration: Release
- platform: x86
configuration: Release
- platform: ARM64
configuration: Release
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download ReactWindows Artifact'
- ${{ if eq(length(parameters.slices), 0) }}:
- powershell: |
Write-Host "##vso[task.setvariable variable=basePlatform]x64"
Write-Host "##vso[task.setvariable variable=baseConfiguration]Release"
displayName: Set base slice to x64.Release
- ${{ else }}:
- powershell: |
Write-Host "##vso[task.setvariable variable=basePlatform]${{ parameters.slices[0].platform }}"
Write-Host "##vso[task.setvariable variable=baseConfiguration]${{ parameters.slices[0].configuration }}"
displayName: Set base slice to ${{ parameters.slices[0].platform }}.${{ parameters.slices[0].configuration }}
- ${{ each slice in parameters.slices }}:
- task: DownloadPipelineArtifact@2
displayName: 'Download ${{ parameters.artifactName }}.${{ slice.platform }}.${{ slice.configuration }} Artifact'
inputs:
artifact: ${{ parameters.artifactName }}.${{ slice.platform }}.${{ slice.configuration }}
path: $(System.DefaultWorkingDirectory)/ReactWindows/${{ slice.platform }}/${{ slice.configuration }}
- task: PowerShell@2
displayName: Copy MSRN Resources to NuGet layout
inputs:
artifact: ReactWindows
path: $(System.DefaultWorkingDirectory)/ReactWindows
filePath: vnext/Scripts/Tfs/Layout-MSRN-Headers.ps1
arguments: -TargetRoot $(System.DefaultWorkingDirectory)/ReactWindows
- ${{ if eq(parameters.packDesktop, true) }}:
- task: PowerShell@2
displayName: Copy Desktop Resources to NuGet layout
inputs:
filePath: vnext/Scripts/Tfs/Layout-Desktop-Headers.ps1
arguments: -TargetRoot $(System.DefaultWorkingDirectory)/ReactWindows
- ${{ if or(eq(parameters.packMicrosoftReactNative, true), eq(parameters.packMicrosoftReactNativeCxx, true), eq(parameters.packMicrosoftReactNativeManaged, true), eq(parameters.packMicrosoftReactNativeManagedCodeGen, true), eq(parameters.packMicrosoftReactNativeProjectReunion, false)) }}:
- powershell: |
@ -31,7 +79,10 @@ steps:
parameters:
packageId: ${{parameters.desktopId}}
packageVersion: ${{parameters.npmVersion}}
slices: ${{ coalesce(parameters.slices, '("x64.Debug", "x86.Debug", "ARM64.Debug", "x64.Release","x86.Release", "ARM64.Release")') }}
${{ if gt(length(parameters.slices), 0) }}:
slices: ${{ parameters.slices }}
${{ else }}:
slices: ${{ parameters.defaultDesktopSlices }}
buildProperties: 'CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}}'
- ${{ if eq(parameters.packMicrosoftReactNative, true) }}:
@ -39,8 +90,11 @@ steps:
parameters:
packageId: Microsoft.ReactNative
packageVersion: ${{parameters.npmVersion}}
slices: ${{ coalesce(parameters.slices, '("x64.Release","x86.Release", "ARM64.Release")') }}
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=Release;baseplatform=x64
${{ if gt(length(parameters.slices), 0) }}:
slices: ${{ parameters.slices }}
${{ else }}:
slices: ${{ parameters.defaultMSRNSlices }}
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=$(baseConfiguration);baseplatform=$(basePlatform)
codesignBinaries: ${{ parameters.signMicrosoft }}
codesignNuget: ${{ parameters.signMicrosoft }}
@ -49,27 +103,19 @@ steps:
parameters:
packageId: Microsoft.ReactNative.Cxx
packageVersion: ${{parameters.npmVersion}}
slices: ''
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=Release;baseplatform=x64
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=$(baseConfiguration);baseplatform=$(basePlatform)
codesignNuget: ${{ parameters.signMicrosoft }}
- ${{ if eq(parameters.packMicrosoftReactNativeManaged, true) }}:
# Since we custom patch the nuget packages for PR valdation
- powershell: |
If (Test-Path -Path $(System.DefaultWorkingDirectory)\ReactWindows\x64\Release\Microsoft.ReactNative.Managed\ref.anycpu\Microsoft.ReactNative.Managed.dll) {
Write-Host Skipping copy of ref to ref.anycpu because it already exists and is already msil
} else {
Write-Host Copying ref to ref.anycpu because it does not yet exist
mkdir $(System.DefaultWorkingDirectory)\ReactWindows\x64\Release\Microsoft.ReactNative.Managed\ref.anycpu
Copy-Item $(System.DefaultWorkingDirectory)\ReactWindows\x64\Release\Microsoft.ReactNative.Managed\ref\Microsoft.ReactNative.Managed.dll -Destination $(System.DefaultWorkingDirectory)\ReactWindows\x64\Release\Microsoft.ReactNative.Managed\ref.anycpu
}
displayName: Copy the x64/release ref assembly to anycpu folder
- template: prep-and-pack-single.yml
parameters:
packageId: Microsoft.ReactNative.Managed
packageVersion: ${{parameters.npmVersion}}
slices: ${{ coalesce(parameters.slices, '("x64.Release","x86.Release", "ARM64.Release")') }}
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=Release;baseplatform=x64
${{ if gt(length(parameters.slices), 0) }}:
slices: ${{ parameters.slices }}
${{ else }}:
slices: ${{ parameters.defaultMSRNSlices }}
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=$(baseConfiguration);baseplatform=$(basePlatform)
codesignBinaries: ${{ parameters.signMicrosoft }}
codesignNuget: ${{ parameters.signMicrosoft }}
@ -78,8 +124,7 @@ steps:
parameters:
packageId: Microsoft.ReactNative.Managed.CodeGen
packageVersion: ${{parameters.npmVersion}}
slices: ''
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=Release;baseplatform=x64
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=$(baseConfiguration);baseplatform=$(basePlatform)
codesignBinaries: ${{ parameters.signMicrosoft }}
codesignNuget: ${{ parameters.signMicrosoft }}
@ -88,7 +133,6 @@ steps:
parameters:
packageId: Microsoft.ReactNative.ProjectReunion
packageVersion: ${{parameters.npmVersion}}
slices: ''
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=Release;baseplatform=x64
buildProperties: CommitId=${{parameters.publishCommitId}};nugetroot=${{parameters.nugetroot}};baseconfiguration=$(baseConfiguration);baseplatform=$(basePlatform)
codesignBinaries: ${{ parameters.signMicrosoft }}
codesignNuget: ${{ parameters.signMicrosoft }}

Просмотреть файл

@ -1,21 +1,32 @@
parameters:
packageId: ''
packageVersion: ''
slices: ''
buildProperties: ''
codesignBinaries: false
codesignNuget: false
- name: packageId
type: string
- name: packageVersion
type: string
- name: slices
type: object
default: []
- name: buildProperties
type: string
default: ''
- name: codesignBinaries
type: boolean
default: false
- name: codesignNuget
type: boolean
default: false
steps:
# Strip down the binaries from NuGet because we may not have built all the flavours.
- task: PowerShell@2
displayName: '${{ parameters.packageId }} - Strip slices from nuspec'
inputs:
targetType: filePath
filePath: $(System.DefaultWorkingDirectory)\ReactWindows\StripAdditionalPlatformsFromNuspec.ps1
arguments: -nuspec $(System.DefaultWorkingDirectory)/ReactWindows/${{parameters.packageId}}.nuspec -outfile $(System.DefaultWorkingDirectory)/ReactWindows/${{parameters.packageId}}.nuspec -slices ${{ parameters.slices }} -debug
condition: and(succeeded(), ne('', '${{ parameters.slices }}'))
- ${{ if gt(length(parameters.slices), 0) }}:
- powershell: |
$slices = ConvertFrom-Json '${{ convertToJson(parameters.slices) }}'
$slicesArg = $slices | % {$_.platform + "." + $_.configuration}
.\StripAdditionalPlatformsFromNuspec.ps1 -nuspec ${{parameters.packageId}}.nuspec -outfile ${{parameters.packageId}}.nuspec -slices $slicesArg -debug
displayName: '${{ parameters.packageId }} - Strip slices from nuspec'
workingDirectory: $(System.DefaultWorkingDirectory)/ReactWindows
- ${{ if eq(parameters.codesignBinaries, true) }}:
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
@ -92,10 +103,11 @@ steps:
}
]
- task: CmdLine@2
- powershell: gci $(System.DefaultWorkingDirectory)/NugetRootFinal
displayName: List files in NugetRootFinal
- script: |
set TestFeed=$(System.DefaultWorkingDirectory)\NugetTestFeed
if NOT EXIST %TestFeed% (mkdir %TestFeed%)
nuget add $(System.DefaultWorkingDirectory)\NugetRootFinal\${{ parameters.packageId }}.${{ parameters.packageVersion }}.nupkg -Source %TestFeed%
displayName: '${{ parameters.packageId }} - Nuget push to local test feed'
inputs:
script: |
set TestFeed=$(System.DefaultWorkingDirectory)\NugetTestFeed
if NOT EXIST %TestFeed% (mkdir %TestFeed%)
nuget add $(System.DefaultWorkingDirectory)\NugetRootFinal\${{ parameters.packageId }}.${{ parameters.packageVersion }}.nupkg -Source %TestFeed%

Просмотреть файл

@ -7,7 +7,7 @@ parameters:
#values:
# - x86
# - x64
# - arm64
# - ARM64
- name: configuration
type: string
# Publish still using runtime matrix

Просмотреть файл

@ -1,29 +0,0 @@
parameters:
artifactName:
contents:
layoutHeaders: false
buildPlatform: x64
buildConfiguration: Debug
steps:
# Prepare headers for NuGet deployment
- task: PowerShell@2
displayName: Copy NuGet header files
inputs:
filePath: vnext/Scripts/Tfs/Layout-Headers.ps1
arguments: -TargetRoot $(Build.StagingDirectory) -BuildRoot $(Build.SourcesDirectory)\vnext\target
condition: ${{ parameters.layoutHeaders }}
- task: CopyFiles@2
displayName: Copy NuGet artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)/vnext/target/${{ parameters.buildPlatform }}/${{ parameters.buildConfiguration }}
targetFolder: $(Build.StagingDirectory)/${{ parameters.buildPlatform }}/${{ parameters.buildConfiguration }}
contents: ${{parameters.contents}}
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: ${{parameters.artifactName}}"
inputs:
artifactName: ${{parameters.artifactName}}
pathToPublish: $(Build.StagingDirectory)
parallel: true

Просмотреть файл

@ -0,0 +1,25 @@
parameters:
- name: artifactName
type: string
- name: contents
type: string
- name: buildPlatform
type: string
default: x64
- name: buildConfiguration
type: string
default: Debug
steps:
- task: CopyFiles@2
displayName: Copy build artifacts to staging
inputs:
sourceFolder: $(Build.SourcesDirectory)/vnext/target/${{ parameters.buildPlatform }}/${{ parameters.buildConfiguration }}
targetFolder: $(Build.StagingDirectory)/NuGet/${{ parameters.artifactName }}/${{ parameters.buildPlatform }}/${{ parameters.buildConfiguration }}
contents: ${{parameters.contents}}
- task: PublishPipelineArtifact@1
displayName: "Publish Artifact: ${{parameters.artifactName}}.${{parameters.buildPlatform}}.${{parameters.buildConfiguration}}"
inputs:
artifactName: ${{parameters.artifactName}}.${{parameters.buildPlatform}}.${{parameters.buildConfiguration}}
targetPath: $(Build.StagingDirectory)/NuGet/${{ parameters.artifactName }}/${{ parameters.buildPlatform }}/${{ parameters.buildConfiguration }}

Просмотреть файл

@ -10,7 +10,7 @@ parameters:
values:
- x86
- x64
- arm64
- ARM64
- name: configuration
type: string
values:
@ -66,9 +66,12 @@ steps:
- ${{ if eq(parameters.useNuGet, true) }}:
- template: prep-and-pack-nuget.yml
parameters:
artifactName: ReactWindows
npmVersion: $(npmVersion)
packDesktop: false
slices: '("${{ parameters.platform }}.${{ parameters.configuration }}")'
slices:
- platform: ${{ parameters.platform }}
configuration: ${{ parameters.configuration }}
- ${{ if eq(parameters.projectType, 'app') }}:
- script: |

Просмотреть файл

@ -5,7 +5,7 @@ parameters:
#values:
# - x86
# - x64
# - arm64
# - ARM64
- name: configuration
type: string
# Publish still using runtime matrix

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Split LayoutHeaders",
"packageName": "react-native-windows",
"email": "ngerlem@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -69,7 +69,7 @@
Name="PublishToolDuringBuild"
DependsOnTargets="Publish"
AfterTargets="Build"
Condition="'$(PublishToolDuringBuild)' == 'true' and '$(Platform)' == 'x64'">
Condition="'$(PublishToolDuringBuild)' == 'true'">
</Target>
<!-- Override -->

Просмотреть файл

@ -23,10 +23,10 @@
<files>
<!-- Support netcore3, uap, net46+, net5, c++ -->
<!-- Use the contents in the target folder since those are built with UseWinUI3, as opposed to the content in $nugetroot$ which -->
<file src="$nugetroot$\reunion\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\netcoreapp3.0\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\reunion\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\uap10.0\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\reunion\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\net46\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\reunion\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x64\native\Microsoft.ReactNative.dll" />
<file src="$nugetroot$\reunion\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative.ProjectReunion\Microsoft.ReactNative.ProjectReunion.dll" target="lib\net5.0\Microsoft.ReactNative.ProjectReunion.dll" />
<file src="$nugetroot$\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\netcoreapp3.0\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\uap10.0\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.winmd" target="lib\net46\Microsoft.ReactNative.winmd" />
<file src="$nugetroot$\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x64\native\Microsoft.ReactNative.dll" />
<file src="$nugetroot$\$baseplatform$\$baseconfiguration$\Microsoft.ReactNative.ProjectReunion\Microsoft.ReactNative.ProjectReunion.dll" target="lib\net5.0\Microsoft.ReactNative.ProjectReunion.dll" />
</files>
</package>

Просмотреть файл

@ -0,0 +1,102 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param(
[string] $SourceRoot = ($PSScriptRoot | Split-Path | Split-Path | Split-Path),
[string] $TargetRoot = "$SourceRoot\vnext\target",
[System.IO.DirectoryInfo] $ReactWindowsRoot = "$SourceRoot\vnext",
[System.IO.DirectoryInfo] $ReactNativeRoot = "$SourceRoot\node_modules\react-native",
[string[]] $Extensions = ('h', 'hpp', 'def')
)
[xml]$props = gc $PSScriptRoot\..\..\Directory.Build.props
[string] $FollyVersion = $props.Project.PropertyGroup.FollyVersion;
$FollyVersion = $FollyVersion.Trim() # The extracted FollyVersion contains a space at the end that isn't actually present, issue #6216
$FollyRoot = "$SourceRoot\node_modules\.folly\folly-${FollyVersion}";
# Download Folly if running on a machine which hasn't run native build logic to acquire it
if (!(Test-Path $FollyRoot)) {
Write-Host "Downloading Folly $FollyVersion"
$FollyZip = "$SourceRoot\node_modules\.folly\folly-${FollyVersion}.zip"
$FollyDest = "$SourceRoot\node_modules\.folly"
New-Item $FollyRoot -ItemType Directory
Invoke-RestMethod -Uri "https://github.com/facebook/folly/archive/v$FollyVersion.zip" -OutFile $FollyZip
Expand-Archive -LiteralPath $FollyZip -DestinationPath $FollyRoot
}
Write-Host "Source root: [$SourceRoot]"
Write-Host "Destination root: [$TargetRoot]"
Write-Host "React Native root: [$ReactNativeRoot]"
md -Force $TargetRoot
$patterns = $Extensions| ForEach-Object {"*.$_"}
# ReactCommon headers
Get-ChildItem -Path $ReactNativeRoot\ReactCommon -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactNativeRoot\ReactCommon\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\$(Split-Path $_) -Force) `
-Force
}
# Yoga headers
Get-ChildItem -Path $ReactNativeRoot\ReactCommon\yoga\yoga -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactNativeRoot\ReactCommon\yoga\yoga\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Yoga\$(Split-Path $_) -Force) `
-Force
}
# Folly headers
Get-ChildItem -Path $FollyRoot -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $FollyRoot\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\folly\$(Split-Path $_) -Force) `
-Force
}
# stubs headers
Get-ChildItem -Path $ReactWindowsRoot\stubs -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\stubs\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\stubs\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Core headers
Get-ChildItem -Path $ReactWindowsRoot\Shared -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Shared\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Shared\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Desktop headers
Get-ChildItem -Path $ReactWindowsRoot\Desktop -Name -Recurse -Include '*.h','*.hpp','*.winmd' | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Desktop\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\ReactWin32\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Desktop DEFs
Get-ChildItem -Path $ReactWindowsRoot\Desktop.DLL -Recurse -Include '*.def' | ForEach-Object { Copy-Item `
-Path $_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\ -Force) `
-Force
}
# React.Windows.Test headers
Get-ChildItem -Path $ReactWindowsRoot\Test -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Test\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Test\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Test DLL DEF files
Get-ChildItem -Path $ReactWindowsRoot\Desktop.Test.DLL -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Desktop.Test.DLL\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\$(Split-Path $_) -Force) `
-Force
}
# include headers
Copy-Item -Force -Recurse -Path $ReactWindowsRoot\include -Destination $TargetRoot\inc
# Natvis files
Copy-Item -Force -Path $ReactWindowsRoot\Folly\Folly.natvis -Destination (New-Item -ItemType Directory $TargetRoot\natvis -Force)

Просмотреть файл

@ -1,165 +0,0 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param(
[string] $SourceRoot = ($PSScriptRoot | Split-Path | Split-Path | Split-Path),
[string] $BuildRoot = "$SourceRoot\vnext\target",
[string] $TargetRoot = "$SourceRoot\vnext\target",
[System.IO.DirectoryInfo] $ReactWindowsRoot = "$SourceRoot\vnext",
[System.IO.DirectoryInfo] $ReactNativeRoot = "$SourceRoot\node_modules\react-native",
[string[]] $Extensions = ('h', 'hpp', 'def')
)
[xml]$props = gc $PSScriptRoot\..\..\Directory.Build.props
[string] $FollyVersion = $props.Project.PropertyGroup.FollyVersion;
$FollyVersion = $FollyVersion.Trim() # The extracted FollyVersion contains a space at the end that isn't actually present, issue #6216
[System.IO.DirectoryInfo] $FollyRoot = "$SourceRoot\node_modules\.folly\folly-${FollyVersion}";
Write-Host "Source root: [$SourceRoot]"
Write-Host "Build root: [$BuildRoot]"
Write-Host "Destination root: [$TargetRoot]"
Write-Host "React Native root: [$ReactNativeRoot]"
$patterns = $Extensions| ForEach-Object {"*.$_"}
# ReactCommon headers
Get-ChildItem -Path $ReactNativeRoot\ReactCommon -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactNativeRoot\ReactCommon\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\$(Split-Path $_) -Force) `
-Force
}
# Yoga headers
Get-ChildItem -Path $ReactNativeRoot\ReactCommon\yoga\yoga -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactNativeRoot\ReactCommon\yoga\yoga\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Yoga\$(Split-Path $_) -Force) `
-Force
}
# Folly headers
Get-ChildItem -Path $FollyRoot -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $FollyRoot\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\folly\$(Split-Path $_) -Force) `
-Force
}
# stubs headers
Get-ChildItem -Path $ReactWindowsRoot\stubs -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\stubs\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\stubs\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Core headers
Get-ChildItem -Path $ReactWindowsRoot\Shared -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Shared\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Shared\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Desktop headers
Get-ChildItem -Path $ReactWindowsRoot\Desktop -Name -Recurse -Include '*.h','*.hpp','*.winmd' | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Desktop\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\ReactWin32\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Desktop DEFs
Get-ChildItem -Path $ReactWindowsRoot\Desktop.DLL -Recurse -Include '*.def' | ForEach-Object { Copy-Item `
-Path $_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\ -Force) `
-Force
}
# React.Windows.Test headers
Get-ChildItem -Path $ReactWindowsRoot\Test -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Test\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\Test\$(Split-Path $_) -Force) `
-Force
}
# React.Windows.Test DLL DEF files
Get-ChildItem -Path $ReactWindowsRoot\Desktop.Test.DLL -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
-Path $ReactWindowsRoot\Desktop.Test.DLL\$_ `
-Destination (New-Item -ItemType Directory $TargetRoot\inc\$(Split-Path $_) -Force) `
-Force
}
# include headers
Copy-Item -Force -Recurse -Path $ReactWindowsRoot\include -Destination $TargetRoot\inc
# Microsoft.ReactNative.CXX project
Copy-Item -Force -Recurse -Path $ReactWindowsRoot\Microsoft.ReactNative.Cxx -Destination $TargetRoot\
# Microsoft.ReactNative.CXX project JSI files
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\decorator.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\instrumentation.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi-inl.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\threadsafe.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
# Microsoft.ReactNative.CXX project TurboModule files
New-Item -ItemType Directory -Path $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\callinvoker\ReactCommon\CallInvoker.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\LongLivedObject.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\LongLivedObject.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
# NUSPEC
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\*.nuspec -Destination $TargetRoot
#Copy StripAdditionalPlatformsFromNuspec.ps1 for use by publish task
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\StripAdditionalPlatformsFromNuspec.ps1 -Destination $TargetRoot
# Microsoft.ReactNative.VersionCheck.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.VersionCheck.targets -Destination $TargetRoot
# Microsoft.ReactNative.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.targets -Destination $TargetRoot
# Microsoft.ReactNative.Cxx.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Cxx.targets -Destination $TargetRoot
# Microsoft.ReactNative.Managed.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Managed.targets -Destination $TargetRoot
# Microsoft.ReactNative.Managed.CodeGen.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Managed.CodeGen.targets -Destination $TargetRoot
# Natvis files
Copy-Item -Force -Path $ReactWindowsRoot\Folly\Folly.natvis -Destination (New-Item -ItemType Directory $TargetRoot\natvis -Force)
# Fix ref Assemblies to be AnyCpu
# The reason for doing this here is that csc maintains the architecture of the ref assembly to match the implementation. It doesn't
# automatically tag the ref as 'anycpu'. We use the ref assembly as the 'ref' in our nuget package. When the csc compiler
# compiles for other specific platforms like Arm, the compiler will fail if a ref assembly is marked as x64.
# The fix is to ensure that the 'ref' in the nuget package is marked as 'AnyCPU'.
# There unfortunately is no flag to csc, and no single tool to do this. CorFlags.exe does not have support to change this...
# This is a lot more straight-forward than trying to create an AnyCpu version of this assembly, update the solution, tests and add
# another platform to the CI matrix, not to mention the steps needed to ensure AnyCpu ran for the x64 build to test the nuget package
# in PR validation....
# Therefore this step will simply ildasm and ilasm the reference assembly and store it as which strips the bitness and generates anycpu msil.
# These reference assemblies are just regular assemblies but with empty bodies
ForEach ($refFolder in (Get-ChildItem -Path $BuildRoot -Recurse -Include "ref"))
{
ForEach ($refAsm in Get-ChildItem -Path $refFolder -Recurse -Include "*.dll" )
{
$outputFolder=([System.IO.Path]::GetDirectoryName($refAsm)).Replace($BuildRoot, $TargetRoot) + ".anycpu";
$outputAsm = [System.IO.Path]::Combine($outputFolder, [System.IO.Path]::GetFileName($refAsm));
$outputIl = [System.IO.Path]::ChangeExtension($outputAsm, ".il");
mkdir $outputFolder -ErrorAction SilentlyContinue
& "${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ildasm.exe" $refAsm /ALL "/OUT=$outputIl"
Write-Host $refAsm -> $outputIl
& "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe" $outputIl /DLL /QUIET
Write-Host $outputIl -> $outputAsm
}
}

Просмотреть файл

@ -0,0 +1,65 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param(
[string] $SourceRoot = ($PSScriptRoot | Split-Path | Split-Path | Split-Path),
[string] $TargetRoot = "$SourceRoot\vnext\target",
[System.IO.DirectoryInfo] $ReactWindowsRoot = "$SourceRoot\vnext",
[System.IO.DirectoryInfo] $ReactNativeRoot = "$SourceRoot\node_modules\react-native",
[string[]] $Extensions = ('h', 'hpp')
)
Write-Host "Source root: [$SourceRoot]"
Write-Host "Destination root: [$TargetRoot]"
Write-Host "React Native root: [$ReactNativeRoot]"
md -Force $TargetRoot
$patterns = $Extensions| ForEach-Object {"*.$_"}
# include headers
Copy-Item -Force -Recurse -Path $ReactWindowsRoot\include -Destination $TargetRoot\inc
# Microsoft.ReactNative.CXX project
Copy-Item -Force -Recurse -Path $ReactWindowsRoot\Microsoft.ReactNative.Cxx -Destination $TargetRoot\
# Microsoft.ReactNative.CXX project JSI files
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\decorator.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\instrumentation.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\jsi-inl.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\jsi\jsi\threadsafe.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\jsi\
# Microsoft.ReactNative.CXX project TurboModule files
New-Item -ItemType Directory -Path $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\callinvoker\ReactCommon\CallInvoker.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\LongLivedObject.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\LongLivedObject.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
# NUSPEC
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\*.nuspec -Destination $TargetRoot
#Copy StripAdditionalPlatformsFromNuspec.ps1 for use by publish task
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\StripAdditionalPlatformsFromNuspec.ps1 -Destination $TargetRoot
# Microsoft.ReactNative.VersionCheck.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.VersionCheck.targets -Destination $TargetRoot
# Microsoft.ReactNative.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.targets -Destination $TargetRoot
# Microsoft.ReactNative.Cxx.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Cxx.targets -Destination $TargetRoot
# Microsoft.ReactNative.Managed.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Managed.targets -Destination $TargetRoot
# Microsoft.ReactNative.Managed.CodeGen.targets
Copy-Item -Force -Path $ReactWindowsRoot\Scripts\Microsoft.ReactNative.Managed.CodeGen.targets -Destination $TargetRoot

Просмотреть файл

@ -0,0 +1,39 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param(
[string] $BuildRoot = "$SourceRoot\vnext\target",
[string] $TargetRoot = "$SourceRoot\vnext\target"
)
# Fix ref Assemblies to be AnyCpu
# The reason for doing this here is that csc maintains the architecture of the ref assembly to match the implementation. It doesn't
# automatically tag the ref as 'anycpu'. We use the ref assembly as the 'ref' in our nuget package. When the csc compiler
# compiles for other specific platforms like Arm, the compiler will fail if a ref assembly is marked as x64.
# The fix is to ensure that the 'ref' in the nuget package is marked as 'AnyCPU'.
# There unfortunately is no flag to csc, and no single tool to do this. CorFlags.exe does not have support to change this...
# This is a lot more straight-forward than trying to create an AnyCpu version of this assembly, update the solution, tests and add
# another platform to the CI matrix, not to mention the steps needed to ensure AnyCpu ran for the x64 build to test the nuget package
# in PR validation....
# Therefore this step will simply ildasm and ilasm the reference assembly and store it as which strips the bitness and generates anycpu msil.
# These reference assemblies are just regular assemblies but with empty bodies
ForEach ($refFolder in (Get-ChildItem -Path $BuildRoot -Recurse -Include "ref"))
{
ForEach ($refAsm in Get-ChildItem -Path $refFolder -Recurse -Include "*.dll" )
{
$outputFolder=([System.IO.Path]::GetDirectoryName($refAsm)).Replace($BuildRoot, $TargetRoot) + ".anycpu";
$outputAsm = [System.IO.Path]::Combine($outputFolder, [System.IO.Path]::GetFileName($refAsm));
$outputIl = [System.IO.Path]::ChangeExtension($outputAsm, ".il");
mkdir $outputFolder -ErrorAction SilentlyContinue
& "${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ildasm.exe" $refAsm /ALL "/OUT=$outputIl"
Write-Host $refAsm -> $outputIl
& "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe" $outputIl /DLL /QUIET
Write-Host $outputIl -> $outputAsm
}
}