@react-native-oh/react-native-harmony-cli 0.77.22 → 0.77.33-1
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/dist/autolinking/Autolinking.js +1 -1
- package/dist/codegen/generators/UberGeneratorV1.js +9 -2
- package/dist/codegen/generators/UberGeneratorV2.js +8 -1
- package/dist/commands/clean-harmony.js +17 -7
- package/dist/commands/codegen-harmony.js +16 -5
- package/dist/commands/init.js +0 -0
- package/dist/commands/run-harmony.js +0 -2
- package/dist/package-verifier/verify-package.js +1 -1
- package/dist/simulator/LaunchSimulator.js +9 -2
- package/harmony/rnoh-hvigor-plugin-0.77.33.tgz +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/02febc14 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0429e5b7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/05339e68 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/070be2fe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07851ff1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e10c06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e1d696 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/14950087 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/15e87372 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19e6ecbe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1aac0ac4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b8db102 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1c181646 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203e747c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/21ba4c08 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/259939e5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/288ba98c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2a45461c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2d773091 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2eda89fc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f584eca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/35b495ca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36478aed +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3844e772 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3ee777f4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/471ac436 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4a91abcc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d1a5094 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d3ef38f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4daf5855 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ef0389f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4f72da28 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/59d3e924 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5a8edfaa +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5d28a510 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/61a6391d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65921a14 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6624e7fc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66d28144 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6aceb8d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/702393d3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/714f932b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/73f9d4a6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/78d3adae +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b6564b8 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7c7c3e6e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cbc9b6a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7dd579e0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e0b7d06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e153eef +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7ee84fd7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7f5146a4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/844e633a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8a1af22c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90a1680d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a15fb79a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ac288a8a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ad7a66b4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aee8805e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b0487ec8 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b10e16d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b32d42ac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b7d8f35c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b96748af +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bedb2fea +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c01ad640 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c0472cf5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c102ed0f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c1a91819 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c243857a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c407792f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c4459bee +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c72a4dcd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c83537a9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c88f7498 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8d04070 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cc44d6f1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4d913f6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da97f202 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dc965522 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dff6f700 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e507c001 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e52f3f2d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e5c3890d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e720074d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e7656fa7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e80bcaac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8e7900e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ee8993f9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ef8cf362 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1405b1d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f20f0e0d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2586978 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f53cd716 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fe71f6bb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/febfc20b +0 -0
- package/package.json +2 -7
- package/scripts/sync-hvigor.js +27 -0
- package/src/autolinking/Autolinking.ts +1 -1
- package/src/codegen/generators/UberGeneratorV1.ts +7 -2
- package/src/codegen/generators/UberGeneratorV2.ts +6 -1
- package/src/commands/codegen-harmony.ts +17 -7
- package/src/commands/run-harmony.ts +0 -2
- package/src/simulator/LaunchSimulator.ts +9 -2
- package/harmony/rnoh-hvigor-plugin-0.77.22.tgz +0 -0
|
@@ -183,7 +183,7 @@ class Autolinking {
|
|
|
183
183
|
const managedNativeDependencySpecifierByName = {};
|
|
184
184
|
for (const library of autolinkableLibraries) {
|
|
185
185
|
managedNativeDependencySpecifierByName[library.ohPackageName] =
|
|
186
|
-
|
|
186
|
+
`file:${library.harFilePathRelativeToHarmony}`.split(node_path_1.default.sep).join('/');
|
|
187
187
|
}
|
|
188
188
|
return {
|
|
189
189
|
skippedLibraryNpmPackageNames: input.skippedLibraryNpmPackageNames,
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.UberGeneratorV1 = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const core_1 = require("../core");
|
|
5
9
|
const NativeModuleCodeGenerator_1 = require("./NativeModuleCodeGenerator");
|
|
6
10
|
const ArkTSComponentCodeGeneratorArkTS_1 = require("./ArkTSComponentCodeGeneratorArkTS");
|
|
11
|
+
// The name of rnoh OHOS module
|
|
12
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
7
13
|
/**
|
|
8
14
|
* Generates code for libraries built on top of RNOH's ArkTS architecture.
|
|
9
15
|
*/
|
|
@@ -19,8 +25,9 @@ class UberGeneratorV1 {
|
|
|
19
25
|
}
|
|
20
26
|
generate(uberSchema) {
|
|
21
27
|
const fileContentByPath = new Map();
|
|
22
|
-
const
|
|
23
|
-
const
|
|
28
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, path_1.default.sep));
|
|
29
|
+
const componentCodeGenerator = new ArkTSComponentCodeGeneratorArkTS_1.ArkTSComponentCodeGeneratorArkTS(this.cppOutputPath, this.etsOutputPath.copyWithNewSegment('components'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
30
|
+
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator_1.NativeModuleCodeGenerator(this.cppOutputPath, this.etsOutputPath.copyWithNewSegment('turboModules'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
24
31
|
const generatorBySpecType = {
|
|
25
32
|
Component: componentCodeGenerator,
|
|
26
33
|
NativeModule: nativeModuleCodeGenerator,
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.UberGeneratorV2 = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const CppComponentCodeGenerator_1 = require("./CppComponentCodeGenerator");
|
|
5
9
|
const NativeModuleCodeGenerator_1 = require("./NativeModuleCodeGenerator");
|
|
6
10
|
const SharedComponentCodeGenerator_1 = require("./SharedComponentCodeGenerator");
|
|
11
|
+
// The name of rnoh OHOS module
|
|
12
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
7
13
|
/**
|
|
8
14
|
* Generates code for libraries built on top of RNOH's C-API architecture.
|
|
9
15
|
*/
|
|
@@ -51,7 +57,8 @@ class UberGeneratorV2 {
|
|
|
51
57
|
.getSpecSchemaByFilenameMap()
|
|
52
58
|
.entries()) {
|
|
53
59
|
if (specSchema.type === 'NativeModule') {
|
|
54
|
-
const
|
|
60
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, path_1.default.sep));
|
|
61
|
+
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator_1.NativeModuleCodeGenerator(libraryCppOutput.copyWithNewSegment('RNOH', 'generated', 'turbo_modules'), this.etsOutputPath.copyWithNewSegment('turboModules'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
55
62
|
nativeModuleCodeGenerator
|
|
56
63
|
.generate(specSchema)
|
|
57
64
|
.forEach((fileContent, filePath) => {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -24,7 +24,11 @@ exports.commandCodegenHarmony = {
|
|
|
24
24
|
options: [
|
|
25
25
|
{
|
|
26
26
|
name: '--rnoh-module-path <path>',
|
|
27
|
-
description: 'Specifies the relative path to the rnoh OHOS module',
|
|
27
|
+
description: '[deprecated] Specifies the relative path to the rnoh OHOS module',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: '--ets-output-path <path>',
|
|
31
|
+
description: 'Specifies the relative path to the output directory intended for storing generated ETS files.',
|
|
28
32
|
},
|
|
29
33
|
{
|
|
30
34
|
name: '--cpp-output-path <path>',
|
|
@@ -53,7 +57,12 @@ exports.commandCodegenHarmony = {
|
|
|
53
57
|
const MAX_SUPPORTED_CODEGEN_VERSION = 2;
|
|
54
58
|
// prepare the input data
|
|
55
59
|
validateArgs(args);
|
|
56
|
-
|
|
60
|
+
let etsOutputPath = args.etsOutputPath || args.rnohModulePath;
|
|
61
|
+
const isEndWithGenerated = /\/generated\/?$/.test(etsOutputPath);
|
|
62
|
+
etsOutputPath = new core_1.AbsolutePath(etsOutputPath);
|
|
63
|
+
if (!isEndWithGenerated) {
|
|
64
|
+
etsOutputPath = etsOutputPath.copyWithNewSegment('generated');
|
|
65
|
+
}
|
|
57
66
|
const enableSafetyCheck = args.safetyCheck;
|
|
58
67
|
const cppOutputPath = new core_1.AbsolutePath(args.cppOutputPath);
|
|
59
68
|
const projectRootPath = new core_1.AbsolutePath(args.projectRootPath);
|
|
@@ -110,11 +119,13 @@ exports.commandCodegenHarmony = {
|
|
|
110
119
|
}),
|
|
111
120
|
};
|
|
112
121
|
function validateArgs(args) {
|
|
113
|
-
if (!args.rnohModulePath) {
|
|
122
|
+
if (!args.rnohModulePath && !args.etsOutputPath) {
|
|
114
123
|
throw new core_1.DescriptiveError({
|
|
115
|
-
whatHappened:
|
|
124
|
+
whatHappened: '--ets-output-path is required',
|
|
116
125
|
whatCanUserDo: [
|
|
117
|
-
'Please provide
|
|
126
|
+
'Please provide an output path for the ETS file.',
|
|
127
|
+
'It is recommended to place it in the same directory as the custom component or TurboModule.',
|
|
128
|
+
'Do not place it inside @rnoh/react-native-openharmony, otherwise a jscrash may occur when using react_native_openharmony_release2.har.'
|
|
118
129
|
],
|
|
119
130
|
});
|
|
120
131
|
}
|
package/dist/commands/init.js
CHANGED
|
File without changes
|
|
@@ -15,7 +15,7 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
|
15
15
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
16
16
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
17
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
18
|
-
return i =
|
|
18
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
19
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
20
20
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
21
21
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
@@ -45,13 +45,20 @@ function getCreatedSimulators(cli, emulator) {
|
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
try {
|
|
47
47
|
let simulatorInfos = '';
|
|
48
|
+
let simulatorInfosFromStderr = '';
|
|
48
49
|
yield cli.run(`"${emulator}"`, {
|
|
49
50
|
args: ['--list'],
|
|
50
51
|
shell: true,
|
|
51
|
-
|
|
52
|
+
onStdout: (msg) => {
|
|
52
53
|
simulatorInfos += msg;
|
|
53
54
|
},
|
|
55
|
+
onStderr: (msg) => {
|
|
56
|
+
simulatorInfosFromStderr += msg;
|
|
57
|
+
},
|
|
54
58
|
});
|
|
59
|
+
if (simulatorInfos == null || simulatorInfos.trim() === '') {
|
|
60
|
+
simulatorInfos = simulatorInfosFromStderr;
|
|
61
|
+
}
|
|
55
62
|
if (!simulatorInfos || simulatorInfos.trim() === '' ||
|
|
56
63
|
simulatorInfos.trim() === '[Empty]' ||
|
|
57
64
|
simulatorInfos.includes('not ')) {
|
|
@@ -281,7 +288,7 @@ function launchHarmonySimulator(opt) {
|
|
|
281
288
|
const quoteIfNeeded = (p) => process.platform === 'win32' ? `"${p}"` : p;
|
|
282
289
|
const args = [
|
|
283
290
|
'-hvd',
|
|
284
|
-
simulatorName[0].trim(),
|
|
291
|
+
quoteIfNeeded(simulatorName[0].trim()),
|
|
285
292
|
'-path',
|
|
286
293
|
quoteIfNeeded(paths.instancePath),
|
|
287
294
|
'-imageRoot',
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-oh/react-native-harmony-cli",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.33-1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc --outDir dist -p tsconfig.build.json && node ./scripts/copy-template.js",
|
|
11
11
|
"prepack": "npm run build && npm run _recreate-hvigor-plugin",
|
|
12
|
-
"_recreate-hvigor-plugin": "cd ../react-native-harmony-hvigor-plugin && npm i && npm run deploy && cd ../react-native-harmony-cli",
|
|
12
|
+
"_recreate-hvigor-plugin": "cd ../react-native-harmony-hvigor-plugin && npm i && npm run deploy && cd ../react-native-harmony-cli && node ./scripts/sync-hvigor.js",
|
|
13
13
|
"verify": "tsc --noEmit && npm run test",
|
|
14
14
|
"test": "npm run build && jest",
|
|
15
15
|
"test:codegen": "jest ./src/codegen/.* && npm run build && jest tests/codegen.*",
|
|
@@ -58,10 +58,5 @@
|
|
|
58
58
|
"mustache": "^4.2.0",
|
|
59
59
|
"tar": "^6.1.15",
|
|
60
60
|
"tmp": "^0.2.1"
|
|
61
|
-
},
|
|
62
|
-
"homepage": "https://gitcode.com/openharmony-sig/ohos_react_native",
|
|
63
|
-
"repository": {
|
|
64
|
-
"type": "gitcode",
|
|
65
|
-
"url": "https://gitcode.com/openharmony-sig/ohos_react_native"
|
|
66
61
|
}
|
|
67
62
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
const fs = require('fs').promises;
|
|
8
|
+
|
|
9
|
+
async function sync(configFilePaths = []) {
|
|
10
|
+
const dir = './harmony';
|
|
11
|
+
const files = await fs.readdir(dir);
|
|
12
|
+
const file = files.find(f => /^rnoh-hvigor-plugin-\d+(\.\d+){2}\.tgz$/.test(f));
|
|
13
|
+
if (!file) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
configFilePaths.forEach(async (configFilePath) => {
|
|
17
|
+
const fileContent = await fs.readFile(configFilePath, 'utf8');
|
|
18
|
+
const updatedContent = fileContent.replace(/rnoh-hvigor-plugin-\d+(\.\d+){2}\.tgz/g, file);
|
|
19
|
+
fs.writeFile(configFilePath, updatedContent, 'utf8');
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
sync([
|
|
24
|
+
'../tester/harmony/hvigor/hvigor-config.json5',
|
|
25
|
+
'../tester-ecosystem/harmony/hvigor/hvigor-config.json5',
|
|
26
|
+
'../react-native-harmony-61-interop-tester/rnoh-entry/harmony/hvigor/hvigor-config.json5'
|
|
27
|
+
]).catch(console.error);
|
|
@@ -271,7 +271,7 @@ export class Autolinking {
|
|
|
271
271
|
const managedNativeDependencySpecifierByName: Record<string, string> = {};
|
|
272
272
|
for (const library of autolinkableLibraries) {
|
|
273
273
|
managedNativeDependencySpecifierByName[library.ohPackageName] =
|
|
274
|
-
|
|
274
|
+
`file:${library.harFilePathRelativeToHarmony}`.split(pathUtils.sep).join('/');
|
|
275
275
|
}
|
|
276
276
|
return {
|
|
277
277
|
skippedLibraryNpmPackageNames: input.skippedLibraryNpmPackageNames,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import pathUtils from 'path';
|
|
1
2
|
import { AbsolutePath } from '../../core';
|
|
2
3
|
import {
|
|
3
4
|
CodeGenerator,
|
|
@@ -10,6 +11,9 @@ import { GlueCodeDataV1 } from './AppBuildTimeGlueCodeGenerator';
|
|
|
10
11
|
import { NativeModuleCodeGenerator } from './NativeModuleCodeGenerator';
|
|
11
12
|
import { ArkTSComponentCodeGeneratorArkTS } from './ArkTSComponentCodeGeneratorArkTS';
|
|
12
13
|
|
|
14
|
+
// The name of rnoh OHOS module
|
|
15
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* Generates code for libraries built on top of RNOH's ArkTS architecture.
|
|
15
19
|
*/
|
|
@@ -28,17 +32,18 @@ export class UberGeneratorV1 implements CodeGenerator<UberSchema> {
|
|
|
28
32
|
|
|
29
33
|
generate(uberSchema: UberSchema) {
|
|
30
34
|
const fileContentByPath = new Map<AbsolutePath, string>();
|
|
35
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, pathUtils.sep));
|
|
31
36
|
const componentCodeGenerator = new ArkTSComponentCodeGeneratorArkTS(
|
|
32
37
|
this.cppOutputPath,
|
|
33
38
|
this.etsOutputPath.copyWithNewSegment('components'),
|
|
34
39
|
this.codegenNoticeLines,
|
|
35
|
-
'../../ts'
|
|
40
|
+
isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`
|
|
36
41
|
);
|
|
37
42
|
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator(
|
|
38
43
|
this.cppOutputPath,
|
|
39
44
|
this.etsOutputPath.copyWithNewSegment('turboModules'),
|
|
40
45
|
this.codegenNoticeLines,
|
|
41
|
-
'../../ts'
|
|
46
|
+
isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`
|
|
42
47
|
);
|
|
43
48
|
const generatorBySpecType = {
|
|
44
49
|
Component: componentCodeGenerator,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import pathUtils from 'path';
|
|
1
2
|
import { AbsolutePath } from '../../core';
|
|
2
3
|
import { CodeGenerator } from '../core';
|
|
3
4
|
import {
|
|
@@ -8,6 +9,9 @@ import { NativeModuleCodeGenerator } from './NativeModuleCodeGenerator';
|
|
|
8
9
|
import { GlueCodeDataV2 } from './AppBuildTimeGlueCodeGenerator';
|
|
9
10
|
import { SharedComponentCodeGenerator } from './SharedComponentCodeGenerator';
|
|
10
11
|
|
|
12
|
+
// The name of rnoh OHOS module
|
|
13
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* Generates code for libraries built on top of RNOH's C-API architecture.
|
|
13
17
|
*/
|
|
@@ -78,6 +82,7 @@ export class UberGeneratorV2 implements CodeGenerator<LibraryData[]> {
|
|
|
78
82
|
.getSpecSchemaByFilenameMap()
|
|
79
83
|
.entries()) {
|
|
80
84
|
if (specSchema.type === 'NativeModule') {
|
|
85
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, pathUtils.sep));
|
|
81
86
|
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator(
|
|
82
87
|
libraryCppOutput.copyWithNewSegment(
|
|
83
88
|
'RNOH',
|
|
@@ -86,7 +91,7 @@ export class UberGeneratorV2 implements CodeGenerator<LibraryData[]> {
|
|
|
86
91
|
),
|
|
87
92
|
this.etsOutputPath.copyWithNewSegment('turboModules'),
|
|
88
93
|
this.codegenNoticeLines,
|
|
89
|
-
'../../ts'
|
|
94
|
+
isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`
|
|
90
95
|
);
|
|
91
96
|
nativeModuleCodeGenerator
|
|
92
97
|
.generate(specSchema)
|
|
@@ -27,7 +27,12 @@ export const commandCodegenHarmony: Command = {
|
|
|
27
27
|
options: [
|
|
28
28
|
{
|
|
29
29
|
name: '--rnoh-module-path <path>',
|
|
30
|
-
description: 'Specifies the relative path to the rnoh OHOS module',
|
|
30
|
+
description: '[deprecated] Specifies the relative path to the rnoh OHOS module',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: '--ets-output-path <path>',
|
|
34
|
+
description:
|
|
35
|
+
'Specifies the relative path to the output directory intended for storing generated ETS files.',
|
|
31
36
|
},
|
|
32
37
|
{
|
|
33
38
|
name: '--cpp-output-path <path>',
|
|
@@ -58,9 +63,12 @@ export const commandCodegenHarmony: Command = {
|
|
|
58
63
|
const MAX_SUPPORTED_CODEGEN_VERSION = 2;
|
|
59
64
|
// prepare the input data
|
|
60
65
|
validateArgs(args);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
let etsOutputPath = args.etsOutputPath || args.rnohModulePath;
|
|
67
|
+
const isEndWithGenerated = /\/generated\/?$/.test(etsOutputPath);
|
|
68
|
+
etsOutputPath = new AbsolutePath(etsOutputPath);
|
|
69
|
+
if (!isEndWithGenerated) {
|
|
70
|
+
etsOutputPath = etsOutputPath.copyWithNewSegment('generated');
|
|
71
|
+
}
|
|
64
72
|
const enableSafetyCheck: boolean = args.safetyCheck;
|
|
65
73
|
const cppOutputPath = new AbsolutePath(args.cppOutputPath);
|
|
66
74
|
const projectRootPath = new AbsolutePath(args.projectRootPath);
|
|
@@ -159,11 +167,13 @@ export const commandCodegenHarmony: Command = {
|
|
|
159
167
|
};
|
|
160
168
|
|
|
161
169
|
function validateArgs(args: any) {
|
|
162
|
-
if (!args.rnohModulePath) {
|
|
170
|
+
if (!args.rnohModulePath && !args.etsOutputPath) {
|
|
163
171
|
throw new DescriptiveError({
|
|
164
|
-
whatHappened:
|
|
172
|
+
whatHappened: '--ets-output-path is required',
|
|
165
173
|
whatCanUserDo: [
|
|
166
|
-
'Please provide
|
|
174
|
+
'Please provide an output path for the ETS file.',
|
|
175
|
+
'It is recommended to place it in the same directory as the custom component or TurboModule.',
|
|
176
|
+
'Do not place it inside @rnoh/react-native-openharmony, otherwise a jscrash may occur when using react_native_openharmony_release2.har.'
|
|
167
177
|
],
|
|
168
178
|
});
|
|
169
179
|
}
|
|
@@ -39,13 +39,20 @@ function isSupportedVersion(versionDir: string): boolean {
|
|
|
39
39
|
async function getCreatedSimulators(cli: RealCliExecutor, emulator: string): Promise<string[]> {
|
|
40
40
|
try {
|
|
41
41
|
let simulatorInfos = '';
|
|
42
|
+
let simulatorInfosFromStderr = '';
|
|
42
43
|
await cli.run(`"${emulator}"`, {
|
|
43
44
|
args: ['--list'],
|
|
44
45
|
shell: true,
|
|
45
|
-
|
|
46
|
+
onStdout: (msg) => {
|
|
46
47
|
simulatorInfos += msg;
|
|
47
48
|
},
|
|
49
|
+
onStderr: (msg) => {
|
|
50
|
+
simulatorInfosFromStderr += msg;
|
|
51
|
+
},
|
|
48
52
|
});
|
|
53
|
+
if (simulatorInfos == null || simulatorInfos.trim() === '') {
|
|
54
|
+
simulatorInfos = simulatorInfosFromStderr;
|
|
55
|
+
}
|
|
49
56
|
if (!simulatorInfos || simulatorInfos.trim() === '' ||
|
|
50
57
|
simulatorInfos.trim() === '[Empty]' ||
|
|
51
58
|
simulatorInfos.includes('not ')) {
|
|
@@ -324,7 +331,7 @@ export async function launchHarmonySimulator(opt: LaunchOptions): Promise<void>
|
|
|
324
331
|
process.platform === 'win32' ? `"${p}"` : p;
|
|
325
332
|
const args = [
|
|
326
333
|
'-hvd',
|
|
327
|
-
simulatorName[0].trim(),
|
|
334
|
+
quoteIfNeeded(simulatorName[0].trim()),
|
|
328
335
|
'-path',
|
|
329
336
|
quoteIfNeeded(paths.instancePath),
|
|
330
337
|
'-imageRoot',
|
|
Binary file
|