diff --git a/packages/fluwx/ohos b/packages/fluwx/ohos deleted file mode 120000 index 74fecdfa..00000000 --- a/packages/fluwx/ohos +++ /dev/null @@ -1 +0,0 @@ -../_shared/ohos \ No newline at end of file diff --git a/packages/fluwx/ohos/.gitignore b/packages/fluwx/ohos/.gitignore new file mode 100644 index 00000000..161bdcda --- /dev/null +++ b/packages/fluwx/ohos/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/packages/fluwx/ohos/build-profile.json5 b/packages/fluwx/ohos/build-profile.json5 new file mode 120000 index 00000000..77396b12 --- /dev/null +++ b/packages/fluwx/ohos/build-profile.json5 @@ -0,0 +1 @@ +../../_shared/ohos/build-profile.json5 \ No newline at end of file diff --git a/packages/fluwx/ohos/hvigorfile.ts b/packages/fluwx/ohos/hvigorfile.ts new file mode 120000 index 00000000..a56b985c --- /dev/null +++ b/packages/fluwx/ohos/hvigorfile.ts @@ -0,0 +1 @@ +../../_shared/ohos/hvigorfile.ts \ No newline at end of file diff --git a/packages/fluwx/ohos/index.ets b/packages/fluwx/ohos/index.ets new file mode 120000 index 00000000..9321f783 --- /dev/null +++ b/packages/fluwx/ohos/index.ets @@ -0,0 +1 @@ +../../_shared/ohos/index.ets \ No newline at end of file diff --git a/packages/_shared/ohos/oh-package.json5 b/packages/fluwx/ohos/oh-package.json5 similarity index 100% rename from packages/_shared/ohos/oh-package.json5 rename to packages/fluwx/ohos/oh-package.json5 diff --git a/packages/fluwx/ohos/src/main/ets b/packages/fluwx/ohos/src/main/ets new file mode 120000 index 00000000..389987be --- /dev/null +++ b/packages/fluwx/ohos/src/main/ets @@ -0,0 +1 @@ +../../../../_shared/ohos/src/main/ets \ No newline at end of file diff --git a/packages/_shared/ohos/src/main/module.json5 b/packages/fluwx/ohos/src/main/module.json5 similarity index 100% rename from packages/_shared/ohos/src/main/module.json5 rename to packages/fluwx/ohos/src/main/module.json5 diff --git a/packages/fluwx_no_pay/ohos b/packages/fluwx_no_pay/ohos deleted file mode 120000 index 74fecdfa..00000000 --- a/packages/fluwx_no_pay/ohos +++ /dev/null @@ -1 +0,0 @@ -../_shared/ohos \ No newline at end of file diff --git a/packages/fluwx_no_pay/ohos/.gitignore b/packages/fluwx_no_pay/ohos/.gitignore new file mode 100644 index 00000000..161bdcda --- /dev/null +++ b/packages/fluwx_no_pay/ohos/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/packages/fluwx_no_pay/ohos/build-profile.json5 b/packages/fluwx_no_pay/ohos/build-profile.json5 new file mode 120000 index 00000000..77396b12 --- /dev/null +++ b/packages/fluwx_no_pay/ohos/build-profile.json5 @@ -0,0 +1 @@ +../../_shared/ohos/build-profile.json5 \ No newline at end of file diff --git a/packages/fluwx_no_pay/ohos/hvigorfile.ts b/packages/fluwx_no_pay/ohos/hvigorfile.ts new file mode 120000 index 00000000..a56b985c --- /dev/null +++ b/packages/fluwx_no_pay/ohos/hvigorfile.ts @@ -0,0 +1 @@ +../../_shared/ohos/hvigorfile.ts \ No newline at end of file diff --git a/packages/fluwx_no_pay/ohos/index.ets b/packages/fluwx_no_pay/ohos/index.ets new file mode 120000 index 00000000..9321f783 --- /dev/null +++ b/packages/fluwx_no_pay/ohos/index.ets @@ -0,0 +1 @@ +../../_shared/ohos/index.ets \ No newline at end of file diff --git a/packages/fluwx_no_pay/ohos/oh-package.json5 b/packages/fluwx_no_pay/ohos/oh-package.json5 new file mode 100644 index 00000000..5631e613 --- /dev/null +++ b/packages/fluwx_no_pay/ohos/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "name": "fluwx_no_pay", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "index.ets", + "author": "", + "license": "Apache-2.0", + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har", + "@tencent/wechat_open_sdk": "1.0.19" + } +} diff --git a/packages/fluwx_no_pay/ohos/src/main/ets b/packages/fluwx_no_pay/ohos/src/main/ets new file mode 120000 index 00000000..389987be --- /dev/null +++ b/packages/fluwx_no_pay/ohos/src/main/ets @@ -0,0 +1 @@ +../../../../_shared/ohos/src/main/ets \ No newline at end of file diff --git a/packages/fluwx_no_pay/ohos/src/main/module.json5 b/packages/fluwx_no_pay/ohos/src/main/module.json5 new file mode 100644 index 00000000..b30a73e1 --- /dev/null +++ b/packages/fluwx_no_pay/ohos/src/main/module.json5 @@ -0,0 +1,10 @@ +{ + "module": { + "name": "fluwx_no_pay", + "type": "har", + "deviceTypes": [ + "default", + "tablet" + ] + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 2b0ab25d..e01a3585 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,8 +65,12 @@ melos: test -L packages/fluwx_no_pay/example/lib/pages || (echo "❌ fluwx_no_pay example pages symlink missing" && exit 1) test -L packages/fluwx/example/images || (echo "❌ fluwx example images symlink missing" && exit 1) test -L packages/fluwx_no_pay/example/images || (echo "❌ fluwx_no_pay example images symlink missing" && exit 1) - test -L packages/fluwx/ohos || (echo "❌ fluwx/ohos symlink missing" && exit 1) - test -L packages/fluwx_no_pay/ohos || (echo "❌ fluwx_no_pay/ohos symlink missing" && exit 1) + for package in fluwx fluwx_no_pay; do + for path in build-profile.json5 hvigorfile.ts index.ets src/main/ets; do + test -L "packages/$package/ohos/$path" && test -e "packages/$package/ohos/$path" || exit 1 + done + done + dart tools/check_ohos_metadata.dart || exit 1 echo "✅ 所有 symlink 完好" publish:all: diff --git a/tools/check_ohos_metadata.dart b/tools/check_ohos_metadata.dart new file mode 100644 index 00000000..1f7e1687 --- /dev/null +++ b/tools/check_ohos_metadata.dart @@ -0,0 +1,33 @@ +// ignore_for_file: avoid_print +import 'dart:convert'; +import 'dart:io'; + +/// Run from the workspace root before publishing either package. +void main() { + for (final package in ['fluwx', 'fluwx_no_pay']) { + final root = 'packages/$package'; + final pubspec = File('$root/pubspec.yaml').readAsStringSync(); + final name = RegExp( + r'^name:\s*(\S+)\s*$', + multiLine: true, + ).firstMatch(pubspec)?.group(1); + // These metadata files intentionally use the JSON subset of JSON5. + final ohPackage = jsonDecode( + File('$root/ohos/oh-package.json5').readAsStringSync(), + ); + final module = jsonDecode( + File('$root/ohos/src/main/module.json5').readAsStringSync(), + ); + if (name != package || + ohPackage['name'] != name || + module['module']['name'] != name) { + stderr.writeln( + '$package: inconsistent names: pubspec=$name, ' + 'OHPM=${ohPackage['name']}, module=${module['module']['name']}', + ); + exitCode = 1; + } + } + if (exitCode == 0) + print('OHOS package and module names match both pubspecs.'); +}