@react-native-oh/react-native-harmony-cli 0.77.22 → 0.77.33
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/assetResolver.js +74 -43
- package/dist/autolinking/Autolinking.js +179 -178
- package/dist/codegen/core/CodegenError.js +23 -3
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
- package/dist/codegen/core/UberSchema.js +97 -55
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
- package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
- package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -18
- package/dist/codegen/generators/UberGeneratorV2.js +36 -28
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
- package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
- package/dist/codegen/templates/IndexTSTemplate.js +17 -37
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
- package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
- package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
- package/dist/commands/bundle-harmony.js +221 -118
- package/dist/commands/clean-harmony.js +63 -58
- package/dist/commands/codegen-harmony.js +175 -104
- package/dist/commands/codegen-lib-harmony.js +116 -76
- package/dist/commands/init-harmony.js +196 -151
- package/dist/commands/init.js +961 -537
- package/dist/commands/link-harmony.js +82 -35
- package/dist/commands/run-harmony.js +518 -374
- package/dist/commands/verify-package-harmony.js +117 -54
- package/dist/core/AbsolutePath.js +49 -33
- package/dist/core/CodegenConfig.js +22 -24
- package/dist/core/DescriptiveError.js +37 -18
- package/dist/core/FileSystem.js +18 -14
- package/dist/core/OHPackageJSON5.js +23 -17
- package/dist/core/PackageJSON.js +42 -26
- package/dist/core/ProjectDependenciesManager.js +92 -40
- package/dist/core/ValidationError.js +22 -2
- package/dist/core/fs.js +7 -10
- package/dist/index.js +1 -1
- package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
- package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
- package/dist/init/templates/EntryIndexTemplate.js +8 -56
- package/dist/init/templates/EntryStringVarTemplate.js +8 -27
- package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
- package/dist/init/templates/MetroConfigTemplate.js +8 -38
- package/dist/init/templates/OhPackageJson5Template.js +8 -28
- package/dist/io/CliExecutor.js +98 -46
- package/dist/io/Logger.js +46 -40
- package/dist/io/RealFS.js +100 -43
- package/dist/io/TarGz.js +8 -11
- package/dist/io/__fixtures__.js +141 -79
- package/dist/io/fsUtils.js +12 -13
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
- package/dist/package-verifier/verify-package.js +133 -56
- package/dist/simulator/LaunchSimulator.js +301 -217
- package/package.json +2 -11
- 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/dist/init/templates/harmony/AppScope/app.json5 +0 -10
- package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
- package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/dist/init/templates/harmony/build-profile.json5 +0 -36
- package/dist/init/templates/harmony/codelinter.json +0 -32
- package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
- package/dist/init/templates/harmony/entry/gitignore +0 -7
- package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
- package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
- package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
- package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
- package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
- package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
- package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
- package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
- package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
- package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
- package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -65
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
- package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
- package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
- package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
- package/dist/init/templates/harmony/gitignore +0 -16
- package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
- package/dist/init/templates/harmony/hvigorfile.ts +0 -7
- package/harmony/rnoh-hvigor-plugin-0.77.22.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
|
@@ -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
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
app: {
|
|
3
|
-
products: [
|
|
4
|
-
{
|
|
5
|
-
name: 'default',
|
|
6
|
-
signingConfig: 'default',
|
|
7
|
-
compatibleSdkVersion: '5.0.0(12)',
|
|
8
|
-
runtimeOS: 'HarmonyOS',
|
|
9
|
-
buildOption: {
|
|
10
|
-
nativeCompiler: 'BiSheng'
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
buildModeSet: [
|
|
15
|
-
{
|
|
16
|
-
name: 'debug',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'release',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
signingConfigs: [],
|
|
23
|
-
},
|
|
24
|
-
modules: [
|
|
25
|
-
{
|
|
26
|
-
name: 'entry',
|
|
27
|
-
srcPath: './entry',
|
|
28
|
-
targets: [
|
|
29
|
-
{
|
|
30
|
-
name: 'default',
|
|
31
|
-
applyToProducts: ['default'],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": ["**/*.ts", "**/*.ets"],
|
|
3
|
-
"ignore": [
|
|
4
|
-
"**/ohosTest/**/*",
|
|
5
|
-
"**/node_modules/**/*",
|
|
6
|
-
"**/hvigorfile.ts",
|
|
7
|
-
"**/node_modules/**/*",
|
|
8
|
-
"**/oh_modules/**/*",
|
|
9
|
-
"**/build/**/*",
|
|
10
|
-
"**/.preview/**/*"
|
|
11
|
-
],
|
|
12
|
-
"plugins": ["@typescript-eslint"],
|
|
13
|
-
"ruleSet": [],
|
|
14
|
-
"rules": {
|
|
15
|
-
"@typescript-eslint/await-thenable": "warn",
|
|
16
|
-
"@typescript-eslint/consistent-type-imports": "warn",
|
|
17
|
-
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
18
|
-
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
19
|
-
"@typescript-eslint/no-dynamic-delete": "warn",
|
|
20
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
21
|
-
"@typescript-eslint/no-for-in-array": "warn",
|
|
22
|
-
"@typescript-eslint/no-this-alias": "warn",
|
|
23
|
-
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
|
24
|
-
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
25
|
-
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
26
|
-
"@typescript-eslint/no-unsafe-call": "warn",
|
|
27
|
-
"@typescript-eslint/no-unsafe-member-access": "warn",
|
|
28
|
-
"@typescript-eslint/no-unsafe-return": "warn",
|
|
29
|
-
"@typescript-eslint/prefer-literal-enum-member": "warn"
|
|
30
|
-
},
|
|
31
|
-
"overrides": []
|
|
32
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiType": 'stageMode',
|
|
3
|
-
"buildOption": {
|
|
4
|
-
"externalNativeOptions": {
|
|
5
|
-
"path": "./src/main/cpp/CMakeLists.txt",
|
|
6
|
-
"arguments": "",
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
"targets": [
|
|
10
|
-
{
|
|
11
|
-
"name": "default",
|
|
12
|
-
"runtimeOS": "HarmonyOS"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "ohosTest",
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
|
2
|
-
import { createRNOHModulePlugin } from '@rnoh/hvigor-plugin';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
system: hapTasks,
|
|
6
|
-
plugins: [
|
|
7
|
-
createRNOHModulePlugin({
|
|
8
|
-
codegen: {
|
|
9
|
-
rnohModulePath: './oh_modules/@rnoh/react-native-openharmony',
|
|
10
|
-
},
|
|
11
|
-
}),
|
|
12
|
-
],
|
|
13
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.11)
|
|
2
|
-
project(rnapp)
|
|
3
|
-
|
|
4
|
-
set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
5
|
-
set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
|
|
6
|
-
set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
|
|
7
|
-
set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
|
|
8
|
-
set(LOG_VERBOSITY_LEVEL 1)
|
|
9
|
-
set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
|
|
10
|
-
set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
|
|
11
|
-
set(WITH_HITRACE_SYSTRACE ON)
|
|
12
|
-
set(WITH_HITRACE_REACT_MARKER ON)
|
|
13
|
-
set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules") # required by 'autolink_libraries'
|
|
14
|
-
|
|
15
|
-
add_subdirectory("${RNOH_CPP_DIR}" ./rn)
|
|
16
|
-
|
|
17
|
-
include("${CMAKE_CURRENT_SOURCE_DIR}/autolinking.cmake")
|
|
18
|
-
|
|
19
|
-
file(GLOB GENERATED_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp") # this line is needed by codegen v1
|
|
20
|
-
add_library(rnoh_app SHARED
|
|
21
|
-
${GENERATED_CPP_FILES}
|
|
22
|
-
"./PackageProvider.cpp"
|
|
23
|
-
"${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
|
|
24
|
-
)
|
|
25
|
-
target_link_libraries(rnoh_app PUBLIC rnoh)
|
|
26
|
-
|
|
27
|
-
autolink_libraries(rnoh_app)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#include "RNOH/PackageProvider.h"
|
|
2
|
-
#include "RNOHPackagesFactory.h"
|
|
3
|
-
#include "generated/RNOHGeneratedPackage.h"
|
|
4
|
-
|
|
5
|
-
using namespace rnoh;
|
|
6
|
-
|
|
7
|
-
std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(
|
|
8
|
-
Package::Context ctx) {
|
|
9
|
-
auto packages = createRNOHPackages(ctx); // <= autolinking
|
|
10
|
-
packages.push_back(std::make_shared<RNOHGeneratedPackage>(
|
|
11
|
-
ctx)); // generated by codegen-harmony v1 on app preBuilt stage)
|
|
12
|
-
return packages;
|
|
13
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
|
|
2
|
-
import { createRNOHPackages as createRNOHPackagesAutolinking } from "./RNOHPackagesFactory"
|
|
3
|
-
|
|
4
|
-
export function getRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
|
|
5
|
-
return [
|
|
6
|
-
...createRNOHPackagesAutolinking(ctx)
|
|
7
|
-
]
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {RNAbility} from '@rnoh/react-native-openharmony';
|
|
2
|
-
|
|
3
|
-
export default class EntryAbility extends RNAbility {
|
|
4
|
-
override getPagePath() {
|
|
5
|
-
return 'pages/Index';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
override getRNOHWorkerScriptUrl() {
|
|
9
|
-
return "entry/ets/workers/RNOHWorker.ets"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/RNOHPackagesFactory.ets
|
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Importing some ets files in the following way results in runtime errors e.g.
|
|
3
|
-
* import { setupRNOHWorker } from "@rnoh/react-native-openharmony"
|
|
4
|
-
*
|
|
5
|
-
* It looks like this is ArkTS problem and it may be fixed in the future.
|
|
6
|
-
* For the time being, use direct imports.
|
|
7
|
-
*/
|
|
8
|
-
import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker"
|
|
9
|
-
import { getRNOHPackages } from "../PackageProvider"
|
|
10
|
-
|
|
11
|
-
setupRNOHWorker({
|
|
12
|
-
createWorkerRNInstanceConfig: (_rnInstanceName) => {
|
|
13
|
-
return { thirdPartyPackagesFactory: getRNOHPackages }
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "entry",
|
|
4
|
-
"type": "entry",
|
|
5
|
-
"description": "$string:module_desc",
|
|
6
|
-
"mainElement": "EntryAbility",
|
|
7
|
-
"deviceTypes": [
|
|
8
|
-
"default"
|
|
9
|
-
],
|
|
10
|
-
"deliveryWithInstall": true,
|
|
11
|
-
"installationFree": false,
|
|
12
|
-
"pages": "$profile:main_pages",
|
|
13
|
-
// This is needed by bundleManager.canOpenLink to check if the app can open some url
|
|
14
|
-
"querySchemes": [
|
|
15
|
-
"maps",
|
|
16
|
-
"http",
|
|
17
|
-
"https",
|
|
18
|
-
"customDomain"
|
|
19
|
-
],
|
|
20
|
-
"requestPermissions": [
|
|
21
|
-
{
|
|
22
|
-
"name": "ohos.permission.INTERNET"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "ohos.permission.VIBRATE"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"metadata": [
|
|
29
|
-
{
|
|
30
|
-
"name": "OPTLazyForEach",
|
|
31
|
-
"value": "true",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "can_preview_text",
|
|
35
|
-
"value": "true",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "halfLeading",
|
|
39
|
-
"value": "true",
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
"abilities": [
|
|
43
|
-
{
|
|
44
|
-
"name": "EntryAbility",
|
|
45
|
-
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
|
46
|
-
"description": "$string:EntryAbility_desc",
|
|
47
|
-
"icon": "$media:layered_image",
|
|
48
|
-
"label": "$string:EntryAbility_label",
|
|
49
|
-
"startWindowIcon": "$media:startIcon",
|
|
50
|
-
"startWindowBackground": "$color:start_window_background",
|
|
51
|
-
"visible": true,
|
|
52
|
-
"skills": [
|
|
53
|
-
{
|
|
54
|
-
"entities": [
|
|
55
|
-
"entity.system.home"
|
|
56
|
-
],
|
|
57
|
-
"actions": [
|
|
58
|
-
"action.system.home"
|
|
59
|
-
],
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
rawfile/assets
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
modelVersion: '5.0.0',
|
|
3
|
-
dependencies: {
|
|
4
|
-
// "@rnoh/hvigor-plugin": "../../node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz",
|
|
5
|
-
},
|
|
6
|
-
execution: {
|
|
7
|
-
// "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
|
|
8
|
-
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
|
|
9
|
-
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
|
|
10
|
-
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
|
|
11
|
-
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
|
|
12
|
-
},
|
|
13
|
-
logging: {
|
|
14
|
-
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
|
|
15
|
-
},
|
|
16
|
-
debugging: {
|
|
17
|
-
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
|
|
18
|
-
},
|
|
19
|
-
nodeOptions: {
|
|
20
|
-
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
|
|
21
|
-
},
|
|
22
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|