@react-native-windows/cli 0.0.0-canary.11 → 0.0.0-canary.113
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.
- package/README.md +49 -0
- package/lib-commonjs/config/configUtils.d.ts +25 -2
- package/lib-commonjs/config/configUtils.js +119 -30
- package/lib-commonjs/config/configUtils.js.map +1 -1
- package/lib-commonjs/config/dependencyConfig.js +101 -44
- package/lib-commonjs/config/dependencyConfig.js.map +1 -1
- package/lib-commonjs/config/projectConfig.d.ts +4 -1
- package/lib-commonjs/config/projectConfig.js +68 -12
- package/lib-commonjs/config/projectConfig.js.map +1 -1
- package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
- package/lib-commonjs/e2etest/autolink.test.js +435 -0
- package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js +162 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/projectConfig.test.js +123 -0
- package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.utils.d.ts +4 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js +56 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
- package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
- package/lib-commonjs/e2etest/runWindows.test.js +61 -0
- package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
- package/lib-commonjs/generator-common/index.d.ts +16 -0
- package/lib-commonjs/generator-common/index.js +65 -44
- package/lib-commonjs/generator-common/index.js.map +1 -1
- package/lib-commonjs/generator-windows/index.d.ts +2 -2
- package/lib-commonjs/generator-windows/index.js +248 -155
- package/lib-commonjs/generator-windows/index.js.map +1 -1
- package/lib-commonjs/healthChecks.d.ts +2 -0
- package/lib-commonjs/healthChecks.js +88 -0
- package/lib-commonjs/healthChecks.js.map +1 -0
- package/lib-commonjs/index.d.ts +5 -0
- package/lib-commonjs/index.js +24 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/runWindows/runWindows.js +211 -53
- package/lib-commonjs/runWindows/runWindows.js.map +1 -1
- package/lib-commonjs/runWindows/runWindowsOptions.d.ts +14 -10
- package/lib-commonjs/runWindows/runWindowsOptions.js +16 -12
- package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
- package/lib-commonjs/runWindows/utils/autolink.d.ts +88 -1
- package/lib-commonjs/runWindows/utils/autolink.js +596 -265
- package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
- package/lib-commonjs/runWindows/utils/build.d.ts +1 -2
- package/lib-commonjs/runWindows/utils/build.js +25 -32
- package/lib-commonjs/runWindows/utils/build.js.map +1 -1
- package/lib-commonjs/runWindows/utils/checkRequirements.js +12 -8
- package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
- package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +11 -3
- package/lib-commonjs/runWindows/utils/commandWithProgress.js +60 -25
- package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
- package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
- package/lib-commonjs/runWindows/utils/deploy.js +167 -85
- package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
- package/lib-commonjs/runWindows/utils/info.js +5 -2
- package/lib-commonjs/runWindows/utils/info.js.map +1 -1
- package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +10 -5
- package/lib-commonjs/runWindows/utils/msbuildtools.js +98 -61
- package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
- package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js +109 -0
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
- package/lib-commonjs/runWindows/utils/version.d.ts +4 -4
- package/lib-commonjs/runWindows/utils/version.js +1 -1
- package/lib-commonjs/runWindows/utils/version.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.d.ts +4 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.js +22 -7
- package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vstools.d.ts +1 -0
- package/lib-commonjs/runWindows/utils/vstools.js +42 -29
- package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
- package/lib-commonjs/runWindows/utils/winappdeploytool.d.ts +3 -3
- package/lib-commonjs/runWindows/utils/winappdeploytool.js +19 -16
- package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
- package/package.json +42 -25
- package/powershell/Add-AppDevPackage.ps1 +2 -2
- package/powershell/WindowsStoreAppUtils.ps1 +10 -0
- package/CHANGELOG.json +0 -170
- package/CHANGELOG.md +0 -85
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @react-native-windows/cli
|
|
2
|
+
|
|
3
|
+
CLI to build and run React Native for Windows apps.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Run this from an existing `react-native` project with React Native Windows to build and deploy apps.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Example usage
|
|
11
|
+
```
|
|
12
|
+
npx react-native run-windows
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
| option | description | type |
|
|
17
|
+
|-----------------------|--------------------------------------|--------------------------------------------------|
|
|
18
|
+
| `--release` | Specifies a Release build | [boolean] |
|
|
19
|
+
| `--root` | Override the root directory for the windows build which contains the windows folder. (default: "E:\\test63") | [string] |
|
|
20
|
+
| `--arch` | The build architecture (ARM64, x86, x64). defaults to system architecture | [string] |
|
|
21
|
+
| `--singleproc` | Disables multi-proc build | [boolean] |
|
|
22
|
+
| `--emulator` | Deploys the app to an emulator | [boolean] |
|
|
23
|
+
| `--device` | Deploys the app to a connected device | [boolean] |
|
|
24
|
+
| `--target` | Deploys the app to the specified GUID for a device | [string] |
|
|
25
|
+
| `--remote-debugging` | Deploys the app in remote debugging mode. | [boolean] |
|
|
26
|
+
| `--logging` | Enables logging | [boolean] |
|
|
27
|
+
| `--no-packager` | Do not launch packager while building | [boolean] |
|
|
28
|
+
| `--bundle` | Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug | [boolean] |
|
|
29
|
+
| `--no-launch` | Do not launch the app after deployment | [boolean] |
|
|
30
|
+
| `--no-autolink` | Do not run autolinking | [boolean] |
|
|
31
|
+
| `--no-build` | Do not build the solution | [boolean] |
|
|
32
|
+
| `--no-deploy` | Do not deploy the app | [boolean] |
|
|
33
|
+
| `--deploy-from-layout`| Force deploy from layout, even in release builds | [boolean] |
|
|
34
|
+
| `--sln` | Override the app solution file determined by 'react-native config', e.g. windows\myApp.sln | [string] |
|
|
35
|
+
| `--proj` | Override the app project file determined by 'react-native config', e.g. windows\myApp\myApp.vcxproj | [string] |
|
|
36
|
+
| `--msbuildprops` | Comma separated props to pass to MSBuild, eg: prop1=value1,prop2=value2 | [string] |
|
|
37
|
+
| `--buildLogDirectory` | Optional directory where MSBuild log files should be stored | [string] |
|
|
38
|
+
| `--info` | Dump environment information | [boolean] |
|
|
39
|
+
| `--direct-debugging` | Enable direct debugging on specified port | [number] |
|
|
40
|
+
| `--useWinUI3` | Targets WinUI 3.0 (Preview) instead of UWP XAML. | [boolean] |
|
|
41
|
+
| `--useHermes` | Use Hermes instead of Chakra as the JS engine (supported on 0.64+) | [boolean] |
|
|
42
|
+
| `--no-telemetry` | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI | [boolean] |
|
|
43
|
+
| `-h`, `--help` | output usage information | [boolean] |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Data Collection
|
|
47
|
+
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
|
48
|
+
|
|
49
|
+
This data collection notice only applies to the process of running the react-native-windows CLI (run-windows and related tools like autolinking).
|
|
@@ -64,7 +64,8 @@ export declare function readProjectFile(projectPath: string): Document;
|
|
|
64
64
|
* @param propertyName The property to look for.
|
|
65
65
|
* @return The value of the tag if it exists.
|
|
66
66
|
*/
|
|
67
|
-
export declare function
|
|
67
|
+
export declare function tryFindPropertyValue(projectContents: Node, propertyName: string): string | null;
|
|
68
|
+
export declare function findPropertyValue(projectContents: Node, propertyName: string, filePath: string): string;
|
|
68
69
|
/**
|
|
69
70
|
* Search for the given import project in the project contents and return if it exists.
|
|
70
71
|
* @param projectContents The XML project contents.
|
|
@@ -72,13 +73,34 @@ export declare function findPropertyValue(projectContents: Node, propertyName: s
|
|
|
72
73
|
* @return If the target exists.
|
|
73
74
|
*/
|
|
74
75
|
export declare function importProjectExists(projectContents: Node, projectName: string): boolean;
|
|
76
|
+
export declare type ConfigurationType = 'application' | 'dynamiclibrary' | 'generic' | 'staticlibrary' | 'unknown';
|
|
77
|
+
/**
|
|
78
|
+
* Gets the configuration type of the project from the project contents.
|
|
79
|
+
* @param projectContents The XML project contents.
|
|
80
|
+
* @return The project configuration type.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getConfigurationType(projectContents: Node): ConfigurationType;
|
|
83
|
+
export declare type OutputType = 'appcontainerexe' | 'exe' | 'library' | 'module' | 'unknown' | 'winexe' | 'winmdobj';
|
|
84
|
+
/**
|
|
85
|
+
* Gets the output type of the project from the project contents.
|
|
86
|
+
* @param projectContents The XML project contents.
|
|
87
|
+
* @return The project output type.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getOutputType(projectContents: Node): OutputType;
|
|
90
|
+
/**
|
|
91
|
+
* Gets the type of the project from the project contents.
|
|
92
|
+
* @param projectPath The project file path to check.
|
|
93
|
+
* @param projectContents The XML project contents.
|
|
94
|
+
* @return The project type.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getProjectType(projectPath: string, projectContents: Node): ConfigurationType | OutputType;
|
|
75
97
|
/**
|
|
76
98
|
* Gets the name of the project from the project contents.
|
|
77
99
|
* @param projectPath The project file path to check.
|
|
78
100
|
* @param projectContents The XML project contents.
|
|
79
101
|
* @return The project name.
|
|
80
102
|
*/
|
|
81
|
-
export declare function getProjectName(projectContents: Node): string;
|
|
103
|
+
export declare function getProjectName(projectPath: string, projectContents: Node): string;
|
|
82
104
|
/**
|
|
83
105
|
* Gets the namespace of the project from the project contents.
|
|
84
106
|
* @param projectContents The XML project contents.
|
|
@@ -91,3 +113,4 @@ export declare function getProjectNamespace(projectContents: Node): string | nul
|
|
|
91
113
|
* @return The project guid.
|
|
92
114
|
*/
|
|
93
115
|
export declare function getProjectGuid(projectContents: Node): string | null;
|
|
116
|
+
export declare function getExperimentalFeatures(solutionDir: string): Record<string, string> | undefined;
|
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
7
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getProjectGuid = exports.getProjectNamespace = exports.getProjectName = exports.importProjectExists = exports.findPropertyValue = exports.readProjectFile = exports.getProjectLanguage = exports.findAppProjectFiles = exports.findDependencyProjectFiles = exports.isRnwDependencyProject = exports.findSolutionFiles = exports.isRnwSolution = exports.findWindowsFolder = exports.findFiles = void 0;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const xmldom_1 = require("xmldom");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
exports.getExperimentalFeatures = exports.getProjectGuid = exports.getProjectNamespace = exports.getProjectName = exports.getProjectType = exports.getOutputType = exports.getConfigurationType = exports.importProjectExists = exports.findPropertyValue = exports.tryFindPropertyValue = exports.readProjectFile = exports.getProjectLanguage = exports.findAppProjectFiles = exports.findDependencyProjectFiles = exports.isRnwDependencyProject = exports.findSolutionFiles = exports.isRnwSolution = exports.findWindowsFolder = exports.findFiles = void 0;
|
|
12
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const glob_1 = __importDefault(require("glob"));
|
|
15
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
16
|
+
const xpath_1 = __importDefault(require("xpath"));
|
|
17
|
+
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
18
|
+
const msbuildSelect = xpath_1.default.useNamespaces({
|
|
15
19
|
msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',
|
|
16
20
|
});
|
|
17
21
|
/**
|
|
@@ -21,13 +25,12 @@ const msbuildSelect = xpath.useNamespaces({
|
|
|
21
25
|
* @return Return the array of relative file paths.
|
|
22
26
|
*/
|
|
23
27
|
function findFiles(folder, filenamePattern) {
|
|
24
|
-
const files =
|
|
28
|
+
const files = glob_1.default.sync(path_1.default.join('**', filenamePattern), {
|
|
25
29
|
cwd: folder,
|
|
26
30
|
ignore: [
|
|
27
31
|
'node_modules/**',
|
|
28
32
|
'**/Debug/**',
|
|
29
33
|
'**/Release/**',
|
|
30
|
-
'**/WinUI3/**',
|
|
31
34
|
'**/Generated Files/**',
|
|
32
35
|
'**/packages/**',
|
|
33
36
|
],
|
|
@@ -42,8 +45,8 @@ exports.findFiles = findFiles;
|
|
|
42
45
|
*/
|
|
43
46
|
function findWindowsFolder(folder) {
|
|
44
47
|
const winDir = 'windows';
|
|
45
|
-
const joinedDir =
|
|
46
|
-
if (
|
|
48
|
+
const joinedDir = path_1.default.join(folder, winDir);
|
|
49
|
+
if (fs_1.default.existsSync(joinedDir)) {
|
|
47
50
|
return joinedDir;
|
|
48
51
|
}
|
|
49
52
|
return null;
|
|
@@ -55,7 +58,7 @@ exports.findWindowsFolder = findWindowsFolder;
|
|
|
55
58
|
* @return Whether the path is to a RNW solution file.
|
|
56
59
|
*/
|
|
57
60
|
function isRnwSolution(filePath) {
|
|
58
|
-
return (
|
|
61
|
+
return (fs_1.default
|
|
59
62
|
.readFileSync(filePath)
|
|
60
63
|
.toString()
|
|
61
64
|
.search(/ReactNative/) > 0);
|
|
@@ -77,11 +80,11 @@ function findSolutionFiles(winFolder) {
|
|
|
77
80
|
// If there is exactly one solution file, assume it's it
|
|
78
81
|
return [allSolutions[0]];
|
|
79
82
|
}
|
|
80
|
-
|
|
83
|
+
const solutionFiles = [];
|
|
81
84
|
// Try to find any solution file that appears to be a React Native solution
|
|
82
85
|
for (const solutionFile of allSolutions) {
|
|
83
|
-
if (isRnwSolution(
|
|
84
|
-
solutionFiles.push(solutionFile);
|
|
86
|
+
if (isRnwSolution(path_1.default.join(winFolder, solutionFile))) {
|
|
87
|
+
solutionFiles.push(path_1.default.normalize(solutionFile));
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
return solutionFiles;
|
|
@@ -118,11 +121,17 @@ function findDependencyProjectFiles(winFolder) {
|
|
|
118
121
|
// If there're no project files, return 0
|
|
119
122
|
return [];
|
|
120
123
|
}
|
|
121
|
-
|
|
124
|
+
const dependencyProjectFiles = [];
|
|
122
125
|
// Try to find any project file that appears to be a dependency project
|
|
123
126
|
for (const projectFile of allProjects) {
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
// A project is marked as a RNW dependency iff either:
|
|
128
|
+
// - If the project has the standard native module imports, or
|
|
129
|
+
// - If we only have a single project (and it doesn't have the standard native module imports),
|
|
130
|
+
// pick it and hope for the best. This enables autolinking for modules that were written
|
|
131
|
+
// before the standard native module template existed.
|
|
132
|
+
if (allProjects.length === 1 ||
|
|
133
|
+
isRnwDependencyProject(path_1.default.join(winFolder, projectFile))) {
|
|
134
|
+
dependencyProjectFiles.push(path_1.default.normalize(projectFile));
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
return dependencyProjectFiles;
|
|
@@ -158,11 +167,11 @@ function findAppProjectFiles(winFolder) {
|
|
|
158
167
|
// If there're no project files, return 0
|
|
159
168
|
return [];
|
|
160
169
|
}
|
|
161
|
-
|
|
170
|
+
const appProjectFiles = [];
|
|
162
171
|
// Try to find any project file that appears to be an app project
|
|
163
172
|
for (const projectFile of allProjects) {
|
|
164
|
-
if (isRnwAppProject(
|
|
165
|
-
appProjectFiles.push(projectFile);
|
|
173
|
+
if (isRnwAppProject(path_1.default.join(winFolder, projectFile))) {
|
|
174
|
+
appProjectFiles.push(path_1.default.normalize(projectFile));
|
|
166
175
|
}
|
|
167
176
|
}
|
|
168
177
|
return appProjectFiles;
|
|
@@ -189,7 +198,7 @@ exports.getProjectLanguage = getProjectLanguage;
|
|
|
189
198
|
* @return The project file contents.
|
|
190
199
|
*/
|
|
191
200
|
function readProjectFile(projectPath) {
|
|
192
|
-
const projectContents =
|
|
201
|
+
const projectContents = fs_1.default.readFileSync(projectPath, 'utf8').toString();
|
|
193
202
|
return new xmldom_1.DOMParser().parseFromString(projectContents, 'application/xml');
|
|
194
203
|
}
|
|
195
204
|
exports.readProjectFile = readProjectFile;
|
|
@@ -199,14 +208,22 @@ exports.readProjectFile = readProjectFile;
|
|
|
199
208
|
* @param propertyName The property to look for.
|
|
200
209
|
* @return The value of the tag if it exists.
|
|
201
210
|
*/
|
|
202
|
-
function
|
|
203
|
-
|
|
211
|
+
function tryFindPropertyValue(projectContents, propertyName) {
|
|
212
|
+
const nodes = msbuildSelect(`//msbuild:PropertyGroup/msbuild:${propertyName}`, projectContents);
|
|
204
213
|
if (nodes.length > 0) {
|
|
205
214
|
// Take the last one
|
|
206
215
|
return nodes[nodes.length - 1].textContent;
|
|
207
216
|
}
|
|
208
217
|
return null;
|
|
209
218
|
}
|
|
219
|
+
exports.tryFindPropertyValue = tryFindPropertyValue;
|
|
220
|
+
function findPropertyValue(projectContents, propertyName, filePath) {
|
|
221
|
+
const res = tryFindPropertyValue(projectContents, propertyName);
|
|
222
|
+
if (!res) {
|
|
223
|
+
throw new telemetry_1.CodedError('NoPropertyInProject', `Couldn't find property ${propertyName} from ${filePath}`, { propertyName: propertyName });
|
|
224
|
+
}
|
|
225
|
+
return res;
|
|
226
|
+
}
|
|
210
227
|
exports.findPropertyValue = findPropertyValue;
|
|
211
228
|
/**
|
|
212
229
|
* Search for the given import project in the project contents and return if it exists.
|
|
@@ -215,19 +232,76 @@ exports.findPropertyValue = findPropertyValue;
|
|
|
215
232
|
* @return If the target exists.
|
|
216
233
|
*/
|
|
217
234
|
function importProjectExists(projectContents, projectName) {
|
|
218
|
-
|
|
235
|
+
const nodes = msbuildSelect(`//msbuild:Import[contains(@Project,'${projectName}')]`, projectContents);
|
|
219
236
|
return nodes.length > 0;
|
|
220
237
|
}
|
|
221
238
|
exports.importProjectExists = importProjectExists;
|
|
239
|
+
/**
|
|
240
|
+
* Gets the configuration type of the project from the project contents.
|
|
241
|
+
* @param projectContents The XML project contents.
|
|
242
|
+
* @return The project configuration type.
|
|
243
|
+
*/
|
|
244
|
+
function getConfigurationType(projectContents) {
|
|
245
|
+
var _a;
|
|
246
|
+
const configurationType = (_a = tryFindPropertyValue(projectContents, 'ConfigurationType')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
247
|
+
switch (configurationType) {
|
|
248
|
+
case 'application':
|
|
249
|
+
case 'dynamiclibrary':
|
|
250
|
+
case 'generic':
|
|
251
|
+
case 'staticlibrary':
|
|
252
|
+
return configurationType;
|
|
253
|
+
default:
|
|
254
|
+
return 'unknown';
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.getConfigurationType = getConfigurationType;
|
|
258
|
+
/**
|
|
259
|
+
* Gets the output type of the project from the project contents.
|
|
260
|
+
* @param projectContents The XML project contents.
|
|
261
|
+
* @return The project output type.
|
|
262
|
+
*/
|
|
263
|
+
function getOutputType(projectContents) {
|
|
264
|
+
var _a;
|
|
265
|
+
const outputType = (_a = tryFindPropertyValue(projectContents, 'OutputType')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
266
|
+
switch (outputType) {
|
|
267
|
+
case 'appcontainerexe':
|
|
268
|
+
case 'exe':
|
|
269
|
+
case 'library':
|
|
270
|
+
case 'module':
|
|
271
|
+
case 'winexe':
|
|
272
|
+
case 'winmdobj':
|
|
273
|
+
return outputType;
|
|
274
|
+
default:
|
|
275
|
+
return 'unknown';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.getOutputType = getOutputType;
|
|
279
|
+
/**
|
|
280
|
+
* Gets the type of the project from the project contents.
|
|
281
|
+
* @param projectPath The project file path to check.
|
|
282
|
+
* @param projectContents The XML project contents.
|
|
283
|
+
* @return The project type.
|
|
284
|
+
*/
|
|
285
|
+
function getProjectType(projectPath, projectContents) {
|
|
286
|
+
switch (getProjectLanguage(projectPath)) {
|
|
287
|
+
case 'cpp':
|
|
288
|
+
return getConfigurationType(projectContents);
|
|
289
|
+
case 'cs':
|
|
290
|
+
return getOutputType(projectContents);
|
|
291
|
+
default:
|
|
292
|
+
return 'unknown';
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.getProjectType = getProjectType;
|
|
222
296
|
/**
|
|
223
297
|
* Gets the name of the project from the project contents.
|
|
224
298
|
* @param projectPath The project file path to check.
|
|
225
299
|
* @param projectContents The XML project contents.
|
|
226
300
|
* @return The project name.
|
|
227
301
|
*/
|
|
228
|
-
function getProjectName(projectContents) {
|
|
229
|
-
const name =
|
|
230
|
-
|
|
302
|
+
function getProjectName(projectPath, projectContents) {
|
|
303
|
+
const name = tryFindPropertyValue(projectContents, 'ProjectName') ||
|
|
304
|
+
path_1.default.parse(projectPath).name ||
|
|
231
305
|
'';
|
|
232
306
|
return name;
|
|
233
307
|
}
|
|
@@ -238,7 +312,7 @@ exports.getProjectName = getProjectName;
|
|
|
238
312
|
* @return The project namespace.
|
|
239
313
|
*/
|
|
240
314
|
function getProjectNamespace(projectContents) {
|
|
241
|
-
return
|
|
315
|
+
return tryFindPropertyValue(projectContents, 'RootNamespace');
|
|
242
316
|
}
|
|
243
317
|
exports.getProjectNamespace = getProjectNamespace;
|
|
244
318
|
/**
|
|
@@ -247,7 +321,22 @@ exports.getProjectNamespace = getProjectNamespace;
|
|
|
247
321
|
* @return The project guid.
|
|
248
322
|
*/
|
|
249
323
|
function getProjectGuid(projectContents) {
|
|
250
|
-
return
|
|
324
|
+
return tryFindPropertyValue(projectContents, 'ProjectGuid');
|
|
251
325
|
}
|
|
252
326
|
exports.getProjectGuid = getProjectGuid;
|
|
327
|
+
function getExperimentalFeatures(solutionDir) {
|
|
328
|
+
const propsFile = path_1.default.join(solutionDir, 'ExperimentalFeatures.props');
|
|
329
|
+
if (!fs_1.default.existsSync(propsFile)) {
|
|
330
|
+
return undefined;
|
|
331
|
+
}
|
|
332
|
+
const result = {};
|
|
333
|
+
const propsContents = readProjectFile(propsFile);
|
|
334
|
+
const nodes = msbuildSelect(`//msbuild:PropertyGroup/msbuild:*`, propsContents);
|
|
335
|
+
for (const node of nodes) {
|
|
336
|
+
const propertyNode = node;
|
|
337
|
+
result[propertyNode.nodeName] = propertyNode.textContent;
|
|
338
|
+
}
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
exports.getExperimentalFeatures = getExperimentalFeatures;
|
|
253
342
|
//# sourceMappingURL=configUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configUtils.js","sourceRoot":"","sources":["../../src/config/configUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,6BAA6B;AAE7B,mCAAiC;AACjC,+BAA+B;AAE/B,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,qDAAqD;CAC/D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AE;QAC7B,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,aAAa,CACzB,mCAAmC,EACnC,aAAa,CACd,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,YAAY,GAAG,IAAY,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,0DAoBC","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 glob from 'glob';\n\nimport {DOMParser} from '@xmldom/xmldom';\nimport xpath from 'xpath';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nconst msbuildSelect = xpath.useNamespaces({\n msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',\n});\n\n/**\n * Search for files matching the pattern under the target folder.\n * @param folder The absolute path to target folder.\n * @param filenamePattern The pattern to search for.\n * @return Return the array of relative file paths.\n */\nexport function findFiles(folder: string, filenamePattern: string): string[] {\n const files = glob.sync(path.join('**', filenamePattern), {\n cwd: folder,\n ignore: [\n 'node_modules/**',\n '**/Debug/**',\n '**/Release/**',\n '**/Generated Files/**',\n '**/packages/**',\n ],\n });\n\n return files;\n}\n\n/**\n * Search for the windows sub-folder under the target folder.\n * @param folder The absolute path to the target folder.\n * @return The absolute path to the windows folder, if it exists.\n */\nexport function findWindowsFolder(folder: string): string | null {\n const winDir = 'windows';\n const joinedDir = path.join(folder, winDir);\n if (fs.existsSync(joinedDir)) {\n return joinedDir;\n }\n\n return null;\n}\n\n/**\n * Checks if the target file path is a RNW solution file by checking if it contains the string \"ReactNative\".\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW solution file.\n */\nexport function isRnwSolution(filePath: string): boolean {\n return (\n fs\n .readFileSync(filePath)\n .toString()\n .search(/ReactNative/) > 0\n );\n}\n\n/**\n * Search for the RNW solution files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findSolutionFiles(winFolder: string): string[] {\n // First search for all potential solution files\n const allSolutions = findFiles(winFolder, '*.sln');\n\n if (allSolutions.length === 0) {\n // If there're no solution files, return 0\n return [];\n } else if (allSolutions.length === 1) {\n // If there is exactly one solution file, assume it's it\n return [allSolutions[0]];\n }\n\n const solutionFiles = [];\n\n // Try to find any solution file that appears to be a React Native solution\n for (const solutionFile of allSolutions) {\n if (isRnwSolution(path.join(winFolder, solutionFile))) {\n solutionFiles.push(path.normalize(solutionFile));\n }\n }\n\n return solutionFiles;\n}\n\n/**\n * Checks if the target file path is a RNW lib project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW lib project file.\n */\nexport function isRnwDependencyProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpLib.targets',\n );\n } else if (projectLang === 'cpp') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppLib.targets',\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW lib project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findDependencyProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const dependencyProjectFiles = [];\n\n // Try to find any project file that appears to be a dependency project\n for (const projectFile of allProjects) {\n // A project is marked as a RNW dependency iff either:\n // - If the project has the standard native module imports, or\n // - If we only have a single project (and it doesn't have the standard native module imports),\n // pick it and hope for the best. This enables autolinking for modules that were written\n // before the standard native module template existed.\n if (\n allProjects.length === 1 ||\n isRnwDependencyProject(path.join(winFolder, projectFile))\n ) {\n dependencyProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return dependencyProjectFiles;\n}\n\n/**\n * Checks if the target file path is a RNW app project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW app project file.\n */\nfunction isRnwAppProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpApp.targets',\n );\n } else if (projectLang === 'cpp') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppApp.targets',\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW app project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findAppProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const appProjectFiles = [];\n\n // Try to find any project file that appears to be an app project\n for (const projectFile of allProjects) {\n if (isRnwAppProject(path.join(winFolder, projectFile))) {\n appProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return appProjectFiles;\n}\n\n/**\n * Returns the programming language of the project file.\n * @param projectPath The project file path to check.\n * @return The language string: cpp, cs, or null if unknown.\n */\nexport function getProjectLanguage(projectPath: string): 'cpp' | 'cs' | null {\n if (projectPath.endsWith('.vcxproj')) {\n return 'cpp';\n } else if (projectPath.endsWith('.csproj')) {\n return 'cs';\n }\n\n return null;\n}\n\n/**\n * Reads in the contents of the target project file.\n * @param projectPath The target project file path.\n * @return The project file contents.\n */\nexport function readProjectFile(projectPath: string) {\n const projectContents = fs.readFileSync(projectPath, 'utf8').toString();\n return new DOMParser().parseFromString(projectContents, 'application/xml');\n}\n\n/**\n * Search for the given property in the project contents and return its value.\n * @param projectContents The XML project contents.\n * @param propertyName The property to look for.\n * @return The value of the tag if it exists.\n */\nexport function tryFindPropertyValue(\n projectContents: Node,\n propertyName: string,\n): string | null {\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:${propertyName}`,\n projectContents,\n );\n\n if (nodes.length > 0) {\n // Take the last one\n return (nodes[nodes.length - 1] as Node).textContent;\n }\n\n return null;\n}\n\nexport function findPropertyValue(\n projectContents: Node,\n propertyName: string,\n filePath: string,\n): string {\n const res = tryFindPropertyValue(projectContents, propertyName);\n if (!res) {\n throw new CodedError(\n 'NoPropertyInProject',\n `Couldn't find property ${propertyName} from ${filePath}`,\n {propertyName: propertyName},\n );\n }\n return res;\n}\n\n/**\n * Search for the given import project in the project contents and return if it exists.\n * @param projectContents The XML project contents.\n * @param projectName The project to look for.\n * @return If the target exists.\n */\nexport function importProjectExists(\n projectContents: Node,\n projectName: string,\n): boolean {\n const nodes = msbuildSelect(\n `//msbuild:Import[contains(@Project,'${projectName}')]`,\n projectContents,\n );\n\n return nodes.length > 0;\n}\n\nexport type ConfigurationType =\n | 'application'\n | 'dynamiclibrary'\n | 'generic'\n | 'staticlibrary'\n | 'unknown';\n\n/**\n * Gets the configuration type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project configuration type.\n */\nexport function getConfigurationType(projectContents: Node): ConfigurationType {\n const configurationType = tryFindPropertyValue(\n projectContents,\n 'ConfigurationType',\n )?.toLowerCase();\n\n switch (configurationType) {\n case 'application':\n case 'dynamiclibrary':\n case 'generic':\n case 'staticlibrary':\n return configurationType;\n\n default:\n return 'unknown';\n }\n}\n\nexport type OutputType =\n | 'appcontainerexe'\n | 'exe'\n | 'library'\n | 'module'\n | 'unknown'\n | 'winexe'\n | 'winmdobj';\n\n/**\n * Gets the output type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project output type.\n */\nexport function getOutputType(projectContents: Node): OutputType {\n const outputType = tryFindPropertyValue(\n projectContents,\n 'OutputType',\n )?.toLowerCase();\n\n switch (outputType) {\n case 'appcontainerexe':\n case 'exe':\n case 'library':\n case 'module':\n case 'winexe':\n case 'winmdobj':\n return outputType;\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the type of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project type.\n */\nexport function getProjectType(\n projectPath: string,\n projectContents: Node,\n): ConfigurationType | OutputType {\n switch (getProjectLanguage(projectPath)) {\n case 'cpp':\n return getConfigurationType(projectContents);\n\n case 'cs':\n return getOutputType(projectContents);\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the name of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project name.\n */\nexport function getProjectName(\n projectPath: string,\n projectContents: Node,\n): string {\n const name =\n tryFindPropertyValue(projectContents, 'ProjectName') ||\n path.parse(projectPath).name ||\n '';\n\n return name;\n}\n\n/**\n * Gets the namespace of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project namespace.\n */\nexport function getProjectNamespace(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'RootNamespace');\n}\n\n/**\n * Gets the guid of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project guid.\n */\nexport function getProjectGuid(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'ProjectGuid');\n}\n\nexport function getExperimentalFeatures(\n solutionDir: string,\n): Record<string, string> | undefined {\n const propsFile = path.join(solutionDir, 'ExperimentalFeatures.props');\n\n if (!fs.existsSync(propsFile)) {\n return undefined;\n }\n\n const result: Record<string, any> = {};\n const propsContents = readProjectFile(propsFile);\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:*`,\n propsContents,\n );\n for (const node of nodes) {\n const propertyNode = node as Node;\n result[propertyNode.nodeName] = propertyNode.textContent;\n }\n return result;\n}\n"]}
|
|
@@ -4,22 +4,54 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
7
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
30
|
exports.dependencyConfigWindows = void 0;
|
|
9
|
-
|
|
10
|
-
|
|
31
|
+
// Types in this file are inaccurate compared to usage in terms of falsiness.
|
|
32
|
+
// We should try to rewrite some of this to do automated schema validation to
|
|
33
|
+
// guarantee correct types
|
|
34
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
35
|
+
const os_1 = require("os");
|
|
36
|
+
const path_1 = __importDefault(require("path"));
|
|
37
|
+
const configUtils = __importStar(require("./configUtils"));
|
|
11
38
|
/**
|
|
12
39
|
* Gets the config of any RNW native modules under the target folder.
|
|
13
40
|
* @param userConfig A manually specified override config.
|
|
14
41
|
* @return The config if any RNW native modules exist.
|
|
15
42
|
*/
|
|
43
|
+
// Disabled due to existing high cyclomatic complexity
|
|
44
|
+
// eslint-disable-next-line complexity
|
|
16
45
|
function dependencyConfigWindows(folder, userConfig = {}) {
|
|
46
|
+
if ((0, os_1.platform)() !== 'win32') {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
17
49
|
if (userConfig === null) {
|
|
18
50
|
return null;
|
|
19
51
|
}
|
|
20
52
|
const usingManualProjectsOverride = 'projects' in userConfig && Array.isArray(userConfig.projects);
|
|
21
53
|
const usingManualNugetPackagesOverride = 'nugetPackages' in userConfig && Array.isArray(userConfig.nugetPackages);
|
|
22
|
-
|
|
54
|
+
const result = {
|
|
23
55
|
folder,
|
|
24
56
|
projects: usingManualProjectsOverride ? userConfig.projects : [],
|
|
25
57
|
solutionFile: null,
|
|
@@ -39,12 +71,17 @@ function dependencyConfigWindows(folder, userConfig = {}) {
|
|
|
39
71
|
'Error: Source dir is required if projects are specified, but it is null in react-native.config.';
|
|
40
72
|
}
|
|
41
73
|
else {
|
|
42
|
-
sourceDir =
|
|
74
|
+
sourceDir = path_1.default.join(folder, userConfig.sourceDir);
|
|
43
75
|
}
|
|
44
76
|
}
|
|
45
77
|
else if (!usingManualProjectsOverride) {
|
|
46
78
|
// No manually provided projects, try to find sourceDir
|
|
47
|
-
sourceDir
|
|
79
|
+
if ('sourceDir' in userConfig && userConfig.sourceDir !== null) {
|
|
80
|
+
sourceDir = path_1.default.join(folder, userConfig.sourceDir);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
sourceDir = configUtils.findWindowsFolder(folder);
|
|
84
|
+
}
|
|
48
85
|
}
|
|
49
86
|
if (sourceDir === null) {
|
|
50
87
|
// Try to salvage the missing sourceDir
|
|
@@ -67,32 +104,32 @@ function dependencyConfigWindows(folder, userConfig = {}) {
|
|
|
67
104
|
// there's nothing more to look for here, bail
|
|
68
105
|
return null;
|
|
69
106
|
}
|
|
70
|
-
result.sourceDir =
|
|
107
|
+
result.sourceDir = path_1.default.relative(folder, sourceDir);
|
|
71
108
|
const usingManualSolutionFile = 'solutionFile' in userConfig;
|
|
72
|
-
|
|
109
|
+
let solutionFile = null;
|
|
73
110
|
if (usingManualSolutionFile && userConfig.solutionFile !== null) {
|
|
74
111
|
// Manually provided solutionFile, so extract it
|
|
75
|
-
solutionFile =
|
|
112
|
+
solutionFile = path_1.default.join(sourceDir, userConfig.solutionFile);
|
|
76
113
|
}
|
|
77
114
|
else if (!usingManualSolutionFile) {
|
|
78
115
|
// No manually provided solutionFile, try to find it
|
|
79
116
|
const foundSolutions = configUtils.findSolutionFiles(sourceDir);
|
|
80
117
|
if (foundSolutions.length === 1) {
|
|
81
|
-
solutionFile =
|
|
118
|
+
solutionFile = path_1.default.join(sourceDir, foundSolutions[0]);
|
|
82
119
|
}
|
|
83
120
|
}
|
|
84
121
|
result.solutionFile =
|
|
85
|
-
solutionFile !== null ?
|
|
122
|
+
solutionFile !== null ? path_1.default.relative(sourceDir, solutionFile) : null;
|
|
86
123
|
if (usingManualProjectsOverride) {
|
|
87
124
|
// react-native.config used, fill out (auto) items for each provided project, verify (req) items are present
|
|
88
125
|
const alwaysRequired = [
|
|
89
126
|
'projectFile',
|
|
90
127
|
'directDependency',
|
|
91
128
|
];
|
|
92
|
-
for (
|
|
129
|
+
for (const project of result.projects) {
|
|
93
130
|
// Verifying (req) items
|
|
94
|
-
|
|
95
|
-
alwaysRequired.forEach(item => {
|
|
131
|
+
let errorFound = false;
|
|
132
|
+
alwaysRequired.forEach((item) => {
|
|
96
133
|
if (!(item in project)) {
|
|
97
134
|
project[item] = `Error: ${item} is required for each project in react-native.config`;
|
|
98
135
|
errorFound = true;
|
|
@@ -101,10 +138,11 @@ function dependencyConfigWindows(folder, userConfig = {}) {
|
|
|
101
138
|
if (errorFound) {
|
|
102
139
|
break;
|
|
103
140
|
}
|
|
104
|
-
const projectFile =
|
|
141
|
+
const projectFile = path_1.default.join(sourceDir, project.projectFile);
|
|
105
142
|
const projectContents = configUtils.readProjectFile(projectFile);
|
|
143
|
+
project.projectFile = path_1.default.relative(sourceDir, projectFile);
|
|
106
144
|
// Calculating (auto) items
|
|
107
|
-
project.projectName = configUtils.getProjectName(projectContents);
|
|
145
|
+
project.projectName = configUtils.getProjectName(projectFile, projectContents);
|
|
108
146
|
project.projectLang = configUtils.getProjectLanguage(projectFile);
|
|
109
147
|
project.projectGuid = configUtils.getProjectGuid(projectContents);
|
|
110
148
|
if (project.directDependency) {
|
|
@@ -126,39 +164,58 @@ function dependencyConfigWindows(folder, userConfig = {}) {
|
|
|
126
164
|
}
|
|
127
165
|
}
|
|
128
166
|
else {
|
|
129
|
-
// No react-native.config, try to
|
|
167
|
+
// No react-native.config, try to heuristically find any projects
|
|
130
168
|
const foundProjects = configUtils.findDependencyProjectFiles(sourceDir);
|
|
131
169
|
for (const foundProject of foundProjects) {
|
|
132
|
-
const projectFile =
|
|
133
|
-
const projectLang = configUtils.getProjectLanguage(projectFile);
|
|
170
|
+
const projectFile = path_1.default.join(sourceDir, foundProject);
|
|
134
171
|
const projectContents = configUtils.readProjectFile(projectFile);
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
172
|
+
const projectType = configUtils.getProjectType(projectFile, projectContents);
|
|
173
|
+
if (projectType === 'dynamiclibrary' ||
|
|
174
|
+
projectType === 'winmdobj' ||
|
|
175
|
+
projectType === 'library') {
|
|
176
|
+
const projectLang = configUtils.getProjectLanguage(projectFile);
|
|
177
|
+
const projectName = configUtils.getProjectName(projectFile, projectContents);
|
|
178
|
+
const projectGuid = configUtils.getProjectGuid(projectContents);
|
|
179
|
+
const projectNamespace = configUtils.getProjectNamespace(projectContents);
|
|
180
|
+
const directDependency = true;
|
|
181
|
+
const cppHeaders = [];
|
|
182
|
+
const cppPackageProviders = [];
|
|
183
|
+
const csNamespaces = [];
|
|
184
|
+
const csPackageProviders = [];
|
|
185
|
+
if (projectNamespace !== null) {
|
|
186
|
+
const cppNamespace = projectNamespace.replace(/\./g, '::');
|
|
187
|
+
const csNamespace = projectNamespace.replace(/::/g, '.');
|
|
188
|
+
cppHeaders.push(`winrt/${csNamespace}.h`);
|
|
189
|
+
cppPackageProviders.push(`${cppNamespace}::ReactPackageProvider`);
|
|
190
|
+
csNamespaces.push(`${csNamespace}`);
|
|
191
|
+
csPackageProviders.push(`${csNamespace}.ReactPackageProvider`);
|
|
192
|
+
}
|
|
193
|
+
result.projects.push({
|
|
194
|
+
projectFile: path_1.default.relative(sourceDir, projectFile),
|
|
195
|
+
projectName,
|
|
196
|
+
projectLang,
|
|
197
|
+
projectGuid,
|
|
198
|
+
directDependency,
|
|
199
|
+
cppHeaders,
|
|
200
|
+
cppPackageProviders,
|
|
201
|
+
csNamespaces,
|
|
202
|
+
csPackageProviders,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const projectPath = path_1.default.relative(sourceDir, projectFile);
|
|
207
|
+
result.projects.push({
|
|
208
|
+
projectFile: `Error: ${projectPath} is type '${projectType}'`,
|
|
209
|
+
directDependency: false,
|
|
210
|
+
projectName: '',
|
|
211
|
+
projectLang: null,
|
|
212
|
+
projectGuid: null,
|
|
213
|
+
cppHeaders: [],
|
|
214
|
+
cppPackageProviders: [],
|
|
215
|
+
csNamespaces: [],
|
|
216
|
+
csPackageProviders: [],
|
|
217
|
+
});
|
|
150
218
|
}
|
|
151
|
-
result.projects.push({
|
|
152
|
-
projectFile: projectFile.substr(sourceDir.length + 1),
|
|
153
|
-
projectName,
|
|
154
|
-
projectLang,
|
|
155
|
-
projectGuid,
|
|
156
|
-
directDependency,
|
|
157
|
-
cppHeaders,
|
|
158
|
-
cppPackageProviders,
|
|
159
|
-
csNamespaces,
|
|
160
|
-
csPackageProviders,
|
|
161
|
-
});
|
|
162
219
|
}
|
|
163
220
|
}
|
|
164
221
|
return result;
|