Repository navigation
Expand file tree
/
Copy pathjust-task.js
More file actions
113 lines (97 loc) · 2.9 KB
/
Copy pathjust-task.js
File metadata and controls
113 lines (97 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
* @format
* @ts-check
*/
const path = require('path');
const {
task,
series,
condition,
option,
argv,
tscTask,
} = require('just-scripts');
// Use the shared base configuration
require('@rnw-scripts/just-task');
require('@rnw-scripts/just-task/react-native-tasks');
require('@rnw-scripts/just-task/flow-tasks');
const {execSync} = require('child_process');
const fs = require('fs');
const {
registerNuGetRestoreTask,
} = require('@rnw-scripts/just-task/nuget-restore-task');
const {findPowerShell} = require('@react-native-windows/find-dotnet-tools');
option('production');
option('clean');
function codegen(test) {
execSync(
`react-native-windows-codegen --files src/**/*Native*.js --namespace Microsoft::ReactNativeSpecs --libraryName rnwcore --componentsWindows --modulesWindows --internalComponents --modulesCxx${
test ? ' --test' : ''
}`,
{env: process.env},
);
execSync(
`react-native-windows-codegen --files Microsoft.ReactNative.IntegrationTests/**/*Native*.js --namespace Microsoft::ReactNativeIntegrationTestSpecs --libraryName msrnIntegrationTests --modulesCxx --outputDirectory Microsoft.ReactNative.IntegrationTests/codegen${
test ? ' --test' : ''
}`,
{env: process.env},
);
}
function layoutMSRNCxx() {
if (require('os').platform() === 'win32') {
const powershell = findPowerShell();
execSync(
`"${powershell}" -NoProfile .\\Scripts\\Tfs\\Layout-MSRN-Headers.ps1 -GenerateLocalCxx`,
{
env: process.env,
},
);
}
}
task('layoutMSRNCxx', layoutMSRNCxx);
task('codegen', () => codegen(false));
task('codegen:check', () => codegen(true));
task('copyReadmeAndLicenseFromRoot', () => {
fs.copyFileSync(
path.resolve(__dirname, '../README.md'),
path.resolve(__dirname, 'README.md'),
);
fs.copyFileSync(
path.resolve(__dirname, '../LICENSE'),
path.resolve(__dirname, 'LICENSE'),
);
});
task('compileTsPlatformOverrides', tscTask());
registerNuGetRestoreTask({
taskName: 'restoreNuGetPackages',
scriptPath: path.resolve(
__dirname,
'Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1',
),
logDirectory: path.resolve(__dirname, 'logs'),
scriptArguments: ['-SkipLockDeletion'],
});
function installDotnetToolsTask() {
execSync(
`dotnet tool restore --tool-manifest ${path.resolve(__dirname, 'dotnet-tools.json')}`,
{env: process.env},
);
}
task('installDotnetTools', installDotnetToolsTask);
task(
'build',
series(
condition('clean', () => argv().clean),
'copyRNLibraries',
'copyReadmeAndLicenseFromRoot',
condition('installDotnetTools', () => !process.env.TF_BUILD),
'layoutMSRNCxx',
'compileTsPlatformOverrides',
'restoreNuGetPackages',
'codegen',
),
);
task('clean', series('cleanRNLibraries'));
task('lint', series('prettier', 'eslint', 'codegen:check', 'flow-check'));