@react-native-windows/cli 0.68.0-preview.4 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,11 +88,15 @@ async function getExtraProps() {
88
88
  const extraProps = {
89
89
  phase: runWindowsPhase,
90
90
  hasRunRnwDependencies,
91
+ msBuildProps: evaluateMSBuildPropsCallback
92
+ ? evaluateMSBuildPropsCallback()
93
+ : {},
91
94
  };
92
95
  return extraProps;
93
96
  }
94
97
  let runWindowsPhase = 'None';
95
98
  let hasRunRnwDependencies = false;
99
+ let evaluateMSBuildPropsCallback;
96
100
  /**
97
101
  * The function run when calling `react-native run-windows`.
98
102
  * @param args Unprocessed args passed from react-native CLI.
@@ -114,6 +118,7 @@ async function runWindows(args, config, options) {
114
118
  }
115
119
  let runWindowsError;
116
120
  if (options.info) {
121
+ runWindowsPhase = 'Info';
117
122
  try {
118
123
  const output = await info.getEnvironmentInfo();
119
124
  console.log(output.trimEnd());
@@ -162,6 +167,7 @@ async function runWindowsInternal(args, config, options) {
162
167
  }
163
168
  // Get the solution file
164
169
  let slnFile;
170
+ runWindowsPhase = 'FindSolution';
165
171
  try {
166
172
  slnFile = build.getAppSolutionFile(options, config);
167
173
  }
@@ -186,16 +192,39 @@ async function runWindowsInternal(args, config, options) {
186
192
  throw error;
187
193
  }
188
194
  }
195
+ // Set up the callback to capture MSBuild properties after the command completes
196
+ evaluateMSBuildPropsCallback = () => {
197
+ const projectFile = build.getAppProjectFile(options, config);
198
+ if (projectFile) {
199
+ if (verbose) {
200
+ (0, commandWithProgress_1.newInfo)('Gathering MSBuild data for telemetry.');
201
+ }
202
+ const msBuildPropertiesJsonPath = path_1.default.resolve(path_1.default.dirname(projectFile), 'Generated Files', 'msbuildproperties.g.json');
203
+ if (fs_1.default.existsSync(msBuildPropertiesJsonPath)) {
204
+ if (verbose) {
205
+ (0, commandWithProgress_1.newInfo)('Loading properties from msbuildproperties.g.json');
206
+ }
207
+ return fs_1.default.readJsonFileSync(msBuildPropertiesJsonPath);
208
+ }
209
+ if (verbose) {
210
+ (0, commandWithProgress_1.newInfo)('Unable to find msbuildproperties.g.json');
211
+ }
212
+ }
213
+ return {};
214
+ };
189
215
  // Restore packages.config files for dependencies that don't support PackageReference.
216
+ runWindowsPhase = 'RestorePackagesConfig';
217
+ const buildType = deploy.getBuildConfiguration(options);
190
218
  try {
191
- await buildTools.restorePackageConfigs(slnFile);
219
+ await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);
192
220
  }
193
221
  catch (e) {
194
222
  (0, commandWithProgress_1.newError)(`Couldn't restore found packages.config instances. ${e.message}`);
195
223
  throw e;
196
224
  }
197
- try {
198
- if (options.autolink) {
225
+ if (options.autolink) {
226
+ runWindowsPhase = 'Autolink';
227
+ try {
199
228
  const autolinkArgs = [];
200
229
  const autolinkConfig = config;
201
230
  const autoLinkOptions = {
@@ -205,30 +234,27 @@ async function runWindowsInternal(args, config, options) {
205
234
  sln: options.sln,
206
235
  telemetry: options.telemetry,
207
236
  };
208
- runWindowsPhase = 'AutoLink';
209
237
  await (0, autolink_1.autolinkWindowsInternal)(autolinkArgs, autolinkConfig, autoLinkOptions);
210
238
  }
211
- else {
212
- (0, commandWithProgress_1.newInfo)('Autolink step is skipped');
239
+ catch (e) {
240
+ (0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
241
+ throw e;
213
242
  }
214
243
  }
215
- catch (e) {
216
- (0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
217
- throw e;
244
+ else {
245
+ (0, commandWithProgress_1.newInfo)('Autolink step is skipped');
218
246
  }
219
247
  if (options.build) {
220
- runWindowsPhase = 'FindSolution';
248
+ runWindowsPhase = 'Build';
221
249
  if (!slnFile) {
222
250
  (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
223
251
  throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
224
252
  }
225
253
  // Get build/deploy options
226
- const buildType = deploy.getBuildConfiguration(options);
227
254
  const msBuildProps = build.parseMsBuildProps(options);
228
255
  // Disable the autolink check since we just ran it
229
256
  msBuildProps.RunAutolinkCheck = 'false';
230
257
  try {
231
- runWindowsPhase = 'FindSolution';
232
258
  await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, 'build', options.buildLogDirectory, options.singleproc);
233
259
  }
234
260
  catch (e) {
@@ -246,13 +272,12 @@ async function runWindowsInternal(args, config, options) {
246
272
  await deploy.startServerInNewWindow(options, verbose);
247
273
  }
248
274
  if (options.deploy) {
249
- runWindowsPhase = 'FindSolution';
275
+ runWindowsPhase = 'Deploy';
250
276
  if (!slnFile) {
251
277
  (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
252
278
  throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
253
279
  }
254
280
  try {
255
- runWindowsPhase = 'Deploy';
256
281
  if (options.device || options.emulator || options.target) {
257
282
  await deploy.deployToDevice(options, verbose, config);
258
283
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,+DAAsE;AAEtE,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAKqC;AACrC,+DAIkC;AAClC,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAA0E;AAE1E;;;;;GAKG;AACH,sCAAsC;AACtC,SAAS,eAAe,CAAC,GAA4B,EAAE,KAAU;IAC/D,kCAAkC;IAClC,2EAA2E;IAC3E,8DAA8D;IAC9D,QAAQ,GAAG,EAAE;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,mBAAmB;YACtB,OAAO,KA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AAC,CAAC;KACvD;IAED,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,eAAe,GAAG,cAAc,CAAC;QACjC,IAAI,CAAC,OAAO,EAAE;YACZ,IAAA,8BAAQ,EACN,yFAAyF,CAC1F,CAAC;YACF,MAAM,IAAI,sBAAU,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;SACjE;QAED,IAAI;YACF,eAAe,GAAG,QAAQ,CAAC;YAC3B,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE;gBACxD,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;aACvD;iBAAM;gBACL,MAAM,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;aACpE;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,8BAAQ,EAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpE,MAAM,CAAC,CAAC;SACT;KACF;SAAM;QACL,IAAA,6BAAO,EAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,CACL,OAAO,CAAC,QAAQ,KAAK,IAAI;QACzB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {\n newError,\n newInfo,\n newWarn,\n setExitProcessWithError,\n} from './utils/commandWithProgress';\nimport {\n getDefaultOptions,\n startTelemetrySession,\n endTelemetrySession,\n} from './utils/telemetryHelpers';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autolinkWindowsInternal, AutoLinkOptions} from './utils/autolink';\n\n/**\n * Sanitizes the given option for telemetery.\n * @param key The key of the option.\n * @param value The unsanitized value of the option.\n * @returns The sanitized value of the option.\n */\n// eslint-disable-next-line complexity\nfunction optionSanitizer(key: keyof RunWindowsOptions, value: any): any {\n // Do not add a default case here.\n // Strings risking PII should just return true if present, false otherwise.\n // All others should return the value (or false if undefined).\n switch (key) {\n case 'root':\n case 'target':\n case 'sln':\n case 'proj':\n case 'buildLogDirectory':\n return value === undefined ? false : true; // Strip PII\n case 'msbuildprops':\n return value === undefined ? 0 : value.split(',').length; // Convert to count\n case 'release':\n case 'arch':\n case 'singleproc':\n case 'emulator':\n case 'device':\n case 'remoteDebugging':\n case 'logging':\n case 'packager':\n case 'bundle':\n case 'launch':\n case 'autolink':\n case 'build':\n case 'deploy':\n case 'deployFromLayout':\n case 'info':\n case 'directDebugging':\n case 'telemetry':\n return value === undefined ? false : value; // Return value\n }\n}\n\n/**\n * Get the extra props to add to the `run-windows` telemetry event.\n * @returns The extra props.\n */\nasync function getExtraProps(): Promise<Record<string, any>> {\n const extraProps: Record<string, any> = {\n phase: runWindowsPhase,\n hasRunRnwDependencies,\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\n/**\n * The function run when calling `react-native run-windows`.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n await startTelemetrySession(\n 'run-windows',\n config,\n options,\n getDefaultOptions(config, runWindowsOptions),\n optionSanitizer,\n );\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n if (process.env.LocalAppData) {\n hasRunRnwDependencies = fs.existsSync(\n path.join(process.env.LocalAppData, 'rnw-dependencies.txt'),\n ); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n }\n\n let runWindowsError: Error | undefined;\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach((version) => console.log(' ' + version));\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n newError(\n 'Unable to print environment info.\\n' + runWindowsError.toString(),\n );\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n return;\n }\n\n try {\n await runWindowsInternal(args, config, options);\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n}\n\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n try {\n await buildTools.restorePackageConfigs(slnFile);\n } catch (e) {\n newError(\n `Couldn't restore found packages.config instances. ${\n (e as Error).message\n }`,\n );\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions: AutoLinkOptions = {\n logging: options.logging,\n check: false,\n proj: options.proj,\n sln: options.sln,\n telemetry: options.telemetry,\n };\n runWindowsPhase = 'AutoLink';\n await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autoLinkOptions,\n );\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
1
+ {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,+DAAsE;AAEtE,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAKqC;AACrC,+DAIkC;AAClC,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAA0E;AAE1E;;;;;GAKG;AACH,sCAAsC;AACtC,SAAS,eAAe,CAAC,GAA4B,EAAE,KAAU;IAC/D,kCAAkC;IAClC,2EAA2E;IAC3E,8DAA8D;IAC9D,QAAQ,GAAG,EAAE;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,mBAAmB;YACtB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;QACzD,KAAK,cAAc;YACjB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAmB;QAC/E,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,iB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AAA,6BAAO,EAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,CACL,OAAO,CAAC,QAAQ,KAAK,IAAI;QACzB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {\n newError,\n newInfo,\n newWarn,\n setExitProcessWithError,\n} from './utils/commandWithProgress';\nimport {\n getDefaultOptions,\n startTelemetrySession,\n endTelemetrySession,\n} from './utils/telemetryHelpers';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autolinkWindowsInternal, AutoLinkOptions} from './utils/autolink';\n\n/**\n * Sanitizes the given option for telemetery.\n * @param key The key of the option.\n * @param value The unsanitized value of the option.\n * @returns The sanitized value of the option.\n */\n// eslint-disable-next-line complexity\nfunction optionSanitizer(key: keyof RunWindowsOptions, value: any): any {\n // Do not add a default case here.\n // Strings risking PII should just return true if present, false otherwise.\n // All others should return the value (or false if undefined).\n switch (key) {\n case 'root':\n case 'target':\n case 'sln':\n case 'proj':\n case 'buildLogDirectory':\n return value === undefined ? false : true; // Strip PII\n case 'msbuildprops':\n return value === undefined ? 0 : value.split(',').length; // Convert to count\n case 'release':\n case 'arch':\n case 'singleproc':\n case 'emulator':\n case 'device':\n case 'remoteDebugging':\n case 'logging':\n case 'packager':\n case 'bundle':\n case 'launch':\n case 'autolink':\n case 'build':\n case 'deploy':\n case 'deployFromLayout':\n case 'info':\n case 'directDebugging':\n case 'telemetry':\n return value === undefined ? false : value; // Return value\n }\n}\n\n/**\n * Get the extra props to add to the `run-windows` telemetry event.\n * @returns The extra props.\n */\nasync function getExtraProps(): Promise<Record<string, any>> {\n const extraProps: Record<string, any> = {\n phase: runWindowsPhase,\n hasRunRnwDependencies,\n msBuildProps: evaluateMSBuildPropsCallback\n ? evaluateMSBuildPropsCallback()\n : {},\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'Info'\n | 'FindSolution'\n | 'FindBuildTools'\n | 'Autolink'\n | 'RestorePackagesConfig'\n | 'Build'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\nlet evaluateMSBuildPropsCallback:\n | (() => Record<string, string> | null)\n | undefined;\n\n/**\n * The function run when calling `react-native run-windows`.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n await startTelemetrySession(\n 'run-windows',\n config,\n options,\n getDefaultOptions(config, runWindowsOptions),\n optionSanitizer,\n );\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n if (process.env.LocalAppData) {\n hasRunRnwDependencies = fs.existsSync(\n path.join(process.env.LocalAppData, 'rnw-dependencies.txt'),\n ); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n }\n\n let runWindowsError: Error | undefined;\n if (options.info) {\n runWindowsPhase = 'Info';\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach((version) => console.log(' ' + version));\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n newError(\n 'Unable to print environment info.\\n' + runWindowsError.toString(),\n );\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n return;\n }\n\n try {\n await runWindowsInternal(args, config, options);\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n}\n\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile: string | null;\n runWindowsPhase = 'FindSolution';\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n // Set up the callback to capture MSBuild properties after the command completes\n evaluateMSBuildPropsCallback = () => {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n if (verbose) {\n newInfo('Gathering MSBuild data for telemetry.');\n }\n\n const msBuildPropertiesJsonPath = path.resolve(\n path.dirname(projectFile),\n 'Generated Files',\n 'msbuildproperties.g.json',\n );\n\n if (fs.existsSync(msBuildPropertiesJsonPath)) {\n if (verbose) {\n newInfo('Loading properties from msbuildproperties.g.json');\n }\n return fs.readJsonFileSync(msBuildPropertiesJsonPath);\n }\n\n if (verbose) {\n newInfo('Unable to find msbuildproperties.g.json');\n }\n }\n\n return {};\n };\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n runWindowsPhase = 'RestorePackagesConfig';\n const buildType = deploy.getBuildConfiguration(options);\n try {\n await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);\n } catch (e) {\n newError(\n `Couldn't restore found packages.config instances. ${\n (e as Error).message\n }`,\n );\n throw e;\n }\n\n if (options.autolink) {\n runWindowsPhase = 'Autolink';\n try {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions: AutoLinkOptions = {\n logging: options.logging,\n check: false,\n proj: options.proj,\n sln: options.sln,\n telemetry: options.telemetry,\n };\n await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autoLinkOptions,\n );\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n } else {\n newInfo('Autolink step is skipped');\n }\n\n if (options.build) {\n runWindowsPhase = 'Build';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'Deploy';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
@@ -20,8 +20,9 @@ export default class MSBuildTools {
20
20
  */
21
21
  msbuildPath(): string;
22
22
  cleanProject(slnFile: string): void;
23
- restorePackageConfigs(slnFile: any): Promise<void>;
23
+ restorePackageConfigs(slnFile: any, buildArch: BuildArch, buildType: BuildConfig): Promise<void>;
24
24
  buildProject(slnFile: string, buildType: BuildConfig, buildArch: BuildArch, msBuildProps: Record<string, string>, verbose: boolean, target: 'build' | 'deploy', buildLogDirectory: string | undefined, singleproc?: boolean): Promise<void>;
25
25
  static findAvailableVersion(buildArch: BuildArch, verbose: boolean, prerelease?: boolean): MSBuildTools;
26
26
  static getAllAvailableUAPVersions(): Version[];
27
+ evaluateMSBuildProperties(solutionFile: string, projectFile: string, propertyNames?: string[], extraMsBuildProps?: Record<string, string>): Record<string, string>;
27
28
  }
@@ -62,7 +62,7 @@ class MSBuildTools {
62
62
  const results = child_process_1.default.execSync(cmd).toString().split(os_1.EOL);
63
63
  results.forEach((result) => console.log(chalk_1.default.white(result)));
64
64
  }
65
- async restorePackageConfigs(slnFile) {
65
+ async restorePackageConfigs(slnFile, buildArch, buildType) {
66
66
  const text = 'Restoring NuGet packages ';
67
67
  const spinner = (0, commandWithProgress_1.newSpinner)(text);
68
68
  await (0, commandWithProgress_1.commandWithProgress)(spinner, text, path_1.default.join(this.msbuildPath(), 'msbuild.exe'), [
@@ -70,6 +70,8 @@ class MSBuildTools {
70
70
  '/t:Restore',
71
71
  '/p:RestoreProjectStyle=PackagesConfig',
72
72
  '/p:RestorePackagesConfig=true',
73
+ `/p:Platform=${buildArch}`,
74
+ `/p:Configuration=${buildType}`,
73
75
  ], true, 'MSBuildError');
74
76
  }
75
77
  async buildProject(slnFile, buildType, buildArch, msBuildProps, verbose, target, buildLogDirectory, singleproc) {
@@ -163,7 +165,9 @@ class MSBuildTools {
163
165
  }
164
166
  const toolsPath = path_1.default.join(vsInstallation.installationPath, 'MSBuild/Current/Bin');
165
167
  if (fs_1.default.existsSync(toolsPath)) {
166
- (0, commandWithProgress_1.newSuccess)(`Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`);
168
+ if (verbose) {
169
+ (0, commandWithProgress_1.newSuccess)(`Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`);
170
+ }
167
171
  return new MSBuildTools(minVersion, vsInstallation.installationPath, vsInstallation.installationVersion);
168
172
  }
169
173
  else {
@@ -196,6 +200,34 @@ class MSBuildTools {
196
200
  .forEach((version) => version && results.push(version));
197
201
  return results;
198
202
  }
203
+ evaluateMSBuildProperties(solutionFile, projectFile, propertyNames, extraMsBuildProps) {
204
+ const spinner = (0, commandWithProgress_1.newSpinner)('Running Eval-MsBuildProperties.ps1');
205
+ try {
206
+ const msbuildEvalScriptPath = path_1.default.resolve(__dirname, '..', '..', '..', 'powershell', 'Eval-MsBuildProperties.ps1');
207
+ let command = `${commandWithProgress_1.powershell} -ExecutionPolicy Unrestricted -NoProfile "${msbuildEvalScriptPath}" -SolutionFile '${solutionFile}' -ProjectFile '${projectFile}' -MSBuildPath '${this.msbuildPath()}'`;
208
+ if (propertyNames && propertyNames.length > 0) {
209
+ command += ` -PropertyNames '${propertyNames.join(',')}'`;
210
+ }
211
+ if (extraMsBuildProps) {
212
+ command += " -ExtraMSBuildProps '";
213
+ for (const extraProp in extraMsBuildProps) {
214
+ if (!(extraProp in Object.prototype)) {
215
+ command += `,${extraProp}=${extraMsBuildProps[extraProp]}`;
216
+ }
217
+ }
218
+ command += "'";
219
+ }
220
+ const commandOutput = (0, child_process_2.execSync)(command).toString();
221
+ spinner.succeed();
222
+ const properties = JSON.parse(commandOutput);
223
+ spinner.succeed();
224
+ return properties;
225
+ }
226
+ catch (e) {
227
+ spinner.fail('Running Eval-MsBuildProperties.ps1 failed: ' + e.message);
228
+ throw e;
229
+ }
230
+ }
199
231
  }
200
232
  exports.default = MSBuildTools;
201
233
  function getVCToolsByArch(buildArch) {
@@ -1 +1 @@
1
- {"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../../src/runWindows/utils/msbuildtools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAiC;AACjC,kEAA0C;AAC1C,gDAAwB;AACxB,kEAA0C;AAC1C,kDAA0B;AAC1B,4CAAoB;AACpB,sDAA4B;AAC5B,wDAAgC;AAChC,uEAAyD;AACzD,+DAM+B;AAC/B,iDAAuC;AAEvC,6CAAiD;AACjD,+DAA2D;AAE3D,MAAqB,YAAY;IAC/B;;;;OAIG;IACH,YACkB,OAAe,EACf,gBAAwB,EACxB,mBAA2B;QAF3B,YAAO,GAAP,OAAO,CAAQ;QACf,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,wBAAmB,GAAnB,mBAAmB,CAAQ;IAC1C,CAAC;IAEJ;;OAEG;IACH,WAAW;QACT,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;IACjE,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,MAAM,GAAG,GAAG,IAAI,cAAI,CAAC,IAAI,CACvB,IAAI,CAAC,WAAW,EAAE,EAClB,aAAa,CACd,MAAM,OAAO,YAAY,CAAC;QAC3B,MAAM,OAAO,GAAG,uBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAG,CAAC,CAAC;QAClE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,OAAY;QACtC,MAAM,IAAI,GAAG,2BAA2B,CAAC;QACzC,MAAM,OAAO,GAAG,IA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AAC;KACjB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {totalmem, EOL} from 'os';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport child_process from 'child_process';\nimport chalk from 'chalk';\nimport os from 'os';\nimport shell from 'shelljs';\nimport Version from './version';\nimport * as checkRequirements from './checkRequirements';\nimport {\n commandWithProgress,\n newInfo,\n newSpinner,\n newSuccess,\n newError,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 16.0 for 2019\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 16.3.29411.108\n */\n constructor(\n public readonly version: string,\n public readonly installationPath: string,\n public readonly installationVersion: string,\n ) {}\n\n /**\n * @returns directory where x86 msbuild can be found\n */\n msbuildPath() {\n return path.join(this.installationPath, 'MSBuild/Current/Bin');\n }\n\n cleanProject(slnFile: string) {\n const cmd = `\"${path.join(\n this.msbuildPath(),\n 'msbuild.exe',\n )}\" \"${slnFile}\" /t:Clean`;\n const results = child_process.execSync(cmd).toString().split(EOL);\n results.forEach((result) => console.log(chalk.white(result)));\n }\n\n async restorePackageConfigs(slnFile: any) {\n const text = 'Restoring NuGet packages ';\n const spinner = newSpinner(text);\n await commandWithProgress(\n spinner,\n text,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [\n slnFile,\n '/t:Restore',\n '/p:RestoreProjectStyle=PackagesConfig',\n '/p:RestorePackagesConfig=true',\n ],\n true,\n 'MSBuildError',\n );\n }\n\n async buildProject(\n slnFile: string,\n buildType: BuildConfig,\n buildArch: BuildArch,\n msBuildProps: Record<string, string>,\n verbose: boolean,\n target: 'build' | 'deploy',\n buildLogDirectory: string | undefined,\n singleproc?: boolean,\n ) {\n newSuccess(`Found Solution: ${slnFile}`);\n newInfo(`Build configuration: ${buildType}`);\n newInfo(`Build platform: ${buildArch}`);\n\n const verbosityOption = verbose ? 'normal' : 'minimal';\n const logPrefix = path.join(\n buildLogDirectory || os.tmpdir(),\n `msbuild_${process.pid}_${target}`,\n );\n\n const errorLog = logPrefix + '.err';\n const warnLog = logPrefix + '.wrn';\n\n const localBinLog = target === 'build' ? '' : ':deploy.binlog';\n const binlog = buildLogDirectory ? `:${logPrefix}.binlog` : localBinLog;\n\n const args = [\n `/clp:NoSummary;NoItemAndPropertyList;Verbosity=${verbosityOption}`,\n '/nologo',\n `/p:Configuration=${buildType}`,\n `/p:Platform=${buildArch}`,\n '/p:AppxBundle=Never',\n `/bl${binlog}`,\n `/flp1:errorsonly;logfile=${errorLog}`,\n `/flp2:warningsonly;logfile=${warnLog}`,\n ];\n\n // Building projects in parallel increases compiler memory usage and\n // doesn't lead to dramatic performance gains (See #4739). Only enable\n // parallel builds on machines with >16GB of memory to avoid OOM errors\n const highMemory = totalmem() > 16 * 1024 * 1024 * 1024;\n const enableParallelBuilds = singleproc === false || highMemory;\n\n if (enableParallelBuilds) {\n args.push('/maxCpuCount');\n }\n\n if (target === 'build') {\n args.push('/restore', '/p:RestorePackagesConfig=true');\n } else {\n args.push(`/t:Deploy`);\n }\n\n Object.keys(msBuildProps).forEach((key) => {\n args.push(`/p:${key}=${msBuildProps[key]}`);\n });\n\n try {\n checkRequirements.isWinSdkPresent('10.0');\n } catch (e) {\n newError((e as Error).message);\n throw e;\n }\n\n if (verbose) {\n console.log(`Running MSBuild with args ${args.join(' ')}`);\n }\n\n const progressName =\n target === 'deploy' ? 'Deploying Solution' : 'Building Solution';\n const spinner = newSpinner(progressName);\n try {\n await commandWithProgress(\n spinner,\n progressName,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [slnFile].concat(args),\n verbose,\n 'MSBuildError',\n );\n } catch (e) {\n let error = e;\n if (!e) {\n const firstMessage = (await fs.readFile(errorLog))\n .toString()\n .split(EOL)[0];\n error = new CodedError('MSBuildError', firstMessage);\n (error as any).logfile = errorLog;\n }\n throw error;\n }\n // If we have no errors, delete the error log when we're done\n if ((await fs.stat(errorLog)).size === 0) {\n await fs.unlink(errorLog);\n }\n }\n\n static findAvailableVersion(\n buildArch: BuildArch,\n verbose: boolean,\n prerelease?: boolean,\n ): MSBuildTools {\n // https://aka.ms/vs/workloads\n const requires = [\n 'Microsoft.Component.MSBuild',\n getVCToolsByArch(buildArch),\n ];\n const minVersion = process.env.VisualStudioVersion || '16.7';\n const vsInstallation = findLatestVsInstall({\n requires,\n minVersion,\n verbose,\n prerelease,\n });\n\n if (!vsInstallation) {\n if (process.env.VisualStudioVersion != null) {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild tools not found for version ${process.env.VisualStudioVersion} (from environment). Make sure all required components have been installed`,\n {VisualStudioVersionFromEnv: process.env.VisualStudioVersion},\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `Could not find MSBuild with VCTools for Visual Studio ${minVersion} or later. Make sure all required components have been installed`,\n {minVersion: minVersion},\n );\n }\n }\n\n const toolsPath = path.join(\n vsInstallation.installationPath,\n 'MSBuild/Current/Bin',\n );\n\n if (fs.existsSync(toolsPath)) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\n return new MSBuildTools(\n minVersion,\n vsInstallation.installationPath,\n vsInstallation.installationVersion,\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild path '${toolsPath} does not exist'`,\n );\n }\n }\n\n static getAllAvailableUAPVersions(): Version[] {\n const results: Version[] = [];\n\n const programFilesFolder =\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;\n // No Program Files folder found, so we won't be able to find UAP SDK\n if (!programFilesFolder) {\n return results;\n }\n\n let uapFolderPath = path.join(\n programFilesFolder,\n 'Windows Kits',\n '10',\n 'Platforms',\n 'UAP',\n );\n\n if (!shell.test('-e', uapFolderPath)) {\n // Check other installation folder from reg\n const sdkFolder = getSDK10InstallationFolder();\n if (sdkFolder) {\n uapFolderPath = path.join(sdkFolder, 'Platforms', 'UAP');\n }\n }\n\n // No UAP SDK exists on this machine\n if (!shell.test('-e', uapFolderPath)) {\n return results;\n }\n\n shell\n .ls(uapFolderPath)\n .filter((uapDir) => shell.test('-d', path.join(uapFolderPath, uapDir)))\n .map(Version.tryParse)\n .forEach((version) => version && results.push(version));\n\n return results;\n }\n}\n\nfunction getVCToolsByArch(buildArch: BuildArch): string {\n switch (buildArch) {\n case 'x86':\n case 'x64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64';\n case 'ARM64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.ARM64';\n }\n}\n\nfunction getSDK10InstallationFolder(): string {\n const folder = '';\n\n const execString =\n 'reg query \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v10.0\" /s /v InstallationFolder /reg:32';\n let output;\n try {\n output = execSync(execString).toString();\n } catch (e) {\n return folder;\n }\n\n const re =\n /\\\\Microsoft SDKs\\\\Windows\\\\v10.0\\s*InstallationFolder\\s+REG_SZ\\s+(.*)/gim;\n const match = re.exec(output);\n if (match) {\n return match[1];\n }\n\n return folder;\n}\n"]}
1
+ {"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../../src/runWindows/utils/msbuildtools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAiC;AACjC,kEAA0C;AAC1C,gDAAwB;AACxB,kEAA0C;AAC1C,kDAA0B;AAC1B,4CAAoB;AACpB,sDAA4B;AAC5B,wDAAgC;AAChC,uEAAyD;AACzD,+DAO+B;AAC/B,iDAAuC;AAEvC,6CAAiD;AACjD,+DAA2D;AAE3D,MAAqB,YAAY;IAC/B;;;;OAIG;IACH,YACkB,OAAe,EACf,gBAAwB,EACxB,mBAA2B;QAF3B,YAAO,GAAP,OAAO,CAAQ;QACf,qBAA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,OAAO,EAAE,CAAC;YAClB,OAAO,UAAU,CAAC;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,6CAA6C,GAAI,CAAW,CAAC,OAAO,CACrE,CAAC;YACF,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AAtSD,+BAsSC;AAED,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,QAAQ,SAAS,EAAE;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,mDAAmD,CAAC;QAC7D,KAAK,OAAO;YACV,OAAO,iDAAiD,CAAC;KAC5D;AACH,CAAC;AAED,SAAS,0BAA0B;IACjC,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,MAAM,UAAU,GACd,wGAAwG,CAAC;IAC3G,IAAI,MAAM,CAAC;IACX,IAAI;QACF,MAAM,GAAG,IAAA,wBAAQ,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IAED,MAAM,EAAE,GACN,0EAA0E,CAAC;IAC7E,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {totalmem, EOL} from 'os';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport child_process from 'child_process';\nimport chalk from 'chalk';\nimport os from 'os';\nimport shell from 'shelljs';\nimport Version from './version';\nimport * as checkRequirements from './checkRequirements';\nimport {\n commandWithProgress,\n newInfo,\n newSpinner,\n newSuccess,\n newError,\n powershell,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 16.0 for 2019\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 16.3.29411.108\n */\n constructor(\n public readonly version: string,\n public readonly installationPath: string,\n public readonly installationVersion: string,\n ) {}\n\n /**\n * @returns directory where x86 msbuild can be found\n */\n msbuildPath() {\n return path.join(this.installationPath, 'MSBuild/Current/Bin');\n }\n\n cleanProject(slnFile: string) {\n const cmd = `\"${path.join(\n this.msbuildPath(),\n 'msbuild.exe',\n )}\" \"${slnFile}\" /t:Clean`;\n const results = child_process.execSync(cmd).toString().split(EOL);\n results.forEach((result) => console.log(chalk.white(result)));\n }\n\n async restorePackageConfigs(\n slnFile: any,\n buildArch: BuildArch,\n buildType: BuildConfig,\n ) {\n const text = 'Restoring NuGet packages ';\n const spinner = newSpinner(text);\n await commandWithProgress(\n spinner,\n text,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [\n slnFile,\n '/t:Restore',\n '/p:RestoreProjectStyle=PackagesConfig',\n '/p:RestorePackagesConfig=true',\n `/p:Platform=${buildArch}`,\n `/p:Configuration=${buildType}`,\n ],\n true,\n 'MSBuildError',\n );\n }\n\n async buildProject(\n slnFile: string,\n buildType: BuildConfig,\n buildArch: BuildArch,\n msBuildProps: Record<string, string>,\n verbose: boolean,\n target: 'build' | 'deploy',\n buildLogDirectory: string | undefined,\n singleproc?: boolean,\n ) {\n newSuccess(`Found Solution: ${slnFile}`);\n newInfo(`Build configuration: ${buildType}`);\n newInfo(`Build platform: ${buildArch}`);\n\n const verbosityOption = verbose ? 'normal' : 'minimal';\n const logPrefix = path.join(\n buildLogDirectory || os.tmpdir(),\n `msbuild_${process.pid}_${target}`,\n );\n\n const errorLog = logPrefix + '.err';\n const warnLog = logPrefix + '.wrn';\n\n const localBinLog = target === 'build' ? '' : ':deploy.binlog';\n const binlog = buildLogDirectory ? `:${logPrefix}.binlog` : localBinLog;\n\n const args = [\n `/clp:NoSummary;NoItemAndPropertyList;Verbosity=${verbosityOption}`,\n '/nologo',\n `/p:Configuration=${buildType}`,\n `/p:Platform=${buildArch}`,\n '/p:AppxBundle=Never',\n `/bl${binlog}`,\n `/flp1:errorsonly;logfile=${errorLog}`,\n `/flp2:warningsonly;logfile=${warnLog}`,\n ];\n\n // Building projects in parallel increases compiler memory usage and\n // doesn't lead to dramatic performance gains (See #4739). Only enable\n // parallel builds on machines with >16GB of memory to avoid OOM errors\n const highMemory = totalmem() > 16 * 1024 * 1024 * 1024;\n const enableParallelBuilds = singleproc === false || highMemory;\n\n if (enableParallelBuilds) {\n args.push('/maxCpuCount');\n }\n\n if (target === 'build') {\n args.push('/restore', '/p:RestorePackagesConfig=true');\n } else {\n args.push(`/t:Deploy`);\n }\n\n Object.keys(msBuildProps).forEach((key) => {\n args.push(`/p:${key}=${msBuildProps[key]}`);\n });\n\n try {\n checkRequirements.isWinSdkPresent('10.0');\n } catch (e) {\n newError((e as Error).message);\n throw e;\n }\n\n if (verbose) {\n console.log(`Running MSBuild with args ${args.join(' ')}`);\n }\n\n const progressName =\n target === 'deploy' ? 'Deploying Solution' : 'Building Solution';\n const spinner = newSpinner(progressName);\n try {\n await commandWithProgress(\n spinner,\n progressName,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [slnFile].concat(args),\n verbose,\n 'MSBuildError',\n );\n } catch (e) {\n let error = e;\n if (!e) {\n const firstMessage = (await fs.readFile(errorLog))\n .toString()\n .split(EOL)[0];\n error = new CodedError('MSBuildError', firstMessage);\n (error as any).logfile = errorLog;\n }\n throw error;\n }\n // If we have no errors, delete the error log when we're done\n if ((await fs.stat(errorLog)).size === 0) {\n await fs.unlink(errorLog);\n }\n }\n\n static findAvailableVersion(\n buildArch: BuildArch,\n verbose: boolean,\n prerelease?: boolean,\n ): MSBuildTools {\n // https://aka.ms/vs/workloads\n const requires = [\n 'Microsoft.Component.MSBuild',\n getVCToolsByArch(buildArch),\n ];\n const minVersion = process.env.VisualStudioVersion || '16.7';\n const vsInstallation = findLatestVsInstall({\n requires,\n minVersion,\n verbose,\n prerelease,\n });\n\n if (!vsInstallation) {\n if (process.env.VisualStudioVersion != null) {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild tools not found for version ${process.env.VisualStudioVersion} (from environment). Make sure all required components have been installed`,\n {VisualStudioVersionFromEnv: process.env.VisualStudioVersion},\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `Could not find MSBuild with VCTools for Visual Studio ${minVersion} or later. Make sure all required components have been installed`,\n {minVersion: minVersion},\n );\n }\n }\n\n const toolsPath = path.join(\n vsInstallation.installationPath,\n 'MSBuild/Current/Bin',\n );\n\n if (fs.existsSync(toolsPath)) {\n if (verbose) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\n }\n return new MSBuildTools(\n minVersion,\n vsInstallation.installationPath,\n vsInstallation.installationVersion,\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild path '${toolsPath} does not exist'`,\n );\n }\n }\n\n static getAllAvailableUAPVersions(): Version[] {\n const results: Version[] = [];\n\n const programFilesFolder =\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;\n // No Program Files folder found, so we won't be able to find UAP SDK\n if (!programFilesFolder) {\n return results;\n }\n\n let uapFolderPath = path.join(\n programFilesFolder,\n 'Windows Kits',\n '10',\n 'Platforms',\n 'UAP',\n );\n\n if (!shell.test('-e', uapFolderPath)) {\n // Check other installation folder from reg\n const sdkFolder = getSDK10InstallationFolder();\n if (sdkFolder) {\n uapFolderPath = path.join(sdkFolder, 'Platforms', 'UAP');\n }\n }\n\n // No UAP SDK exists on this machine\n if (!shell.test('-e', uapFolderPath)) {\n return results;\n }\n\n shell\n .ls(uapFolderPath)\n .filter((uapDir) => shell.test('-d', path.join(uapFolderPath, uapDir)))\n .map(Version.tryParse)\n .forEach((version) => version && results.push(version));\n\n return results;\n }\n\n evaluateMSBuildProperties(\n solutionFile: string,\n projectFile: string,\n propertyNames?: string[],\n extraMsBuildProps?: Record<string, string>,\n ): Record<string, string> {\n const spinner = newSpinner('Running Eval-MsBuildProperties.ps1');\n\n try {\n const msbuildEvalScriptPath = path.resolve(\n __dirname,\n '..',\n '..',\n '..',\n 'powershell',\n 'Eval-MsBuildProperties.ps1',\n );\n\n let command = `${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${msbuildEvalScriptPath}\" -SolutionFile '${solutionFile}' -ProjectFile '${projectFile}' -MSBuildPath '${this.msbuildPath()}'`;\n\n if (propertyNames && propertyNames.length > 0) {\n command += ` -PropertyNames '${propertyNames.join(',')}'`;\n }\n\n if (extraMsBuildProps) {\n command += \" -ExtraMSBuildProps '\";\n for (const extraProp in extraMsBuildProps) {\n if (!(extraProp in Object.prototype)) {\n command += `,${extraProp}=${extraMsBuildProps[extraProp]}`;\n }\n }\n command += \"'\";\n }\n\n const commandOutput = execSync(command).toString();\n spinner.succeed();\n\n const properties = JSON.parse(commandOutput) as Record<string, string>;\n spinner.succeed();\n return properties;\n } catch (e) {\n spinner.fail(\n 'Running Eval-MsBuildProperties.ps1 failed: ' + (e as Error).message,\n );\n throw e;\n }\n }\n}\n\nfunction getVCToolsByArch(buildArch: BuildArch): string {\n switch (buildArch) {\n case 'x86':\n case 'x64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64';\n case 'ARM64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.ARM64';\n }\n}\n\nfunction getSDK10InstallationFolder(): string {\n const folder = '';\n\n const execString =\n 'reg query \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v10.0\" /s /v InstallationFolder /reg:32';\n let output;\n try {\n output = execSync(execString).toString();\n } catch (e) {\n return folder;\n }\n\n const re =\n /\\\\Microsoft SDKs\\\\Windows\\\\v10.0\\s*InstallationFolder\\s+REG_SZ\\s+(.*)/gim;\n const match = re.exec(output);\n if (match) {\n return match[1];\n }\n\n return folder;\n}\n"]}
@@ -96,6 +96,10 @@ exports.startTelemetrySession = startTelemetrySession;
96
96
  * @param getExtraProps Function to get any extra command-specific telemetry properties.
97
97
  */
98
98
  async function endTelemetrySession(error, getExtraProps) {
99
+ if (!telemetry_1.Telemetry.isEnabled()) {
100
+ // Bail early so don't waste time here
101
+ return;
102
+ }
99
103
  const endInfo = {
100
104
  resultCode: 'Success',
101
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryHelpers.js","sourceRoot":"","sources":["../../../src/runWindows/utils/telemetryHelpers.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mCAAiC;AAQjC,+DAWyC;AAEzC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAc,EACd,cAA+B;IAE/B,MAAM,MAAM,GAAyB;QACnC,OAAO,EAAE,KAAK;KACf,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;QACnC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAChB,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS,IAAK,KAAsC,CAAC,IAAI,EAAE;YACvE,KAAK,GAAI,KAAsC,CAAC,MAAM,CAAC,CAAC;SACzD;QAED,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAC7B,qBAAqB;YACrB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxC,qBAAqB;SACtB;aAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YACpC,GAAG,GAAG,GAAG,C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,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAmB,EAAC,MAAM,CAAC,CAAC;IACtD,IAAI,WAAW,EAAE;QACf,qBAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;KACvC;IAED,MAAM,WAAW,GAAG,IAAA,oCAAwB,EAAC,MAAM,CAAC,CAAC;IACrD,IAAI,WAAW,EAAE;QACf,MAAM,qBAAS,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC;KAC3D;AACH,CAAC;AAzCD,sDAyCC;AAED;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CACvC,KAAa,EACb,aAAkD;IAElD,MAAM,OAAO,GAAmB;QAC9B,UAAU,EAAE,SAAS;KACtB,CAAC;IAEF,IAAI,KAAK,EAAE;QACT,OAAO,CAAC,UAAU;YAChB,KAAK,YAAY,sBAAU,CAAC,CAAC,CAAE,KAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;KACxE;IAED,qBAAS,CAAC,UAAU,CAClB,OAAO,EACP,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAClD,CAAC;AACJ,CAAC;AAjBD,kDAiBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {camelCase} from 'lodash';\n\nimport {\n Config,\n CommandOption,\n OptionValue,\n} from '@react-native-community/cli-types';\n\nimport {\n Telemetry,\n CodedError,\n CommandStartInfo,\n CommandEndInfo,\n CommanderOptionsType,\n commanderOptionsToOptions,\n optionsToArgs,\n OptionSanitizer,\n configToProjectInfo,\n getProjectFileFromConfig,\n} from '@react-native-windows/telemetry';\n\n/**\n * Calculates a the default values of a given react-native CLI command's options.\n * @param config Config passed from react-native CLI.\n * @param commandOptions The options definition for the command.\n * @returns The default options for the command.\n */\nexport function getDefaultOptions(\n config: Config,\n commandOptions: CommandOption[],\n): CommanderOptionsType {\n const result: CommanderOptionsType = {\n logging: false,\n };\n for (const option of commandOptions) {\n let key = option.name.startsWith('--')\n ? option.name.slice('--'.length)\n : option.name;\n key = key.trim();\n\n let value = option.default;\n if (value !== undefined && (value as (ctx: Config) => OptionValue).name) {\n value = (value as (ctx: Config) => OptionValue)(config);\n }\n\n if (key.endsWith(' [string]')) {\n // Option is a string\n key = key.slice(0, -' [string]'.length);\n // Option is a number\n } else if (key.endsWith(' [number]')) {\n key = key.slice(0, -' [number]'.length);\n } else {\n // Option is a boolean\n // Note: Commander ignores the default property for booleans\n if (key.startsWith('no-')) {\n key = key.slice('no-'.length);\n // Commander always defaults to true for flags that start with --no\n value = true;\n } else {\n // Commander always defaults to undefined for flags\n value = undefined;\n }\n }\n\n key = camelCase(key);\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Sets up and starts the telemetry gathering for the CLI command.\n * @param commandName The name of the CLI command.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n * @param defaultOptions Default options for the command.\n * @param optionSanitizer Function to sanitize the option values for telemetry.\n */\nexport async function startTelemetrySession(\n commandName: string,\n config: Config,\n options: CommanderOptionsType,\n defaultOptions: CommanderOptionsType,\n optionSanitizer: OptionSanitizer,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Telemetry is disabled');\n }\n return;\n }\n\n await Telemetry.setup();\n\n const sanitizedOptions = commanderOptionsToOptions(options, optionSanitizer);\n const sanitizedDefaultOptions = commanderOptionsToOptions(\n defaultOptions,\n optionSanitizer,\n );\n const sanitizedArgs = optionsToArgs(sanitizedOptions, process.argv);\n\n const startInfo: CommandStartInfo = {\n commandName,\n args: sanitizedArgs,\n options: sanitizedOptions,\n defaultOptions: sanitizedDefaultOptions,\n };\n\n Telemetry.startCommand(startInfo);\n\n const projectInfo = await configToProjectInfo(config);\n if (projectInfo) {\n Telemetry.setProjectInfo(projectInfo);\n }\n\n const projectFile = getProjectFileFromConfig(config);\n if (projectFile) {\n await Telemetry.populateNuGetPackageVersions(projectFile);\n }\n}\n\n/**\n * Ends the gathering of telemetry for the CLI command.\n * @param error The error (if any) thrown during the command.\n * @param getExtraProps Function to get any extra command-specific telemetry properties.\n */\nexport async function endTelemetrySession(\n error?: Error,\n getExtraProps?: () => Promise<Record<string, any>>,\n) {\n const endInfo: CommandEndInfo = {\n resultCode: 'Success',\n };\n\n if (error) {\n endInfo.resultCode =\n error instanceof CodedError ? (error as CodedError).type : 'Unknown';\n }\n\n Telemetry.endCommand(\n endInfo,\n getExtraProps ? await getExtraProps() : undefined,\n );\n}\n"]}
1
+ {"version":3,"file":"telemetryHelpers.js","sourceRoot":"","sources":["../../../src/runWindows/utils/telemetryHelpers.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mCAAiC;AAQjC,+DAWyC;AAEzC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAc,EACd,cAA+B;IAE/B,MAAM,MAAM,GAAyB;QACnC,OAAO,EAAE,KAAK;KACf,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;QACnC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAChB,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS,IAAK,KAAsC,CAAC,IAAI,EAAE;YACvE,KAAK,GAAI,KAAsC,CAAC,MAAM,CAAC,CAAC;SACzD;QAED,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAC7B,qBAAqB;YACrB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxC,qBAAqB;SACtB;aAAM,IAAI,GAAG,CAAC,QA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IAEF,qBAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAElC,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAmB,EAAC,MAAM,CAAC,CAAC;IACtD,IAAI,WAAW,EAAE;QACf,qBAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;KACvC;IAED,MAAM,WAAW,GAAG,IAAA,oCAAwB,EAAC,MAAM,CAAC,CAAC;IACrD,IAAI,WAAW,EAAE;QACf,MAAM,qBAAS,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC;KAC3D;AACH,CAAC;AAzCD,sDAyCC;AAED;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CACvC,KAAa,EACb,aAAkD;IAElD,IAAI,CAAC,qBAAS,CAAC,SAAS,EAAE,EAAE;QAC1B,sCAAsC;QACtC,OAAO;KACR;IAED,MAAM,OAAO,GAAmB;QAC9B,UAAU,EAAE,SAAS;KACtB,CAAC;IAEF,IAAI,KAAK,EAAE;QACT,OAAO,CAAC,UAAU;YAChB,KAAK,YAAY,sBAAU,CAAC,CAAC,CAAE,KAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;KACxE;IAED,qBAAS,CAAC,UAAU,CAClB,OAAO,EACP,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAClD,CAAC;AACJ,CAAC;AAtBD,kDAsBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {camelCase} from 'lodash';\n\nimport {\n Config,\n CommandOption,\n OptionValue,\n} from '@react-native-community/cli-types';\n\nimport {\n Telemetry,\n CodedError,\n CommandStartInfo,\n CommandEndInfo,\n CommanderOptionsType,\n commanderOptionsToOptions,\n optionsToArgs,\n OptionSanitizer,\n configToProjectInfo,\n getProjectFileFromConfig,\n} from '@react-native-windows/telemetry';\n\n/**\n * Calculates a the default values of a given react-native CLI command's options.\n * @param config Config passed from react-native CLI.\n * @param commandOptions The options definition for the command.\n * @returns The default options for the command.\n */\nexport function getDefaultOptions(\n config: Config,\n commandOptions: CommandOption[],\n): CommanderOptionsType {\n const result: CommanderOptionsType = {\n logging: false,\n };\n for (const option of commandOptions) {\n let key = option.name.startsWith('--')\n ? option.name.slice('--'.length)\n : option.name;\n key = key.trim();\n\n let value = option.default;\n if (value !== undefined && (value as (ctx: Config) => OptionValue).name) {\n value = (value as (ctx: Config) => OptionValue)(config);\n }\n\n if (key.endsWith(' [string]')) {\n // Option is a string\n key = key.slice(0, -' [string]'.length);\n // Option is a number\n } else if (key.endsWith(' [number]')) {\n key = key.slice(0, -' [number]'.length);\n } else {\n // Option is a boolean\n // Note: Commander ignores the default property for booleans\n if (key.startsWith('no-')) {\n key = key.slice('no-'.length);\n // Commander always defaults to true for flags that start with --no\n value = true;\n } else {\n // Commander always defaults to undefined for flags\n value = undefined;\n }\n }\n\n key = camelCase(key);\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Sets up and starts the telemetry gathering for the CLI command.\n * @param commandName The name of the CLI command.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n * @param defaultOptions Default options for the command.\n * @param optionSanitizer Function to sanitize the option values for telemetry.\n */\nexport async function startTelemetrySession(\n commandName: string,\n config: Config,\n options: CommanderOptionsType,\n defaultOptions: CommanderOptionsType,\n optionSanitizer: OptionSanitizer,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Telemetry is disabled');\n }\n return;\n }\n\n await Telemetry.setup();\n\n const sanitizedOptions = commanderOptionsToOptions(options, optionSanitizer);\n const sanitizedDefaultOptions = commanderOptionsToOptions(\n defaultOptions,\n optionSanitizer,\n );\n const sanitizedArgs = optionsToArgs(sanitizedOptions, process.argv);\n\n const startInfo: CommandStartInfo = {\n commandName,\n args: sanitizedArgs,\n options: sanitizedOptions,\n defaultOptions: sanitizedDefaultOptions,\n };\n\n Telemetry.startCommand(startInfo);\n\n const projectInfo = await configToProjectInfo(config);\n if (projectInfo) {\n Telemetry.setProjectInfo(projectInfo);\n }\n\n const projectFile = getProjectFileFromConfig(config);\n if (projectFile) {\n await Telemetry.populateNuGetPackageVersions(projectFile);\n }\n}\n\n/**\n * Ends the gathering of telemetry for the CLI command.\n * @param error The error (if any) thrown during the command.\n * @param getExtraProps Function to get any extra command-specific telemetry properties.\n */\nexport async function endTelemetrySession(\n error?: Error,\n getExtraProps?: () => Promise<Record<string, any>>,\n) {\n if (!Telemetry.isEnabled()) {\n // Bail early so don't waste time here\n return;\n }\n\n const endInfo: CommandEndInfo = {\n resultCode: 'Success',\n };\n\n if (error) {\n endInfo.resultCode =\n error instanceof CodedError ? (error as CodedError).type : 'Unknown';\n }\n\n Telemetry.endCommand(\n endInfo,\n getExtraProps ? await getExtraProps() : undefined,\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-windows/cli",
3
- "version": "0.68.0-preview.4",
3
+ "version": "0.68.0",
4
4
  "license": "MIT",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "repository": {
@@ -17,9 +17,9 @@
17
17
  "watch": "rnw-scripts watch"
18
18
  },
19
19
  "dependencies": {
20
- "@react-native-windows/fs": "0.68.0-preview.2",
21
- "@react-native-windows/package-utils": "0.68.0-preview.2",
22
- "@react-native-windows/telemetry": "0.68.0-preview.2",
20
+ "@react-native-windows/fs": "0.68.0",
21
+ "@react-native-windows/package-utils": "0.68.0",
22
+ "@react-native-windows/telemetry": "0.68.0",
23
23
  "@xmldom/xmldom": "^0.7.5",
24
24
  "chalk": "^4.1.0",
25
25
  "cli-spinners": "^2.2.0",
@@ -68,11 +68,11 @@
68
68
  "powershell"
69
69
  ],
70
70
  "beachball": {
71
- "defaultNpmTag": "preview",
71
+ "defaultNpmTag": "latest",
72
72
  "disallowedChangeTypes": [
73
73
  "major",
74
74
  "minor",
75
- "patch"
75
+ "prerelease"
76
76
  ]
77
77
  },
78
78
  "promoteRelease": true,
@@ -0,0 +1,156 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+ #
4
+ # Eval-MsBuildProperties.ps1
5
+ #
6
+ # This script lets you determine the final values of MSBUILD properties for a
7
+ # given solution and project file. Simply pass in a comma delimited list of
8
+ # property names and you'll get a JSON blob of evaluated values.
9
+ #
10
+ # For example, from the root of the repo:
11
+ #
12
+ # .\packages\@react-native-windows\cli\powershell\Eval-MsBuildProperties.ps1 -SolutionFile 'vnext\Microsoft.ReactNative.sln' -ProjectFile 'vnext\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj' -PropertyNames 'ProjectGUID,ProjectName'
13
+ #
14
+ # will output:
15
+ #
16
+ # {
17
+ # "ProjectGuid": "{f7d32bd0-2749-483e-9a0d-1635ef7e3136}",
18
+ # "ProjectName": "Microsoft.ReactNative"
19
+ # }
20
+ #
21
+
22
+ param(
23
+ [Parameter(Mandatory = $true)]
24
+ [String]$SolutionFile,
25
+ [Parameter(Mandatory = $true)]
26
+ [String]$ProjectFile,
27
+ [Parameter()]
28
+ [String]$PropertyNames = "",
29
+ [Parameter()]
30
+ [String]$MSBuildPath,
31
+ [Parameter()]
32
+ [String]$ExtraMSBuildProps
33
+ )
34
+
35
+ function Get-MSBuildPath {
36
+ $vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
37
+ if (!(Test-Path $vsWhere)) {
38
+ throw "Unable to find vswhere.exe."
39
+ }
40
+ $vsPath = & $vsWhere -version 16.5 -property installationPath;
41
+ return "$vsPath\MSBuild\Current\Bin";
42
+ }
43
+
44
+ function Get-MSBuildProperties {
45
+ param (
46
+ [Parameter(Mandatory = $true)]
47
+ [String]$MSBuildPath,
48
+ [Parameter(Mandatory = $true)]
49
+ [String]$SolutionPath,
50
+ [Parameter(Mandatory = $true)]
51
+ [String]$ProjectPath,
52
+ [Parameter()]
53
+ [String[]]$PropertyNames = @(),
54
+ [Parameter()]
55
+ [String]$ExtraMSBuildProps
56
+ )
57
+
58
+ if (!(Test-Path (Join-Path $MSBuildPath "MSBuild.exe"))) {
59
+ throw "Unable to find MSBuild.exe in $MSBuildPath"
60
+ }
61
+
62
+ if (!(Test-Path (Join-Path $MSBuildPath "MSBuild.exe"))) {
63
+ throw "Unable to find Microsoft.Build.dll in $MSBuildPath"
64
+ }
65
+
66
+ # Method to intercept resolution of assemblies to add MSBuild's path
67
+ $onAssemblyResolveEventHandler = [System.ResolveEventHandler] {
68
+ param($s, $e)
69
+
70
+ # Figure out which assembly to look for
71
+ $assemblyName = $e.Name.Substring(0, $e.Name.IndexOf(", "));
72
+ $assemblyPath = "$MSBuildPath\$assemblyName.dll"
73
+
74
+ # Search for the assembly in the MSBuild directory
75
+ if (Test-Path $assemblyPath) {
76
+ # Found the assembly!
77
+ return [System.Reflection.Assembly]::LoadFrom("$MSBuildPath\$assemblyName.dll");
78
+ }
79
+
80
+ # Unable to find the assembly
81
+ return $null
82
+ }
83
+
84
+ # Wire-up assembly resolution event handler
85
+ [System.AppDomain]::CurrentDomain.add_AssemblyResolve($onAssemblyResolveEventHandler)
86
+
87
+ # Load Microsoft.Build.dll into script
88
+ Add-Type -Path "$MSBuildPath\Microsoft.Build.dll" | Out-Null
89
+
90
+ # Build a local project collection
91
+ $projectCollection = [Microsoft.Build.Evaluation.ProjectCollection]::new()
92
+
93
+ try {
94
+ # Build a temporary "metaproj" of the solution file so it can be processed
95
+ ${env:MSBUILDEMITSOLUTION} = 1
96
+ & $MSBuildPath\MSBuild.exe $SolutionPath | Out-Null
97
+
98
+ # Process solution
99
+ $solution = [Microsoft.Build.Evaluation.Project]::new("$SolutionPath.metaproj", $null, "Current", $projectCollection)
100
+ }
101
+ finally {
102
+ # Clean up "metaproj" files
103
+ ${env:MSBUILDEMITSOLUTION} = 0
104
+ Remove-Item -Path @("$SolutionPath.metaproj", "$SolutionPath.metaproj.tmp") | Out-Null
105
+ Get-ChildItem * -Include *.metaproj -Recurse | Remove-Item | Out-Null
106
+ }
107
+
108
+ # Evaluate all of the Solution* properties and save into a collection
109
+ $globalProps = New-Object 'System.Collections.Generic.Dictionary[String,String]'
110
+ $solution.Properties | ForEach-Object -Process {
111
+ if ($_.Name.StartsWith("Solution")) {
112
+ $globalProps.Add($_.Name, $_.EvaluatedValue)
113
+ }
114
+ }
115
+
116
+ # Evaluate all extra build props and save into the collection
117
+ $extraPropsTable = ConvertFrom-StringData -StringData $ExtraMSBuildProps.Replace(',', "`n")
118
+ $extraPropsTable.Keys | ForEach-Object -Process {
119
+ $globalProps[$_] = $extraPropsTable[$_]
120
+ }
121
+
122
+ # Process the project file (with the Solution* properties we calculated before)
123
+ $project = [Microsoft.Build.Evaluation.Project]::new("$ProjectPath", $globalProps, "Current", $projectCollection)
124
+
125
+ # Create object to hold evaluated property key value pairs
126
+ $evaluatedProps = @{}
127
+
128
+ # Look for the specified PropertyNames and evaluate them
129
+ $project.Properties | ForEach-Object -Process {
130
+ if (($PropertyNames.Length -eq 0) -or ($PropertyNames -contains $_.Name)) {
131
+ $evaluatedProps[$_.Name] = $_.EvaluatedValue;
132
+ }
133
+ }
134
+
135
+ # Output as JSON
136
+ Write-Output (ConvertTo-Json $evaluatedProps)
137
+ }
138
+
139
+ # Main
140
+
141
+ if ($MSBuildPath -and (Test-Path $MSBuildPath)) {
142
+ if (Test-Path $MSBuildPath -PathType Leaf) {
143
+ # It's a file (probably msbuild.exe), just get the folder path
144
+ $MSBuildPath = [System.IO.Path]::GetDirectoryName($MSBuildPath)
145
+ }
146
+ }
147
+ else {
148
+ # Use simple fallback logic in this script to find MSBuild path
149
+ $MSBuildPath = Get-MSBuildPath
150
+ }
151
+
152
+ # Get the full absolute paths to the solution and projects
153
+ $SolutionPath = Convert-Path $SolutionFile
154
+ $ProjectPath = Convert-Path $ProjectFile
155
+
156
+ Get-MSBuildProperties -MSBuildPath $MSBuildPath -SolutionPath $SolutionPath -ProjectPath $ProjectPath -PropertyNames $PropertyNames.Split(',', [System.StringSplitOptions]::RemoveEmptyEntries) -ExtraMSBuildProps $ExtraMSBuildProps