Fix casing typos in NuGet and MSBuild (#5358)
* Fix casing typos in NuGet and MSBuild * Change files
This commit is contained in:
Родитель
f6fa17df71
Коммит
a4ed167972
|
@ -179,7 +179,7 @@ jobs:
|
|||
- RnwNpmPublish
|
||||
- RnwNativeBuildDesktop
|
||||
- RnwNativeBuildUniversal
|
||||
displayName: Publish Nuget
|
||||
displayName: Publish NuGet
|
||||
pool:
|
||||
vmImage: $(VmImage)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function npmVersionToRcVersion(npmVersion) {
|
|||
|
||||
let pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
||||
|
||||
// Record commit number, so that additional build tasks can record that commit in the nuget
|
||||
// Record commit number, so that additional build tasks can record that commit in the NuGet
|
||||
const commitId = child_process.execSync(`git rev-list HEAD -n 1`).toString().trim();
|
||||
|
||||
let versionEnvVars = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
parameters:
|
||||
publishCommitId: '0'
|
||||
npmVersion: '0.0.1-pr'
|
||||
# Note: Nuget pack expects platform-specific file spearators ('\' on Windows).
|
||||
# Note: NuGet pack expects platform-specific file spearators ('\' on Windows).
|
||||
nugetroot: $(System.DefaultWorkingDirectory)\ReactWindows
|
||||
desktopId: 'OfficeReact.Win32'
|
||||
microsoftRNId: 'Microsoft.ReactNative'
|
||||
|
|
|
@ -4,7 +4,7 @@ parameters:
|
|||
version:
|
||||
platform:
|
||||
configuration:
|
||||
experimentalNugetDependency: false
|
||||
experimentalNuGetDependency: false
|
||||
vsComponents: ''
|
||||
listVsComponents: false
|
||||
installVsComponents: false
|
||||
|
@ -58,7 +58,7 @@ steps:
|
|||
inputs:
|
||||
artifactName: TestMSRNNuget.${{ parameters.platform }}.${{ parameters.configuration }}
|
||||
downloadPath: $(System.DefaultWorkingDirectory)
|
||||
condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }}))
|
||||
condition: and(succeeded(), eq('true', ${{ parameters.experimentalNuGetDependency }}))
|
||||
|
||||
# We force the usage of npm instead of yarn becuase yarn has fragility issues when redirected to a different server (such as verdaccio)
|
||||
- task: CmdLine@2
|
||||
|
@ -70,7 +70,7 @@ steps:
|
|||
- task: CmdLine@2
|
||||
displayName: Apply windows template
|
||||
inputs:
|
||||
script: npx react-native-windows-init --verbose --version $(npmTag) --overwrite --language ${{ parameters.language }} --experimentalNugetDependency ${{ parameters.experimentalNugetDependency }} ${{ parameters.additionalInitArguments }}
|
||||
script: npx react-native-windows-init --verbose --version $(npmTag) --overwrite --language ${{ parameters.language }} --experimentalNuGetDependency ${{ parameters.experimentalNuGetDependency }} ${{ parameters.additionalInitArguments }}
|
||||
workingDirectory: $(Agent.BuildDirectory)\testcli
|
||||
|
||||
- task: PowerShell@2
|
||||
|
@ -91,7 +91,7 @@ steps:
|
|||
$packageSources.InsertBefore($newSource, $packageSources.FirstChild);
|
||||
$xml.save("$(Agent.BuildDirectory)\testcli\windows\Nuget.Config");
|
||||
|
||||
condition: and(succeeded(), eq('true', ${{ parameters.experimentalNugetDependency }}))
|
||||
condition: and(succeeded(), eq('true', ${{ parameters.experimentalNuGetDependency }}))
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: List Visual Studio Components
|
||||
|
|
|
@ -146,11 +146,11 @@ jobs:
|
|||
|
||||
- script: |
|
||||
npx --no-install beachball bump --branch origin/$(System.PullRequest.TargetBranch)
|
||||
displayName: Bump package versions to align nuget version with npm version
|
||||
displayName: Bump package versions to align NuGet version with npm version
|
||||
condition: eq('true', variables['TestMSRNNuget'])
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Prepare minimum nuget for testing experimental init
|
||||
displayName: Prepare minimum NuGet for testing experimental init
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
|
@ -600,7 +600,7 @@ jobs:
|
|||
platform: x86
|
||||
version: $(reactNativeVersion)
|
||||
additionalInitArguments: ${{ '' }}
|
||||
experimentalNugetDependency: true
|
||||
experimentalNuGetDependency: true
|
||||
|
||||
- job: RNWExtraChecks
|
||||
displayName: Extra Checks
|
||||
|
@ -661,7 +661,7 @@ jobs:
|
|||
BuildPlatform: x64
|
||||
|
||||
- job: RNWNugetPR
|
||||
displayName: Build and Pack Nuget
|
||||
displayName: Build and Pack NuGet
|
||||
dependsOn:
|
||||
- Setup
|
||||
- RNWUniversalPR
|
||||
|
@ -675,7 +675,7 @@ jobs:
|
|||
- checkout: self
|
||||
fetchDepth: 15
|
||||
|
||||
# The commit tag in the nuspec requires that we use at least nuget 4.6
|
||||
# The commit tag in the nuspec requires that we use at least NuGet 4.6
|
||||
- task: NuGetToolInstaller@0
|
||||
inputs:
|
||||
versionSpec: ">=4.6.0"
|
||||
|
|
|
@ -393,7 +393,7 @@ jobs:
|
|||
name: ReactWindows-source
|
||||
path: ${{ runner.temp }}\artifacts\ReactWindows-source
|
||||
|
||||
- name: Copy files from build artifacts to nuget root
|
||||
- name: Copy files from build artifacts to NuGet root
|
||||
run: |
|
||||
robocopy ${{ runner.temp }}\artifacts\ReactWindows-source ${{ runner.temp }}\NugetRoot /E /MOVE /NP
|
||||
robocopy ${{ runner.temp }}\artifacts\ReactWindows-debug-x64 ${{ runner.temp }}\NugetRoot\target\x64\Debug /E /MOVE /NP
|
||||
|
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
name: VersionEnvVars
|
||||
path: ${{ runner.temp }}/versionEnvVars
|
||||
|
||||
# This sets some env vars that we use to generate the correct version information in the dll and nuget
|
||||
# This sets some env vars that we use to generate the correct version information in the dll and NuGet
|
||||
- run: node ${{ runner.temp }}/versionEnvVars/versionEnvVars.js
|
||||
|
||||
- name: yarn install
|
||||
|
@ -73,7 +73,7 @@ jobs:
|
|||
run: .\vnext\Scripts\Install-WindowsSdkISO.ps1 18362
|
||||
shell: powershell
|
||||
|
||||
- name: Setup Nuget.exe
|
||||
- name: Setup NuGet.exe
|
||||
uses: warrenbuckley/Setup-Nuget@v1
|
||||
|
||||
- name: NuGet restore
|
||||
|
@ -85,7 +85,7 @@ jobs:
|
|||
- name: Build ReactWindows.sln
|
||||
run: msbuild vnext\ReactWindows.sln /nologo /nr:false /p:PreferredToolArchitecture=x64 /p:platform="${{ matrix.BuildPlatform }}" /p:configuration="${{ matrix.BuildConfiguration}}" /clp:NoSummary;NoItemAndPropertyList;Verbosity=normal
|
||||
|
||||
- name: "Copy Nuget source files"
|
||||
- name: "Copy NuGet source files"
|
||||
if: matrix.BuildConfiguration == 'Debug' && matrix.BuildPlatform == 'x86'
|
||||
run: vnext\layoutFilesForNuget.bat ${{ runner.temp }}\artifacts
|
||||
|
||||
|
@ -104,18 +104,18 @@ jobs:
|
|||
path: vnext/target/${{ matrix.BuildPlatform }}/${{ matrix.BuildConfiguration }}
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
name: Publish Artifacts - Nuget Source files
|
||||
name: Publish Artifacts - NuGet Source files
|
||||
if: matrix.BuildConfiguration == 'Debug' && matrix.BuildPlatform == 'x86'
|
||||
with:
|
||||
name: ReactWindows-source
|
||||
path: ${{ runner.temp }}\artifacts
|
||||
|
||||
RNWNugetPublish:
|
||||
name: React-Native-Windows Build and Pack Nuget
|
||||
name: React-Native-Windows Build and Pack NuGet
|
||||
runs-on: windows-2016
|
||||
needs: RnwNativePublishBuild
|
||||
steps:
|
||||
- name: Setup Nuget.exe
|
||||
- name: Setup NuGet.exe
|
||||
uses: warrenbuckley/Setup-Nuget@v1
|
||||
|
||||
- uses: actions/download-artifact@master
|
||||
|
@ -123,7 +123,7 @@ jobs:
|
|||
name: VersionEnvVars
|
||||
path: ${{ runner.temp }}/versionEnvVars
|
||||
|
||||
# This sets some env vars that we use to generate the correct version information in the dll and nuget
|
||||
# This sets some env vars that we use to generate the correct version information in the dll and NuGet
|
||||
- run: node ${{ runner.temp }}/versionEnvVars/versionEnvVars.js
|
||||
|
||||
- uses: actions/download-artifact@master
|
||||
|
@ -161,7 +161,7 @@ jobs:
|
|||
name: ReactWindows-source
|
||||
path: ${{ runner.temp }}\artifacts\ReactWindows-source
|
||||
|
||||
- name: Copy files from build artifacts to nuget root
|
||||
- name: Copy files from build artifacts to NuGet root
|
||||
run: |
|
||||
robocopy ${{ runner.temp }}\artifacts\ReactWindows-source ${{ runner.temp }}\NugetRoot /E /MOVE /NP
|
||||
robocopy ${{ runner.temp }}\artifacts\ReactWindows-debug-x64 ${{ runner.temp }}\NugetRoot\target\x64\Debug /E /MOVE /NP
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Fix casing typos in NuGet and MSBuild",
|
||||
"packageName": "react-native-windows",
|
||||
"email": "dannyvv@microsoft.com",
|
||||
"dependentChangeType": "patch",
|
||||
"date": "2020-06-26T19:02:44.846Z"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Fix casing typos in NuGet and MSBuild",
|
||||
"packageName": "react-native-windows-init",
|
||||
"email": "dannyvv@microsoft.com",
|
||||
"dependentChangeType": "patch",
|
||||
"date": "2020-06-26T19:02:43.033Z"
|
||||
}
|
|
@ -19,20 +19,20 @@ The generated C# file will contain a class called `ReactPackageProvider` in the
|
|||
* Generate and register custom serialization methods.
|
||||
|
||||
### In source mode
|
||||
The targets file hooks up an msbuild target that will ensure the tool is compiled, deployed and runnable based on the tools sources. The codegen tool is defined in the Microsoft.ReactNative.Managed.CodeGen project. It will build and deploy the tool in the current configuraiton of your project (debug or release) but will always build and run it in platform x64.
|
||||
The targets file hooks up an MSBuild target that will ensure the tool is compiled, deployed and runnable based on the tools sources. The codegen tool is defined in the Microsoft.ReactNative.Managed.CodeGen project. It will build and deploy the tool in the current configuraiton of your project (debug or release) but will always build and run it in platform x64.
|
||||
|
||||
### In nuget mode (Future)
|
||||
The tool will be shipped as a binary and the steps won't have to build or deploy the tool. The shipped version in the nuget package will only be release win-x64.
|
||||
When building the apps that are checked in to our repo for testing, we have to remain running off the source version as msbuild and nuget are not flexible enough to build and consume a nuget package in the same build.
|
||||
### In NuGet mode (Future)
|
||||
The tool will be shipped as a binary and the steps won't have to build or deploy the tool. The shipped version in the NuGet package will only be release win-x64.
|
||||
When building the apps that are checked in to our repo for testing, we have to remain running off the source version as MSBuild and NuGet are not flexible enough to build and consume a NuGet package in the same build.
|
||||
|
||||
## Turning on/off
|
||||
Currently the feature is behind an msbuild property `$(ReactNativeCodeGenEnabled)`.
|
||||
Currently the feature is behind an MSBuild property `$(ReactNativeCodeGenEnabled)`.
|
||||
The default at the moment is false, it is only turned on for a single project for now which is the [SampleLibraryCS.csproj](https://github.com/microsoft/react-native-windows/blob/master/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCS/SampleLibraryCS.csproj) project, to prove it is stable. We will slowly enable it for all projects in the repo and then make it the default.
|
||||
|
||||
## MsBuild/Nuget Complications
|
||||
MsBuild and Nuget spent a long time fighting me in mixing a NetCoreApp3.1 executable and WinRT apps in the same solution and the same build. ProjectReferences cannot be used so I had to use the `<MsBuild>` task directly in the targets and it was tricky making it build from both the customer apps as well as our main build solution and unittest (Microsoft.ReactNative.sln). In the end there are a few hacks in place to make this work.
|
||||
The hookups in msbuild do not use the latest BeforeTargets/AfterTargets feature to schedule the main work. I opted to follow the same pattern that the Xaml Codegen uses, so the React CodeGen runs after all the other codegen tools (like resgen, xamlcompile etc) to ensure people familiar with those extensions know how to work with the React Managed CodeGen.
|
||||
## MSBuild/NuGet Complications
|
||||
MSBuild and NuGet spent a long time fighting me in mixing a NetCoreApp3.1 executable and WinRT apps in the same solution and the same build. ProjectReferences cannot be used so I had to use the `<MSBuild>` task directly in the targets and it was tricky making it build from both the customer apps as well as our main build solution and unittest (Microsoft.ReactNative.sln). In the end there are a few hacks in place to make this work.
|
||||
The hookups in MSBuild do not use the latest BeforeTargets/AfterTargets feature to schedule the main work. I opted to follow the same pattern that the Xaml Codegen uses, so the React CodeGen runs after all the other codegen tools (like resgen, xamlcompile etc) to ensure people familiar with those extensions know how to work with the React Managed CodeGen.
|
||||
|
||||
## Future improvements
|
||||
* Add support for `Task<T>` async methods. [#5143](https://github.com/microsoft/react-native-windows/issues/5143)
|
||||
* Ship it as a nuget package [#4546](https://github.com/microsoft/react-native-windows/issues/4546)
|
||||
* Ship it as a NuGet package [#4546](https://github.com/microsoft/react-native-windows/issues/4546)
|
||||
|
|
|
@ -18,8 +18,8 @@ PR [#5126](https://github.com/microsoft/react-native-windows/pull/5126) updated
|
|||
This has the following benefits:
|
||||
* We can use conditionals and `foreach` in the template allowing for better expressivity
|
||||
* This expressivity shows that we don't have to construct XML fragments in JavaScript anymore to be inserted by `regex.replace`
|
||||
* We don't need to have have a copy and edit for large differences like we had for experimental nuget, it is now a single template for each language.
|
||||
* We can now generate a cpp template that use both nuget AND winUI3.
|
||||
* We don't need to have have a copy and edit for large differences like we had for experimental NuGet, it is now a single template for each language.
|
||||
* We can now generate a cpp template that use both NuGet AND WinUI3.
|
||||
|
||||
### Research before setteling on Mustache
|
||||
There are several templating schemes we could have chosen. We had a quick discussion and chose [mustache](https://www.npmjs.com/package/mustache) as it is a well-adopted, lightweight library dedicated for templating.
|
||||
|
|
|
@ -24,46 +24,55 @@ const NPM_REGISTRY_URL = validUrl.isUri(npmConfReg)
|
|||
: 'http://registry.npmjs.org';
|
||||
const npm = new Registry({registry: NPM_REGISTRY_URL});
|
||||
|
||||
const argv = yargs.version(false).strict(true).options({
|
||||
version: {
|
||||
type: 'string',
|
||||
describe: 'The version of react-native-windows to use.',
|
||||
},
|
||||
namespace: {
|
||||
type: 'string',
|
||||
describe:
|
||||
"The native project namespace. This should be expressed using dots as separators. i.e. 'Level1.Level2.Level3'. The generator will apply the correct syntax for the target language",
|
||||
},
|
||||
verbose: {type: 'boolean', describe: 'Enables logging.'},
|
||||
language: {
|
||||
type: 'string',
|
||||
describe: 'Which language the app is written in.',
|
||||
choices: ['cs', 'cpp'],
|
||||
default: 'cpp',
|
||||
},
|
||||
overwrite: {
|
||||
type: 'boolean',
|
||||
describe: 'Overwrite any existing files without prompting',
|
||||
},
|
||||
experimentalNugetDependency: {
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Experimental change to start consuming a nuget containing a pre-built dll version of Microsoft.ReactNative',
|
||||
hidden: true,
|
||||
},
|
||||
useWinUI3: {
|
||||
type: 'boolean',
|
||||
describe: '[Experimental] Use WinUI3',
|
||||
hidden: true,
|
||||
default: false,
|
||||
},
|
||||
useDevMode: {
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Link rather than Add/Install the react-native-windows package. This option is for the development workflow of the developers working on react-native-windows.',
|
||||
hidden: true,
|
||||
},
|
||||
}).check((a, o) => { if (a._.length != 0) { throw `Unrecognized option ${a._}`; }; return true }).argv;
|
||||
const argv = yargs
|
||||
.version(false)
|
||||
.strict(true)
|
||||
.options({
|
||||
version: {
|
||||
type: 'string',
|
||||
describe: 'The version of react-native-windows to use.',
|
||||
},
|
||||
namespace: {
|
||||
type: 'string',
|
||||
describe:
|
||||
"The native project namespace. This should be expressed using dots as separators. i.e. 'Level1.Level2.Level3'. The generator will apply the correct syntax for the target language",
|
||||
},
|
||||
verbose: {type: 'boolean', describe: 'Enables logging.'},
|
||||
language: {
|
||||
type: 'string',
|
||||
describe: 'Which language the app is written in.',
|
||||
choices: ['cs', 'cpp'],
|
||||
default: 'cpp',
|
||||
},
|
||||
overwrite: {
|
||||
type: 'boolean',
|
||||
describe: 'Overwrite any existing files without prompting',
|
||||
},
|
||||
experimentalNuGetDependency: {
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Experimental change to start consuming a NuGet containing a pre-built dll version of Microsoft.ReactNative',
|
||||
hidden: true,
|
||||
},
|
||||
useWinUI3: {
|
||||
type: 'boolean',
|
||||
describe: '[Experimental] Use WinUI3',
|
||||
hidden: true,
|
||||
default: false,
|
||||
},
|
||||
useDevMode: {
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Link rather than Add/Install the react-native-windows package. This option is for the development workflow of the developers working on react-native-windows.',
|
||||
hidden: true,
|
||||
},
|
||||
})
|
||||
.check((a, o) => {
|
||||
if (a._.length != 0) {
|
||||
throw `Unrecognized option ${a._}`;
|
||||
}
|
||||
return true;
|
||||
}).argv;
|
||||
|
||||
if (argv.verbose) {
|
||||
console.log(argv);
|
||||
|
@ -301,10 +310,10 @@ function isProjectUsingYarn(cwd: string) {
|
|||
const useDevMode = argv.useDevMode;
|
||||
let version = argv.version;
|
||||
|
||||
if (argv.useWinUI3 && argv.experimentalNugetDependency) {
|
||||
// WinUI3 is not yet compatible with nuget packages
|
||||
if (argv.useWinUI3 && argv.experimentalNuGetDependency) {
|
||||
// WinUI3 is not yet compatible with NuGet packages
|
||||
console.error(
|
||||
"Error: Incompatible options specified. Options '--useWinUI3' and '--experimentalNugetDependency' are incompatible",
|
||||
"Error: Incompatible options specified. Options '--useWinUI3' and '--experimentalNuGetDependency' are incompatible",
|
||||
);
|
||||
process.exit(EXITCODE_INCOMPATIBLE_OPTIONS);
|
||||
}
|
||||
|
@ -402,7 +411,7 @@ You can either downgrade your version of ${chalk.green(
|
|||
language: argv.language,
|
||||
overwrite: argv.overwrite,
|
||||
verbose: argv.verbose,
|
||||
experimentalNugetDependency: argv.experimentalNugetDependency,
|
||||
experimentalNuGetDependency: argv.experimentalNuGetDependency,
|
||||
useWinUI3: argv.useWinUI3,
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<!-- #2702: We need to figure out how we want to consume the Google Test'
|
||||
Nuget for Win32. For now, we do not build this project for Win32. -->
|
||||
NuGet for Win32. For now, we do not build this project for Win32. -->
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6f354505-fe3a-4bd2-a9a6-d12bbf37a85c}</ProjectGuid>
|
||||
|
|
|
@ -13,20 +13,20 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|||
|
||||
namespace Microsoft.ReactNative.Managed.CodeGen.UnitTests
|
||||
{
|
||||
public abstract class AnalysisTestBase
|
||||
{
|
||||
public TestContext TestContext { get; set; }
|
||||
|
||||
protected CancellationTokenSource TokenSource;
|
||||
|
||||
public AnalysisTestBase()
|
||||
public abstract class AnalysisTestBase
|
||||
{
|
||||
TokenSource = new CancellationTokenSource();
|
||||
}
|
||||
public TestContext TestContext { get; set; }
|
||||
|
||||
protected (CodeAnalyzer, INamedTypeSymbol) AnalyzeModuleFile(string csSnippet)
|
||||
{
|
||||
var csCode = @"
|
||||
protected CancellationTokenSource TokenSource;
|
||||
|
||||
public AnalysisTestBase()
|
||||
{
|
||||
TokenSource = new CancellationTokenSource();
|
||||
}
|
||||
|
||||
protected (CodeAnalyzer, INamedTypeSymbol) AnalyzeModuleFile(string csSnippet)
|
||||
{
|
||||
var csCode = @"
|
||||
using System;
|
||||
using Microsoft.ReactNative.Managed;
|
||||
|
||||
|
@ -37,58 +37,58 @@ public class TestClass
|
|||
}
|
||||
";
|
||||
|
||||
return AnalyzeFileAsync(csCode).GetAwaiter().GetResult();
|
||||
}
|
||||
return AnalyzeFileAsync(csCode).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
protected (CodeAnalyzer, INamedTypeSymbol) AnalyzeFile(string csCode)
|
||||
{
|
||||
return AnalyzeFileAsync(csCode).GetAwaiter().GetResult();
|
||||
}
|
||||
protected (CodeAnalyzer, INamedTypeSymbol) AnalyzeFile(string csCode)
|
||||
{
|
||||
return AnalyzeFileAsync(csCode).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
protected async Task<(CodeAnalyzer, INamedTypeSymbol)> AnalyzeFileAsync(string csCode)
|
||||
{
|
||||
var codeAnalyzer = new CodeAnalyzer(TokenSource.Token);
|
||||
protected async Task<(CodeAnalyzer, INamedTypeSymbol)> AnalyzeFileAsync(string csCode)
|
||||
{
|
||||
var codeAnalyzer = new CodeAnalyzer(TokenSource.Token);
|
||||
|
||||
codeAnalyzer.AddSyntaxTree(
|
||||
CSharpSyntaxTree.ParseText(csCode, path: "test.cs", options: new CSharpParseOptions()));
|
||||
codeAnalyzer.AddSyntaxTree(
|
||||
CSharpSyntaxTree.ParseText(csCode, path: "test.cs", options: new CSharpParseOptions()));
|
||||
|
||||
var targetFolderWithConfiguration = Path.GetDirectoryName(TestContext.TestDeploymentDir);
|
||||
var configuration = Path.GetFileName(targetFolderWithConfiguration);
|
||||
var targetRoot = Path.GetDirectoryName(Path.GetDirectoryName(targetFolderWithConfiguration));
|
||||
var targetFolderWithConfiguration = Path.GetDirectoryName(TestContext.TestDeploymentDir);
|
||||
var configuration = Path.GetFileName(targetFolderWithConfiguration);
|
||||
var targetRoot = Path.GetDirectoryName(Path.GetDirectoryName(targetFolderWithConfiguration));
|
||||
|
||||
var references = new List<string>();
|
||||
var references = new List<string>();
|
||||
|
||||
var microsoftNetCoreUwpPkgVersion = "6.2.10";
|
||||
var uapVersion = "uap10.0.15138";
|
||||
var microsoftNetCoreUwpPkgFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft SDKs", "UWPNuGetPackages", "microsoft.netcore.universalwindowsplatform", microsoftNetCoreUwpPkgVersion, "ref", uapVersion);
|
||||
if (!Directory.Exists(microsoftNetCoreUwpPkgFolder))
|
||||
{
|
||||
Assert.Fail($"Could not find path {microsoftNetCoreUwpPkgFolder}. This should have been installed as part of the UWP workload for Microsoft Visual Studio 2019 version 16.6");
|
||||
}
|
||||
references.AddRange(Directory.EnumerateFiles(microsoftNetCoreUwpPkgFolder, "*.dll"));
|
||||
var microsoftNetCoreUwpPkgVersion = "6.2.10";
|
||||
var uapVersion = "uap10.0.15138";
|
||||
var microsoftNetCoreUwpPkgFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft SDKs", "UWPNuGetPackages", "microsoft.netcore.universalwindowsplatform", microsoftNetCoreUwpPkgVersion, "ref", uapVersion);
|
||||
if (!Directory.Exists(microsoftNetCoreUwpPkgFolder))
|
||||
{
|
||||
Assert.Fail($"Could not find path {microsoftNetCoreUwpPkgFolder}. This should have been installed as part of the UWP workload for Microsoft Visual Studio 2019 version 16.6");
|
||||
}
|
||||
references.AddRange(Directory.EnumerateFiles(microsoftNetCoreUwpPkgFolder, "*.dll"));
|
||||
|
||||
|
||||
// A custom target in the test project ensures the x64 versions of these assemblies are built
|
||||
// before the unittest is run.
|
||||
// I could not find a way for the dotnet core project to NOT be "Any CPU" and then produce x64 binaries
|
||||
// in that configuration. I tried all the usual tricks for the netcore project to match the universal
|
||||
// multi platform support.
|
||||
references.Add($@"{targetRoot}\X64\{configuration}\Microsoft.ReactNative.Managed\Microsoft.ReactNative.Managed\Microsoft.ReactNative.Managed.dll");
|
||||
references.Add($@"{targetRoot}\X64\{configuration}\Microsoft.ReactNative\Microsoft.ReactNative.winmd");
|
||||
// A custom target in the test project ensures the x64 versions of these assemblies are built
|
||||
// before the unittest is run.
|
||||
// I could not find a way for the dotnet core project to NOT be "Any CPU" and then produce x64 binaries
|
||||
// in that configuration. I tried all the usual tricks for the netcore project to match the universal
|
||||
// multi platform support.
|
||||
references.Add($@"{targetRoot}\X64\{configuration}\Microsoft.ReactNative.Managed\Microsoft.ReactNative.Managed\Microsoft.ReactNative.Managed.dll");
|
||||
references.Add($@"{targetRoot}\X64\{configuration}\Microsoft.ReactNative\Microsoft.ReactNative.winmd");
|
||||
|
||||
// Add the windows 10 sdk assemblies for UWP. We have a compile time safeguard in place to
|
||||
// ensure that it matches the version that is defined in our msbuild projects matches the one
|
||||
// used in our unittests. Unfortunately C# doesn't allow constants to flow into code, nor do any
|
||||
// of the unitest runners are allowed to pick up a variable from the build file. And given the many
|
||||
// ways one can run inttests, this seemed to be the most reasonable out of a lot of poor options.
|
||||
var win10SdkFolder = @"C:\Program Files (x86)\Windows Kits\10";
|
||||
// Add the windows 10 sdk assemblies for UWP. We have a compile time safeguard in place to
|
||||
// ensure that it matches the version that is defined in our MSBuild projects matches the one
|
||||
// used in our unittests. Unfortunately C# doesn't allow constants to flow into code, nor do any
|
||||
// of the unitest runners are allowed to pick up a variable from the build file. And given the many
|
||||
// ways one can run inttests, this seemed to be the most reasonable out of a lot of poor options.
|
||||
var win10SdkFolder = @"C:\Program Files (x86)\Windows Kits\10";
|
||||
#if win10SdkVersion10_0_18362_0
|
||||
var win10SdkVersion = "10.0.18362.0";
|
||||
#else
|
||||
#error The Win10 Sdk Version must be updated in code when updated in msbuild.
|
||||
#error The Win10 Sdk Version must be updated in code when updated in MSBuild.
|
||||
#endif
|
||||
|
||||
references.AddRange(new[] {
|
||||
references.AddRange(new[] {
|
||||
$@"{win10SdkFolder}\References\{win10SdkVersion}\Windows.AI.MachineLearning.MachineLearningContract\2.0.0.0\Windows.AI.MachineLearning.MachineLearningContract.winmd",
|
||||
$@"{win10SdkFolder}\References\{win10SdkVersion}\Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract\2.0.0.0\Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract.winmd",
|
||||
$@"{win10SdkFolder}\References\{win10SdkVersion}\Windows.ApplicationModel.Calls.Background.CallsBackgroundContract\2.0.0.0\Windows.ApplicationModel.Calls.Background.CallsBackgroundContract.winmd",
|
||||
|
@ -121,29 +121,29 @@ public class TestClass
|
|||
$@"{win10SdkFolder}\UnionMetadata\{win10SdkVersion}\Facade\Windows.winmd"
|
||||
});
|
||||
|
||||
await codeAnalyzer.LoadMetadataReferencesAsync(references);
|
||||
await codeAnalyzer.LoadMetadataReferencesAsync(references);
|
||||
|
||||
var success = codeAnalyzer.TryCompileAndCheckForErrors();
|
||||
if (!success)
|
||||
{
|
||||
TestContext.WriteLine(string.Join(Environment.NewLine, codeAnalyzer.Diagnostics));
|
||||
Assert.Fail("Diagnostics encountered");
|
||||
}
|
||||
var success = codeAnalyzer.TryCompileAndCheckForErrors();
|
||||
if (!success)
|
||||
{
|
||||
TestContext.WriteLine(string.Join(Environment.NewLine, codeAnalyzer.Diagnostics));
|
||||
Assert.Fail("Diagnostics encountered");
|
||||
}
|
||||
|
||||
var errorCount = codeAnalyzer.Diagnostics.Count(diag => diag.Severity == DiagnosticSeverity.Error);
|
||||
Assert.AreEqual(0, errorCount);
|
||||
var errorCount = codeAnalyzer.Diagnostics.Count(diag => diag.Severity == DiagnosticSeverity.Error);
|
||||
Assert.AreEqual(0, errorCount);
|
||||
|
||||
var type = codeAnalyzer.GetAllTypes().FirstOrDefault(tp => tp.Name == "TestClass");
|
||||
var type = codeAnalyzer.GetAllTypes().FirstOrDefault(tp => tp.Name == "TestClass");
|
||||
|
||||
return (codeAnalyzer, type);
|
||||
return (codeAnalyzer, type);
|
||||
}
|
||||
|
||||
protected void ExpectSingleError(CodeAnalyzer analyzer, DiagnosticDescriptor descriptor)
|
||||
{
|
||||
Assert.AreEqual(1, analyzer.Diagnostics.Count());
|
||||
var error = analyzer.Diagnostics.First();
|
||||
Assert.AreEqual(descriptor, error.Descriptor);
|
||||
Assert.AreNotEqual(Location.None, error.Location);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ExpectSingleError(CodeAnalyzer analyzer, DiagnosticDescriptor descriptor)
|
||||
{
|
||||
Assert.AreEqual(1, analyzer.Diagnostics.Count());
|
||||
var error = analyzer.Diagnostics.First();
|
||||
Assert.AreEqual(descriptor, error.Descriptor);
|
||||
Assert.AreNotEqual(Location.None, error.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,163 +13,163 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Microsoft.ReactNative.Managed.CodeGen
|
||||
{
|
||||
public class App
|
||||
{
|
||||
private readonly CancellationToken m_cancellationToken;
|
||||
|
||||
public App(CancellationToken cancellationToken)
|
||||
public class App
|
||||
{
|
||||
m_cancellationToken = cancellationToken;
|
||||
}
|
||||
private readonly CancellationToken m_cancellationToken;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point to run the code generation based on the given options.
|
||||
///
|
||||
/// Main phases of execution are:
|
||||
/// 1. Load the code into roslyn
|
||||
/// 1. Parse Source Files into syntax trees
|
||||
/// 2. Load the references
|
||||
/// 3. Run the compiler to create the Linked semantic model.
|
||||
/// 2. Analyze the roslyn Compilation unit
|
||||
/// 1. Detect react types in the code
|
||||
/// 2. Build a Model for the assembly
|
||||
/// 3. Generate code
|
||||
/// 1. Use the Model from step 2 to emit a C# Syntax Tree
|
||||
/// 2. Write the SyntaxTree to a file.
|
||||
/// </summary>
|
||||
public async Task<bool> Run(Options options)
|
||||
{
|
||||
var codeAnalyzer = new CodeAnalyzer(m_cancellationToken);
|
||||
|
||||
// Load the code into roslyn
|
||||
using (new ConsoleMeasurement("Parsing source files"))
|
||||
{
|
||||
await codeAnalyzer.ParseSourceFilesAsync(
|
||||
GetDistinctExistingFiles(options.SourceFiles),
|
||||
options.Defines.Select(def => def.Trim()));
|
||||
}
|
||||
|
||||
using (new ConsoleMeasurement("Loading references"))
|
||||
{
|
||||
await codeAnalyzer.LoadMetadataReferencesAsync(
|
||||
GetDistinctExistingFiles(options.References));
|
||||
}
|
||||
|
||||
using (new ConsoleMeasurement("Compiling"))
|
||||
{
|
||||
if (!codeAnalyzer.TryCompileAndCheckForErrors())
|
||||
public App(CancellationToken cancellationToken)
|
||||
{
|
||||
CheckForErrors(codeAnalyzer);
|
||||
return false;
|
||||
m_cancellationToken = cancellationToken;
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the model form the assembly
|
||||
ReactAssembly assembly;
|
||||
using (new ConsoleMeasurement("Finding types"))
|
||||
{
|
||||
assembly = codeAnalyzer.AnalyzeAndConstructAssemblyModel();
|
||||
}
|
||||
|
||||
// Check if any errors have been logged and display them.
|
||||
if (!CheckForErrors(codeAnalyzer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var codeGenerator = new CodeGenerator(codeAnalyzer.ReactTypes, options.Namespace);
|
||||
CSharpSyntaxNode node;
|
||||
using (new ConsoleMeasurement("Generating code"))
|
||||
{
|
||||
node = codeGenerator.Generate(assembly);
|
||||
}
|
||||
|
||||
var code = node.NormalizeWhitespace(indentation: " ", elasticTrivia: false).ToFullString();
|
||||
|
||||
if (! await TryWriteFileIfDifferent(options.OutputFile, code))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<bool> TryWriteFileIfDifferent(string path, string contents)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
/// <summary>
|
||||
/// The main entry point to run the code generation based on the given options.
|
||||
///
|
||||
/// Main phases of execution are:
|
||||
/// 1. Load the code into roslyn
|
||||
/// 1. Parse Source Files into syntax trees
|
||||
/// 2. Load the references
|
||||
/// 3. Run the compiler to create the Linked semantic model.
|
||||
/// 2. Analyze the roslyn Compilation unit
|
||||
/// 1. Detect react types in the code
|
||||
/// 2. Build a Model for the assembly
|
||||
/// 3. Generate code
|
||||
/// 1. Use the Model from step 2 to emit a C# Syntax Tree
|
||||
/// 2. Write the SyntaxTree to a file.
|
||||
/// </summary>
|
||||
public async Task<bool> Run(Options options)
|
||||
{
|
||||
var existing = await File.ReadAllTextAsync(path, m_cancellationToken);
|
||||
if (string.Equals(contents, existing))
|
||||
{
|
||||
// File already has the same contents, do not write to disk
|
||||
// so we can keep the timestamp of the file so msbuild will not
|
||||
// run dependent tasks.
|
||||
var codeAnalyzer = new CodeAnalyzer(m_cancellationToken);
|
||||
|
||||
// Load the code into roslyn
|
||||
using (new ConsoleMeasurement("Parsing source files"))
|
||||
{
|
||||
await codeAnalyzer.ParseSourceFilesAsync(
|
||||
GetDistinctExistingFiles(options.SourceFiles),
|
||||
options.Defines.Select(def => def.Trim()));
|
||||
}
|
||||
|
||||
using (new ConsoleMeasurement("Loading references"))
|
||||
{
|
||||
await codeAnalyzer.LoadMetadataReferencesAsync(
|
||||
GetDistinctExistingFiles(options.References));
|
||||
}
|
||||
|
||||
using (new ConsoleMeasurement("Compiling"))
|
||||
{
|
||||
if (!codeAnalyzer.TryCompileAndCheckForErrors())
|
||||
{
|
||||
CheckForErrors(codeAnalyzer);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the model form the assembly
|
||||
ReactAssembly assembly;
|
||||
using (new ConsoleMeasurement("Finding types"))
|
||||
{
|
||||
assembly = codeAnalyzer.AnalyzeAndConstructAssemblyModel();
|
||||
}
|
||||
|
||||
// Check if any errors have been logged and display them.
|
||||
if (!CheckForErrors(codeAnalyzer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var codeGenerator = new CodeGenerator(codeAnalyzer.ReactTypes, options.Namespace);
|
||||
CSharpSyntaxNode node;
|
||||
using (new ConsoleMeasurement("Generating code"))
|
||||
{
|
||||
node = codeGenerator.Generate(assembly);
|
||||
}
|
||||
|
||||
var code = node.NormalizeWhitespace(indentation: " ", elasticTrivia: false).ToFullString();
|
||||
|
||||
if (!await TryWriteFileIfDifferent(options.OutputFile, code))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure output directory
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
await File.WriteAllTextAsync(path, contents, m_cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
when (e is IOException || e is UnauthorizedAccessException)
|
||||
{
|
||||
Console.Error.WriteLine($"Error writing file {path}: {e.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckForErrors(CodeAnalyzer codeAnalyzer)
|
||||
{
|
||||
bool hasErrors = false;
|
||||
if (codeAnalyzer.Diagnostics.Any(diag => diag.Severity == DiagnosticSeverity.Error || diag.Severity == DiagnosticSeverity.Warning))
|
||||
{
|
||||
var oldColor = Console.ForegroundColor;
|
||||
foreach (var diagnostic in codeAnalyzer.Diagnostics)
|
||||
private async Task<bool> TryWriteFileIfDifferent(string path, string contents)
|
||||
{
|
||||
switch (diagnostic.Severity)
|
||||
{
|
||||
case DiagnosticSeverity.Error:
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
hasErrors = true;
|
||||
break;
|
||||
case DiagnosticSeverity.Warning:
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
break;
|
||||
default:
|
||||
Console.ForegroundColor = oldColor;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var existing = await File.ReadAllTextAsync(path, m_cancellationToken);
|
||||
if (string.Equals(contents, existing))
|
||||
{
|
||||
// File already has the same contents, do not write to disk
|
||||
// so we can keep the timestamp of the file so MSBuild will not
|
||||
// run dependent tasks.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine(diagnostic.ToString());
|
||||
// Ensure output directory
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
await File.WriteAllTextAsync(path, contents, m_cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
when (e is IOException || e is UnauthorizedAccessException)
|
||||
{
|
||||
Console.Error.WriteLine($"Error writing file {path}: {e.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Console.ForegroundColor = oldColor;
|
||||
}
|
||||
private bool CheckForErrors(CodeAnalyzer codeAnalyzer)
|
||||
{
|
||||
bool hasErrors = false;
|
||||
if (codeAnalyzer.Diagnostics.Any(diag => diag.Severity == DiagnosticSeverity.Error || diag.Severity == DiagnosticSeverity.Warning))
|
||||
{
|
||||
var oldColor = Console.ForegroundColor;
|
||||
foreach (var diagnostic in codeAnalyzer.Diagnostics)
|
||||
{
|
||||
switch (diagnostic.Severity)
|
||||
{
|
||||
case DiagnosticSeverity.Error:
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
hasErrors = true;
|
||||
break;
|
||||
case DiagnosticSeverity.Warning:
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
break;
|
||||
default:
|
||||
Console.ForegroundColor = oldColor;
|
||||
break;
|
||||
}
|
||||
|
||||
return !hasErrors;
|
||||
Console.WriteLine(diagnostic.ToString());
|
||||
}
|
||||
|
||||
Console.ForegroundColor = oldColor;
|
||||
}
|
||||
|
||||
return !hasErrors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to dedupe and normalize file paths for some of the options.
|
||||
/// </summary>
|
||||
private static IEnumerable<string> GetDistinctExistingFiles(IEnumerable<string> files)
|
||||
{
|
||||
if (files == null)
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
return files
|
||||
.Select(file => Path.GetFullPath(file.Trim()))
|
||||
.Where(filePath => File.Exists(filePath))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to dedupe and normalize file paths for some of the options.
|
||||
/// </summary>
|
||||
private static IEnumerable<string> GetDistinctExistingFiles(IEnumerable<string> files)
|
||||
{
|
||||
if (files == null)
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
return files
|
||||
.Select(file => Path.GetFullPath(file.Trim()))
|
||||
.Where(filePath => File.Exists(filePath))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<!--
|
||||
This target ensures that the codegen tool is compiled and published.
|
||||
It will set the property groups for the path of the deployment as well as listing all the dependent files of the tool for incrementality
|
||||
When this is moved to a nuget package, this is no longer needed.
|
||||
When this is moved to a NuGet package, this is no longer needed.
|
||||
-->
|
||||
<Target Name="_ReactNativeManagedCodeGenPublishTool" Condition="'$(DesignTimeBuild)' != 'true'">
|
||||
|
||||
|
@ -51,12 +51,12 @@
|
|||
</MSBuild>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- MsBuild does not allow targets to return properties, so map it to a property from an itemgroup -->
|
||||
<!-- MSBuild does not allow targets to return properties, so map it to a property from an itemgroup -->
|
||||
<_ReactNativeCodeGenToolFiles Include="@(_ReactNativeCodeGenToolFilesTemp)" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- MsBuild does not allow targets to return properties, so map it to a property from an itemgroup -->
|
||||
<!-- MSBuild does not allow targets to return properties, so map it to a property from an itemgroup -->
|
||||
<_ReactNativeCodeGenToolExecutable>@(_ReactNativeCodeGenToolExecutableTemp)</_ReactNativeCodeGenToolExecutable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# For PR builds we dont want to have to build _ALL_ the platforms just to get a nuget and test one platform.
|
||||
# this script filters the files required by the nuget, so we can produce a test nuget on a single platform
|
||||
# For PR builds we dont want to have to build _ALL_ the platforms just to get a NuGet and test one platform.
|
||||
# this script filters the files required by the NuGet, so we can produce a test NuGet on a single platform
|
||||
|
||||
param (
|
||||
[string]$nuspec = "$PSScriptRoot\Microsoft.ReactNative.nuspec",
|
||||
|
|
|
@ -30,7 +30,7 @@ function generateWindows (projectDir, name, ns, options) {
|
|||
ns,
|
||||
overwrite: options.overwrite,
|
||||
language: options.language,
|
||||
experimentalNugetDependency: options.experimentalNugetDependency,
|
||||
experimentalNuGetDependency: options.experimentalNuGetDependency,
|
||||
useWinUI3: options.useWinUI3,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@ function copyProjectTemplateAndReplace(
|
|||
const language = options.language;
|
||||
const namespace = options.ns || newProjectName;
|
||||
const namespaceCpp = toCppNamespace(namespace);
|
||||
if (options.experimentalNugetDependency) {
|
||||
if (options.experimentalNuGetDependency) {
|
||||
console.log('Using experimental NuGet dependency.');
|
||||
}
|
||||
if (options.useWinUI3) {
|
||||
|
@ -115,7 +115,7 @@ function copyProjectTemplateAndReplace(
|
|||
},
|
||||
];
|
||||
|
||||
if (options.experimentalNugetDependency) {
|
||||
if (options.experimentalNuGetDependency) {
|
||||
cppNugetPackages.push(
|
||||
{
|
||||
id: 'Microsoft.ReactNative',
|
||||
|
@ -148,7 +148,7 @@ function copyProjectTemplateAndReplace(
|
|||
currentUser: currentUser,
|
||||
certificateThumbprint: certificateThumbprint,
|
||||
|
||||
useExperimentalNuget: options.experimentalNugetDependency,
|
||||
useExperimentalNuget: options.experimentalNuGetDependency,
|
||||
|
||||
// cpp template variables
|
||||
useWinUI3: options.useWinUI3,
|
||||
|
@ -185,7 +185,7 @@ function copyProjectTemplateAndReplace(
|
|||
].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite));
|
||||
|
||||
// Once we are publishing to nuget.org, this shouldn't be needed anymore
|
||||
if (options.experimentalNugetDependency) {
|
||||
if (options.experimentalNuGetDependency) {
|
||||
[
|
||||
{ from: path.join(srcPath, projDir, 'NuGet.Config'), to: path.join(windowsDir, 'NuGet.Config') },
|
||||
].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite));
|
||||
|
|
Загрузка…
Ссылка в новой задаче