diff --git a/OAT.xml b/OAT.xml
index 8b1ee7c6171ed83c2ce05e6858416eb902b9b986..368ffe0de9e5242815f7f4e8ec4ea124d9333c45 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -137,7 +137,12 @@ Note:If the text contains special characters, please escape them according to th
-
+
+
+
+
+
+
@@ -2135,7 +2140,17 @@ Note:If the text contains special characters, please escape them according to th
-
+
+
+
+
+
+
+
+
+
+
+
@@ -2225,6 +2240,16 @@ Note:If the text contains special characters, please escape them according to th
+
+
+
+
+
+
+
+
+
+
diff --git a/code/ArkTS1.2/interopSample/.gitignore b/code/ArkTS1.2/interopSample/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/AppScope/app.json5 b/code/ArkTS1.2/interopSample/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..17b3e2f35a2fc801269a481f121d9a21a5b4eafa
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.interopsample",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/AppScope/resources/base/element/string.json b/code/ArkTS1.2/interopSample/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6706d4a1db2e03281ad12dd1255b64584610307d
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "InteropSample"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/AppScope/resources/base/media/RM002_preview.png b/code/ArkTS1.2/interopSample/AppScope/resources/base/media/RM002_preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..30000bece7034fb33c72d2b177ddcfa2e353d63c
Binary files /dev/null and b/code/ArkTS1.2/interopSample/AppScope/resources/base/media/RM002_preview.png differ
diff --git a/code/ArkTS1.2/interopSample/AppScope/resources/base/media/app_icon.png b/code/ArkTS1.2/interopSample/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/code/ArkTS1.2/interopSample/AppScope/resources/base/media/app_icon.png differ
diff --git a/code/ArkTS1.2/interopSample/README.md b/code/ArkTS1.2/interopSample/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..438f99225760adb89cf9679073b30e611211da58
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/README.md
@@ -0,0 +1,89 @@
+# interop配套示例
+
+### Interop介绍
+Interop可以实现混合开发场景的模块相互通信场景,具体场景有ArkTS1.2中使用ArkTS1.0;ArkTS1.0中使用ArkTS1.2;ArkTS1.2中使用TS;ArkTS1.2中使用JS四种
+
+### 实现思路
+以场景一:ArkTS1.2中使用ArkTS1.0为例
+
+新建Har包arkts1_0har用arkTs1.0语法编写代码
+在arkts1_0har定义常量SUBJECT、类Student,类成员变量name、sex、studentID、age、height、phone、averageGrade、gradePoint、isBoarder和transcript等,定义错误类ReferenceError,类成员函数introduce和setSubjectScore,函数calTotalScore和calAverageScore
+
+在entry目录下新建1.2.ets文件导入常量SUBJECT、类Student,定义函数test和errorHandle调用har包中方法,点击按钮可调用test和errorHandle函数,将这两个函数的返回值显示在页面上
+
+①文件导入
+
+在1.2.ets文件中导入常量SUBJECT、类Student
+
+②类实例化
+
+在test函数内,实例化类Student,新增一个学生student1为A
+
+③属性读写
+
+读:访问A的年龄为20岁,写:更新A的年龄为20岁
+
+④函数调用
+
+调用calTotalScore计算总成绩
+
+⑤对象方法调用
+
+调用student1.introduce获取学生信息,比如姓名、学号、年龄、身高、电话、上次平均成绩、gradePoint和是否住校;调用student1.setSubjectScore,将A的成绩set到成绩表transcript中
+
+⑥参数传递
+
+调用calAverageScore计算平均成绩
+
+⑦异常处理
+
+在arkts1_0har中定义错误类ReferenceError,在1.2.ets中导入被捕获处理,正确返回错误信息reference error
+
+ArkTS1.0中使用ArkTS1.2;ArkTS1.2中使用TS;ArkTS1.2中使用JS等三个场景可以参考ArkTS1.2中使用ArkTS1.0
+
+### 效果预览
+
+使用说明
+
+在首页,依次点击蓝色按钮会在按钮下方空白位置打印出对应日志
+
+效果如下所示:
+
+
+
+### 工程目录
+
+```
+entry/src/main/ets/
+|---pages
+ |---Use1From2
+ |---1.2.ets // 1.2代码
+ |---Use2From1
+ |---1.0.ets // 1.0代码
+ |---UseJSFrom2
+ |---1.2.ets // 1.2代码
+ |---UseTSFrom2
+ |---1.2.ets // 1.2代码
+ |---index.ets // interop首页
+arkts1_0har/src/main/ets/
+|---components
+ |---ArkTSVersion_1.ets // 1.0代码
+arkts1_2har/src/main/ets/
+|---components
+ |---ArkTSVersion_2.ets // 1.2代码
+jshar/src/main/ets/
+|---components
+ |---JSTest.js // JS代码
+tshar/src/main/ets/
+|---components
+ |---TSTest.ts // TS代码
+```
+
+### 相关权限
+无
+### 依赖
+无
+### 约束与限制
+1. 本示例仅支持标准系统上运行,支持设备:Mate70pro;
+2. 本示例支持API17版本SDK,SDK版本号(API Version 17),日期(2025.4.19),镜像版本号(5.0.1);
+3. 本示例需要使用DevEco Studio 版本号(6.0.0.4)版本才可编译运行。
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/.gitignore b/code/ArkTS1.2/interopSample/arkts1_0har/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/BuildProfile.ets b/code/ArkTS1.2/interopSample/arkts1_0har/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/BuildProfile.ets
@@ -0,0 +1,17 @@
+/**
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
+ */
+export const HAR_VERSION = '1.0.0';
+export const BUILD_MODE_NAME = 'debug';
+export const DEBUG = true;
+export const TARGET_NAME = 'default';
+
+/**
+ * BuildProfile Class is used only for compatibility purposes.
+ */
+export default class BuildProfile {
+ static readonly HAR_VERSION = HAR_VERSION;
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
+ static readonly DEBUG = DEBUG;
+ static readonly TARGET_NAME = TARGET_NAME;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/Index.ets b/code/ArkTS1.2/interopSample/arkts1_0har/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..42bf4161c271e1b14d42a7ab98c982acc9bc3592
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/Index.ets
@@ -0,0 +1 @@
+export { MainPage } from './src/main/ets/components/MainPage';
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/build-profile.json5 b/code/ArkTS1.2/interopSample/arkts1_0har/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d236788de4d4adfdad3dc890d242825a083ec983
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/build-profile.json5
@@ -0,0 +1,32 @@
+{
+ "apiType": "stageMode",
+ "arkTSVersion": "1.0",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/consumer-rules.txt b/code/ArkTS1.2/interopSample/arkts1_0har/consumer-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/hvigorfile.ts b/code/ArkTS1.2/interopSample/arkts1_0har/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/obfuscation-rules.txt b/code/ArkTS1.2/interopSample/arkts1_0har/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/oh-package.json5 b/code/ArkTS1.2/interopSample/arkts1_0har/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4b1b3f1a6e8fc8e001112b3f1c98f2a71ec94fe5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/oh-package.json5
@@ -0,0 +1,9 @@
+{
+ "name": "arkts1_0har",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "Index.ets",
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {}
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/ArkTSVersion_1.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/ArkTSVersion_1.ets
new file mode 100644
index 0000000000000000000000000000000000000000..22366f1cd688757275016b9524a850b389489dcc
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/ArkTSVersion_1.ets
@@ -0,0 +1,59 @@
+export const SUBJECT: Set = new Set(['语文', '数学', '英语', '物理', '化学', '生物']);
+
+export class Student {
+ public name: string = '';
+ public sex: string = '';
+ public studentID: number = 1001;
+ public age: number = 18;
+ public height: number = 175;
+ public phone: number = 13820002025;
+ public averageGrade: number = 81.75;
+ public gradePoint: number = 3.85;
+ public isBoarder: boolean = true;
+ public transcript: Map = new Map();
+
+ constructor(name: string, sex: string, studentID: number, age: number, height: number, phone: number,
+ averageGrade: number,
+ gradePoint: number, isBoarder: boolean) {
+ this.name = name;
+ this.sex = sex;
+ this.studentID = studentID;
+ this.age = age;
+ this.height = height;
+ this.phone = phone;
+ this.averageGrade = averageGrade;
+ this.gradePoint = gradePoint;
+ this.isBoarder = isBoarder;
+ }
+
+ introduce(): string {
+ let boarderStatus = this.isBoarder ? '住宿生' : '走读生';
+ return `姓名${this.name},学号${this.studentID},今年${this.age}岁,身高${this.height},电话${this.phone}, 上次平均成绩是${this.averageGrade},gradePoint: ${this.gradePoint}, 是一名${boarderStatus}`;
+ }
+
+ setSubjectScore(subject: string, score: number): void {
+ if (score < 0 && score > 100) {
+ throw new Error();
+ }
+ this.transcript.set(subject, score);
+ }
+}
+
+export function calTotalScore(student: Student): number {
+ let total = 0;
+ for (let score of student.transcript.values()) {
+ total += score;
+ }
+ return total;
+}
+
+export function calAverageScore(totalScore: number, subjectCount: number): string {
+ if (subjectCount === 0) {
+ throw new Error();
+ }
+ let averageScore = totalScore / subjectCount;
+ let averageScoreStr = String(Math.round(averageScore * 100) / 100);
+ return averageScoreStr;
+}
+
+export let referenceErr: ReferenceError = new ReferenceError('reference error');
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/MainPage.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a2cd7edbafda054fee35c9bb9cd77ce98bd4e18f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/ets/components/MainPage.ets
@@ -0,0 +1,17 @@
+@Component
+export struct MainPage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/main/module.json5 b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..66145f6c9c57db61ade3d6bf0887bce737914e77
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/module.json5
@@ -0,0 +1,11 @@
+{
+ "module": {
+ "name": "arkts1_0har",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ]
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/float.json b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/string.json b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/Ability.test.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,35 @@
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/List.test.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/module.json5 b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6a8a476d12e5cdfa1f399b9b1fd00071361e6dd9
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/ohosTest/module.json5
@@ -0,0 +1,13 @@
+{
+ "module": {
+ "name": "jshar_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/test/List.test.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/test/List.test.ets
@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_0har/src/test/LocalUnit.test.ets b/code/ArkTS1.2/interopSample/arkts1_0har/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_0har/src/test/LocalUnit.test.ets
@@ -0,0 +1,33 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/.gitignore b/code/ArkTS1.2/interopSample/arkts1_2har/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/BuildProfile.ets b/code/ArkTS1.2/interopSample/arkts1_2har/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1499e75a1aad217f7c0cb69066a1941407cf7bd6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/BuildProfile.ets
@@ -0,0 +1,17 @@
+/**
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
+ */
+export const HAR_VERSION = '1.0.0';
+export const BUILD_MODE_NAME = 'debug';
+export const DEBUG = true;
+export const TARGET_NAME = 'default';
+
+/**
+ * BuildProfile Class is used only for compatibility purposes.
+ */
+export default class BuildProfile {
+ public static readonly HAR_VERSION = HAR_VERSION;
+ public static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
+ public static readonly DEBUG = DEBUG;
+ public static readonly TARGET_NAME = TARGET_NAME;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/Index.ets b/code/ArkTS1.2/interopSample/arkts1_2har/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..eb7a3e4535d761cf6a262f359b3fbdf6aba34a56
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/Index.ets
@@ -0,0 +1,3 @@
+export { MainPage } from './src/main/ets/components/MainPage';
+
+export { referenceErr, Student, SUBJECT, calTotalScore, calAverageScore } from './src/main/ets/components/ArkTSVersion_2';
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/build-profile.json5 b/code/ArkTS1.2/interopSample/arkts1_2har/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..07ee333f99aeb6ca454106077b1e4f4375344aae
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/build-profile.json5
@@ -0,0 +1,32 @@
+{
+ "apiType": "stageMode",
+ "arkTSVersion": "1.2",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/consumer-rules.txt b/code/ArkTS1.2/interopSample/arkts1_2har/consumer-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/hvigorfile.ts b/code/ArkTS1.2/interopSample/arkts1_2har/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a4f778bafdc2aadaa71a1913cebb145048996218
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/obfuscation-rules.txt b/code/ArkTS1.2/interopSample/arkts1_2har/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/oh-package.json5 b/code/ArkTS1.2/interopSample/arkts1_2har/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..68b84239a978091079919b5ccc68614bb922850c
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/oh-package.json5
@@ -0,0 +1,9 @@
+{
+ "name": "arkts1_2har",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "Index.ets",
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {}
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/ArkTSVersion_2.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/ArkTSVersion_2.ets
new file mode 100644
index 0000000000000000000000000000000000000000..eb030559b83427abb7236a0155be3b8fdda6952f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/ArkTSVersion_2.ets
@@ -0,0 +1,58 @@
+export const SUBJECT: Set = new Set(['语文', '数学', '英语', '物理', '化学', '生物']);
+
+export class Student {
+ public name: string = '';
+ public sex: char = 'M';
+ public studentID: number = 1001;
+ public age: number = 18;
+ public height: int = 175;
+ public phone: long = 13820002025;
+ public averageGrade: float = 81.75;
+ public gradePoint: double = 3.85;
+ public isBoarder: boolean = true;
+ public transcript: Map = new Map()
+
+ constructor(name: string, sex: char, studentID: number, age: number, height: int, phone: long, averageGrade: float,
+ gradePoint: double, isBoarder: boolean) {
+ this.name = name;
+ this.sex = sex;
+ this.studentID = studentID;
+ this.age = age;
+ this.height = height;
+ this.phone = phone;
+ this.averageGrade = averageGrade;
+ this.gradePoint = gradePoint;
+ this.isBoarder = isBoarder;
+ }
+
+ introduce(): string {
+ let boarderStatus = this.isBoarder ? '住宿生' : '走读生';
+ return `姓名${this.name},学号${this.studentID},今年${this.age}岁,身高${this.height},电话${this.phone}, 上次平均成绩是${this.averageGrade},gradePoint: ${this.gradePoint}, 是一名${boarderStatus}`;
+ }
+
+ setSubjectScore(subject: string, score: number): void {
+ if (score < 0 && score > 100) {
+ throw new Error();
+ }
+ this.transcript.set(subject, score);
+ }
+}
+
+export function calTotalScore(student: Student): number {
+ let total = 0;
+ for (let score of student.transcript.values()) {
+ total += score;
+ }
+ return total;
+}
+
+export function calAverageScore(totalScore: number, subjectCount: number): string {
+ if (subjectCount === 0) {
+ throw new Error();
+ }
+ let averageScore = totalScore / subjectCount;
+ let averageScoreStr = String(Math.round(averageScore * 100) / 100);
+ return averageScoreStr;
+}
+
+export let referenceErr: ReferenceError = new ReferenceError('reference error');
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/MainPage.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..755bc18bf0a5b7c9651495cfbd1278a2378c242f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/ets/components/MainPage.ets
@@ -0,0 +1,20 @@
+import { Row, Column, Text, TextAttribute, Component } from '@ohos.arkui.component'
+import { State, StateDecoratedVariable, } from '@ohos.arkui.stateManagement'
+
+@Component
+export struct MainPage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/main/module.json5 b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..16107b231615b638ffa51079a8df2212de9d5c4d
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/module.json5
@@ -0,0 +1,11 @@
+{
+ "module": {
+ "name": "arkts1_2har",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/float.json b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/string.json b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/Ability.test.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,35 @@
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/List.test.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/module.json5 b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a5cb1e9aaf8727ad226cfcf41d89dd623fdf3f28
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/ohosTest/module.json5
@@ -0,0 +1,13 @@
+{
+ "module": {
+ "name": "jshar_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/test/List.test.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/test/List.test.ets
@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/arkts1_2har/src/test/LocalUnit.test.ets b/code/ArkTS1.2/interopSample/arkts1_2har/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/arkts1_2har/src/test/LocalUnit.test.ets
@@ -0,0 +1,33 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/build-profile.json5 b/code/ArkTS1.2/interopSample/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..14a154db5a43b39996dcb62e6c3099bb0b665678
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/build-profile.json5
@@ -0,0 +1,58 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ "arkTSVersion": "1.2",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "jshar",
+ "srcPath": "./jshar"
+ },
+ {
+ "name": "tshar",
+ "srcPath": "./tshar",
+ },
+ {
+ "name": "arkts1_0har",
+ "srcPath": "./arkts1_0har",
+ },
+ {
+ "name": "arkts1_2har",
+ "srcPath": "./arkts1_2har",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/code-linter.json5 b/code/ArkTS1.2/interopSample/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..073990fa45394e1f8e85d85418ee60a8953f9b99
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/code-linter.json5
@@ -0,0 +1,32 @@
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ "@security/no-unsafe-aes": "error",
+ "@security/no-unsafe-hash": "error",
+ "@security/no-unsafe-mac": "warn",
+ "@security/no-unsafe-dh": "error",
+ "@security/no-unsafe-dsa": "error",
+ "@security/no-unsafe-ecdsa": "error",
+ "@security/no-unsafe-rsa-encrypt": "error",
+ "@security/no-unsafe-rsa-sign": "error",
+ "@security/no-unsafe-rsa-key": "error",
+ "@security/no-unsafe-dsa-key": "error",
+ "@security/no-unsafe-dh-key": "error",
+ "@security/no-unsafe-3des": "error"
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/.gitignore b/code/ArkTS1.2/interopSample/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/build-profile.json5 b/code/ArkTS1.2/interopSample/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..580b7c9fd626a023234a2f595d9ec1212f6ef41d
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/build-profile.json5
@@ -0,0 +1,32 @@
+{
+ "apiType": "stageMode",
+ "arkTSVersion": "1.2",
+ "buildOption": {
+ "sourceOption": {
+ "workers": []
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/hvigorfile.ts b/code/ArkTS1.2/interopSample/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a807cf961ed92d1bedf0535c88362e1d0b22c7a5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/obfuscation-rules.txt b/code/ArkTS1.2/interopSample/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/oh-package.json5 b/code/ArkTS1.2/interopSample/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f9126e4469cad9c2442a30128086e882855c16c0
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/oh-package.json5
@@ -0,0 +1,14 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "jshar": "file:../jshar",
+ "tshar": "file:../tshar",
+ "arkts1_0har": "file:../arkts1_0har",
+ "arkts1_2har": "file:../arkts1_2har"
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/entryability/EntryAbility.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ec1e50072e5222f0cf60bc4c743bd0d58fc210a
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,28 @@
+import UIAbility from '@ohos.app.ability.UIAbility';
+import AbilityConstant from '@ohos.app.ability.AbilityConstant';
+import Want from '@ohos.app.ability.Want';
+import window from '@ohos.window';
+import { BusinessError } from '@ohos.base'
+import hilog from '@ohos.hilog'
+
+class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', 'EntryAbility onCreate');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ hilog.info(0x0000, 'testTag', 'EntryAbility onWindowStageCreate');
+ try {
+ windowStage.loadContent('pages/Index', (err: BusinessError): void => {
+ hilog.info(0x0000, 'testTag', 'loadContent entering');
+ if (err.code) {
+ hilog.info(0x0000, 'testTag', 'loadContent error');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'loadContent ok');
+ });
+ } catch (e: Error) {
+ hilog.info(0x0000, 'testTag', 'loadContent catch error:-----------' + e.message);
+ }
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/models/MyCallback.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/models/MyCallback.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5827b846dc824ef26c25e0a8612717cb7b448a3a
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/models/MyCallback.ets
@@ -0,0 +1,38 @@
+import { AsyncCallback, BusinessError, Callback, ErrorCallback } from '@ohos.base';
+import hilog from '@ohos.hilog';
+
+const SYNTAX_ERROR_CODE: double = 1002;
+
+export class MyCallback {
+ static myCallback(callback: Callback): void {
+ hilog.info(0x0000, 'testTag', 'myCallback');
+ callback('myCallback');
+ }
+
+ static myAsyncCallback(callback: AsyncCallback): void {
+ hilog.info(0x0000, 'testTag', 'myAsyncCallback');
+ let error = new Error('Business Error', 'basicError2 message', undefined);
+ let be2: BusinessError = new BusinessError(SYNTAX_ERROR_CODE, error);
+ callback(be2, 'yAsyncCallback');
+ }
+
+ static myErrorCallback(callback: ErrorCallback>): void {
+ hilog.info(0x0000, 'testTag', 'myErrorCallback');
+ let error = new Error('Business Error', 'myErrorCallback message', undefined);
+ let result: string = 'test';
+ let be: BusinessError = new BusinessError(SYNTAX_ERROR_CODE, result, error);
+ callback(be);
+ }
+
+ static runCasesOfCallback() {
+ MyCallback.myCallback((data: string) => {
+ hilog.info(0x0000, 'testTag', 'MyCallback' + data);
+ })
+ MyCallback.myAsyncCallback((error: BusinessError, result: string) => {
+ hilog.info(0x0000, 'testTag', `myAsyncCallback, error: ${error.message}, result:${result}`);
+ })
+ MyCallback.myErrorCallback((error: BusinessError) => {
+ hilog.info(0x0000, 'testTag', `myAsyncCallback, error: ${error.message}`);
+ })
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Index.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3ea9a701991e2280006f768bc819b2049ffbe16e
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,118 @@
+import {
+ memo,
+ __memo_context_type,
+ __memo_id_type
+} from '@ohos.arkui.stateManagement' // should be insert by ui-plugins
+import {
+ Text,
+ TextAttribute,
+ Column,
+ Component,
+ Button,
+ ButtonAttribute,
+ ClickEvent,
+ UserView,
+ Row,
+ Scroll
+} from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins
+import {
+ State,
+ StateDecoratedVariable,
+ MutableState,
+ stateOf,
+ observableProxy
+} from '@ohos.arkui.stateManagement' // should be insert by ui-plugins
+import hilog from '@ohos.hilog'
+import { test, ErrorHandle } from './Use1From2/1.2.ets'
+import { test2, ErrorHandle2 } from './Use2From1/1.0.ets'
+import { test3, ErrorHandle3 } from './UseJSFrom2/1.2.ets'
+import { test4, ErrorHandle4 } from './UseTSFrom2/1.2.ets'
+
+@Component
+struct MyStateSample {
+ @State logs: Array = new Array();
+ @State logs2: Array = new Array();
+ @State logs3: Array = new Array();
+ @State logs4: Array = new Array();
+ @State message: string = '场景一:use 1.0 from 1.2';
+ @State message2: string = '场景二:use 1.2 from 1.0';
+ @State message3: string = '场景三:use JS from 1.2';
+ @State message4: string = '场景四:use TS from 1.2';
+ @State logsString: string = '';
+ @State logsString2: string = '';
+ @State logsString3: string = '';
+ @State logsString4: string = '';
+
+ build() {
+ Scroll() {
+ Column() {
+ Button(this.message)
+ .width(`80%`)
+ .height(40)
+ .onClick((e: ClickEvent) => {
+ this.logs = test();
+ let errorHandleLog = ErrorHandle();
+ this.logs.push(errorHandleLog);
+ this.logsString = this.logs.join(`\n`);
+ })
+ Text(this.logsString)
+ .width('80%')
+ .height(160)
+ .fontSize(16)
+ Button(this.message2)
+ .width(`80%`)
+ .height(40)
+ .onClick((e: ClickEvent) => {
+ this.logs2 = test2();
+ let errorHandleLog = ErrorHandle2();
+ this.logs2.push(errorHandleLog);
+ this.logsString2 = this.logs2.join(`\n`);
+ })
+ Text(this.logsString2)
+ .width('80%')
+ .height(150)
+ .fontSize(16);
+ Button(this.message3)
+ .width(`80%`)
+ .height(40)
+ .onClick((e: ClickEvent) => {
+ this.logs3 = test3();
+ let errorHandleLog = ErrorHandle3();
+ this.logs3.push(errorHandleLog);
+ this.logsString3 = this.logs3.join(`\n`);
+ })
+ Text(this.logsString3)
+ .width('80%')
+ .height(140)
+ .fontSize(16);
+ Button(this.message4)
+ .width(`80%`)
+ .height(40)
+ .onClick((e: ClickEvent) => {
+ this.logs4 = test4();
+ let errorHandleLog = ErrorHandle4();
+ this.logs4.push(errorHandleLog);
+ this.logsString4 = this.logs4.join(`\n`);
+ })
+ Text(this.logsString4)
+ .width('80%')
+ .height(140)
+ .fontSize(16);
+ }
+ }.width('100%')
+ .height('100%')
+
+ }
+}
+
+export class ComExampleTrivialApplication extends UserView {
+ getBuilder() {
+ hilog.info(0x0000, 'testTag', 'getBuilder');
+ let wrapper = @memo() =>
+ {
+ hilog.info(0x0000, 'testTag', 'MyStateSample');
+ MyStateSample()
+ }
+ return wrapper
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use1from2/1.2.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use1from2/1.2.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c28d28947be0ffde1ac0e64afd603558d3d7110a
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use1from2/1.2.ets
@@ -0,0 +1,58 @@
+export function test(): Array {
+ let logs: Array = new Array();
+ // 1.文件导入
+ const module =
+ ESObject.load('@normalized:N&entry&com.example.liang123&arkts1_0har/src/main/ets/components/ArkTSVersion_1&1.0.0');
+ let student = module.getProperty('Student');
+ const SUBJECT = module.getProperty('SUBJECT');
+ // 2.类实例化
+ let argName: string = 'A';
+ let argSex: char = 'M';
+ let argstudentID: short = 1001;
+ let argAge: byte = 18;
+ let argHeight: int = 175;
+ let argPhone: long = 13820002025;
+ let argAverageGrade: float = 81.75;
+ let arggradePoint: double = 3.85;
+ let argIsBoarder: boolean = false;
+ let student1 =
+ student.instantiate(ESObject.wrapString(argName), argSex, ESObject.wrapShort(argstudentID),
+ ESObject.wrapByte(argAge),
+ ESObject.wrapInt(argHeight),
+ ESObject.wrapLong(argPhone), ESObject.wrapFloat(argAverageGrade), ESObject.wrapDouble(arggradePoint),
+ ESObject.wrapBoolean(argIsBoarder));
+ let score = [75, 68, 80, 90, 92, 78];
+ let index = 0;
+ for (let item of SUBJECT) {
+ student1.invokeMethod('setSubjectScore', item, score[index]);
+ index++;
+ }
+ // 3.属性读写
+ let name = student1.getProperty('name').toString();
+ let age = student1.getProperty('age').toNumber();
+ let sex = student1.getProperty('sex').toString();
+ let isBoarder = student1.getProperty('isBoarder').toBoolean();
+ logs.push(`${name}的年龄为${age}岁。`);
+ student1.setProperty('age', 20);
+ let newAge = student1.getProperty('age').toNumber();
+ logs.push(`更新${name}的年龄为${newAge}岁。`);
+ // 5.对象方法调用
+ logs.push(`${name}的个人信息: ${student1.invokeMethod('introduce')}`);
+ // 4.函数调用
+ let calTotalScore = module.getProperty('calTotalScore');
+ let calAverageScore = module.getProperty('calAverageScore');
+ let totalScore = calTotalScore.invoke(student1).toNumber();
+ // 6.参数传递
+ let averageScore = calAverageScore.invoke(ESObject.wrapNumber(totalScore), ESObject.wrapNumber(6));
+ logs.push(`总成绩:${totalScore},平均分:${averageScore}`);
+ return logs;
+}
+
+// 7.异常
+export function ErrorHandle(): string {
+ const module =
+ ESObject.load('@normalized:N&entry&com.example.liang123&arkts1_0har/src/main/ets/components/ArkTSVersion_1&1.0.0');
+ let referenceErr = module.getProperty('referenceErr');
+ let errorInfo = referenceErr.getProperty('message').toString();
+ return errorInfo;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use2from1/1.0.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use2from1/1.0.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a3ca454282f6d76764299091786dc658992513f8
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/Use2from1/1.0.ets
@@ -0,0 +1,41 @@
+// 1.文件导入
+import { referenceErr, Student, SUBJECT, calTotalScore, calAverageScore } from 'arkts1_2har';
+
+export function test2(): Array {
+ let logs: Array = new Array();
+ let argName = 'B';
+ let argSex = 'M';
+ let argstudentID = 1002;
+ let argAge = 18;
+ let argHeight = 175;
+ let argPhone = 13820002025;
+ let argAverageGrade = 81;
+ let arggradePoint = 3.85;
+ let argIsBoarder = false;
+ // 2.类实例化
+ let student1 = new Student('B', 'M', 1002, 18, 175, 13820002025, 81, 3.85, true);
+ let score = [70, 68, 80, 90, 92, 78];
+ let index = 0;
+ for (let item of SUBJECT) {
+ student1.setSubjectScore(item, score[index]);
+ index++;
+ }
+ // 3.属性读写
+ logs.push(`${student1.name}的年龄为${student1.age}岁。`);
+ let newAge = student1.age = 19;
+ logs.push(`更新${student1.name}的年龄为${newAge}岁。`);
+ // 5.属性方法调用
+ logs.push(`${student1.name}的个人信息: ${student1.introduce()}`);
+ // 4.函数调用
+ let totalScore = calTotalScore(student1);
+ // 6.参数传递
+ let averageScore = calAverageScore(totalScore, SUBJECT.size);
+ logs.push(`总成绩:${totalScore},平均分:${averageScore}`);
+ return logs;
+}
+
+// 7.异常处理
+export function ErrorHandle2(): string {
+ let errorInfo = referenceErr.message;
+ return errorInfo;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseJSFrom2/1.2.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseJSFrom2/1.2.ets
new file mode 100644
index 0000000000000000000000000000000000000000..24f8dd427fddf954ef96c0e89881dc48e9cb1069
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseJSFrom2/1.2.ets
@@ -0,0 +1,41 @@
+export function test3(): Array{
+ let logs: Array = new Array();
+ // 1.文件导入
+ const module = ESObject.load('@normalized:N&entry&com.example.liang123&jshar/src/main/ets/components/JSTest&1.0.0');
+ let student = module.getProperty('Student');
+ const SUBJECT = module.getProperty('SUBJECT');
+ // 2.类实例化
+ let student1 = student.instantiate(ESObject.wrapString('C'), ESObject.wrapNumber(19), ESObject.wrapString('F'), ESObject.wrapBoolean(false));
+ let score = [90, 68, 80, 90, 92, 78];
+ let index = 0;
+ for (let item of SUBJECT) {
+ student1.invokeMethod('setSubjectScore', item, score[index]);
+ index++;
+ }
+ // 3.属性读写
+ let name = student1.getProperty('name').toString();
+ let age = student1.getProperty('age').toNumber();
+ let sex = student1.getProperty('sex').toString();
+ let isBoarder = student1.getProperty('isBoarder').toBoolean();
+ logs.push(`${name}的年龄为${age}岁。`);
+ student1.setProperty('age', 20);
+ let newAge = student1.getProperty('age').toNumber();
+ logs.push(`更新${name}的年龄为${newAge}岁。`);
+ // 5.对象方法调用
+ logs.push(`${name}的个人信息: ${student1.invokeMethod('introduce')}`);
+ // 4.函数调用
+ let calTotalScore = module.getProperty('calTotalScore');
+ let calAverageScore = module.getProperty('calAverageScore');
+ let totalScore = calTotalScore.invoke(student1).toNumber();
+ // 6.参数传递
+ let averageScore = calAverageScore.invoke(ESObject.wrapNumber(totalScore), ESObject.wrapNumber(6));
+ logs.push(`总成绩:${totalScore},平均分:${averageScore}`);
+ return logs;
+}
+
+export function ErrorHandle3(): string {
+ const module = ESObject.load('@normalized:N&entry&com.example.liang123&jshar/src/main/ets/components/JSTest&1.0.0');
+ let referenceErr = module.getProperty('referenceErr');
+ let errorInfo = referenceErr.getProperty('message').toString();
+ return errorInfo;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseTSFrom2/1.2.ets b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseTSFrom2/1.2.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fe80b66697be662d182ec853db42d096a9480f0e
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/ets/pages/UseTSFrom2/1.2.ets
@@ -0,0 +1,43 @@
+export function test4(): Array{
+ let logs: Array = new Array();
+ // 1.文件导入
+ const module = ESObject.load('@normalized:N&entry&com.example.liang123&tshar/src/main/ets/components/TSTest&1.0.0');
+ let student = module.getProperty('Student');
+ const SUBJECT = module.getProperty('SUBJECT');
+ // 2.类实例化
+ let student1 = student.instantiate(ESObject.wrapString('D'), ESObject.wrapNumber(21), ESObject.wrapString('F'), ESObject.wrapBoolean(true));
+ let score = [78, 86, 90, 76, 82, 78];
+ let index = 0;
+ for (let item of SUBJECT) {
+ student1.invokeMethod('setSubjectScore', item, score[index]);
+ index++;
+ }
+ // 3.属性读写
+ let name = student1.getProperty('name').toString();
+ let age = student1.getProperty('age').toNumber();
+ let sex = student1.getProperty('sex').toString();
+ let isBoarder = student1.getProperty('isBoarder').toBoolean();
+ logs.push(`${name}的年龄为${age}岁。`);
+ student1.setProperty('age', 20);
+ let newAge = student1.getProperty('age').toNumber();
+ logs.push(`更新${name}的年龄为${newAge}岁。`);
+ // 5.对象方法调用
+ logs.push(`${name}的个人信息: ${student1.invokeMethod('introduce')}`);
+ // 4.函数调用
+ let calTotalScore = module.getProperty('calTotalScore');
+ let calAverageScore = module.getProperty('calAverageScore');
+ let totalScore = calTotalScore.invoke(student1).toNumber();
+ // 6.参数传递
+ let averageScore = calAverageScore.invoke(ESObject.wrapNumber(totalScore), ESObject.wrapNumber(6));
+ logs.push(`总成绩:${totalScore},平均分:${averageScore}`);
+ return logs;
+}
+
+// 7.异常调用
+export function ErrorHandle4(): string {
+ let errorInfo = '';
+ const module = ESObject.load('@normalized:N&entry&com.example.liang123&tshar/src/main/ets/components/TSTest&1.0.0');
+ let referenceErr = module.getProperty('referenceErr');
+ errorInfo = referenceErr.getProperty('message').toString();
+ return errorInfo;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/module.json5 b/code/ArkTS1.2/interopSample/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5de4c24a4d4bfc087cfb49ed5973abf4b2ec50cc
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/module.json5
@@ -0,0 +1,41 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+
+ ]
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/color.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/float.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/string.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/background.png b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f
Binary files /dev/null and b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/background.png differ
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/foreground.png b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f
Binary files /dev/null and b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/foreground.png differ
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/layered_image.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/startIcon.png b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/backup_config.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/main_pages.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/entry/src/main/resources/dark/element/color.json b/code/ArkTS1.2/interopSample/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/mock/mock-config.json5 b/code/ArkTS1.2/interopSample/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/mock/mock-config.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/Ability.test.ets b/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,35 @@
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/List.test.ets b/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/ohosTest/module.json5 b/code/ArkTS1.2/interopSample/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..7d730baf51eda4ab314f0d267c507a8b8def7e4f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/ohosTest/module.json5
@@ -0,0 +1,13 @@
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/test/List.test.ets b/code/ArkTS1.2/interopSample/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/test/List.test.ets
@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/entry/src/test/LocalUnit.test.ets b/code/ArkTS1.2/interopSample/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2e31f4b0a20c6d4714d98a53e3432b7a4dbd3d5f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,37 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ // it('test01', 0, () => {
+ // // let errorMessage = 'reference error';
+ // // expect(errorMessage).assertEqual(ErrorHandle());
+ // });
+ });
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/hvigor/hvigor-config.json5 b/code/ArkTS1.2/interopSample/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..85e8d4b2175fc4747650344f025e7d145bc3d361
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/hvigor/hvigor-config.json5
@@ -0,0 +1,22 @@
+{
+ "modelVersion": "5.1.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/hvigorfile.ts b/code/ArkTS1.2/interopSample/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/.gitignore b/code/ArkTS1.2/interopSample/jshar/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/BuildProfile.ets b/code/ArkTS1.2/interopSample/jshar/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/BuildProfile.ets
@@ -0,0 +1,17 @@
+/**
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
+ */
+export const HAR_VERSION = '1.0.0';
+export const BUILD_MODE_NAME = 'debug';
+export const DEBUG = true;
+export const TARGET_NAME = 'default';
+
+/**
+ * BuildProfile Class is used only for compatibility purposes.
+ */
+export default class BuildProfile {
+ static readonly HAR_VERSION = HAR_VERSION;
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
+ static readonly DEBUG = DEBUG;
+ static readonly TARGET_NAME = TARGET_NAME;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/Index.ets b/code/ArkTS1.2/interopSample/jshar/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..42bf4161c271e1b14d42a7ab98c982acc9bc3592
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/Index.ets
@@ -0,0 +1 @@
+export { MainPage } from './src/main/ets/components/MainPage';
diff --git a/code/ArkTS1.2/interopSample/jshar/build-profile.json5 b/code/ArkTS1.2/interopSample/jshar/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d236788de4d4adfdad3dc890d242825a083ec983
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/build-profile.json5
@@ -0,0 +1,32 @@
+{
+ "apiType": "stageMode",
+ "arkTSVersion": "1.0",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/consumer-rules.txt b/code/ArkTS1.2/interopSample/jshar/consumer-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/code/ArkTS1.2/interopSample/jshar/hvigorfile.ts b/code/ArkTS1.2/interopSample/jshar/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/obfuscation-rules.txt b/code/ArkTS1.2/interopSample/jshar/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/oh-package.json5 b/code/ArkTS1.2/interopSample/jshar/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f430780d85e2db764af13ce700703383e9d85f4c
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/oh-package.json5
@@ -0,0 +1,9 @@
+{
+ "name": "jshar",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "Index.ets",
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {}
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/JSTest.js b/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/JSTest.js
new file mode 100644
index 0000000000000000000000000000000000000000..7f7a72b37cec45b10513f4f3fa5d138cc787f54f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/JSTest.js
@@ -0,0 +1,49 @@
+export const SUBJECT = new Set(['语文', '数学', '英语', '物理', '化学', '生物']);
+
+export class Student {
+ name = '';
+ age = 18;
+ sex = '';
+ isBoarder = true;
+ transcript = new Map();
+
+ constructor(name, age, sex, isBoarder) {
+ this.name = name;
+ this.age = age;
+ this.sex = sex;
+ this.isBoarder = isBoarder;
+ this.transcript = new Map();
+ }
+
+ introduce() {
+ let boarderStatus = this.isBoarder ? '住宿生' : '走读生';
+ return `姓名${this.name},今年${this.age}岁,是一名${boarderStatus}`;
+ }
+
+ setSubjectScore(subject, score) {
+ if (score < 0 && score > 100) {
+ throw new Error();
+ }
+ this.transcript.set(subject, score);
+ }
+}
+
+export function calTotalScore(student) {
+ let total = 0;
+ for (let score of student.transcript.values()) {
+ total += score;
+ }
+ return total;
+}
+
+export function calAverageScore(totalScore, subjectCount) {
+ if (subjectCount === 0) {
+ throw new Error();
+ }
+ let averageScore = totalScore / subjectCount;
+ let averageScoreStr = String(Math.round(averageScore * 100) / 100);
+ return averageScoreStr;
+}
+
+// 7.异常处理
+export let referenceErr = new ReferenceError('reference error');
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/MainPage.ets b/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a2cd7edbafda054fee35c9bb9cd77ce98bd4e18f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/main/ets/components/MainPage.ets
@@ -0,0 +1,17 @@
+@Component
+export struct MainPage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/src/main/module.json5 b/code/ArkTS1.2/interopSample/jshar/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..bf4cb85901ff19e98018f9536c602e9bb934df69
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/main/module.json5
@@ -0,0 +1,11 @@
+{
+ "module": {
+ "name": "jshar",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ]
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/float.json b/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/string.json b/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/Ability.test.ets b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,35 @@
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/List.test.ets b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/src/ohosTest/module.json5 b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6a8a476d12e5cdfa1f399b9b1fd00071361e6dd9
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/ohosTest/module.json5
@@ -0,0 +1,13 @@
+{
+ "module": {
+ "name": "jshar_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/jshar/src/test/List.test.ets b/code/ArkTS1.2/interopSample/jshar/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/test/List.test.ets
@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/jshar/src/test/LocalUnit.test.ets b/code/ArkTS1.2/interopSample/jshar/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/jshar/src/test/LocalUnit.test.ets
@@ -0,0 +1,33 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/oh-package.json5 b/code/ArkTS1.2/interopSample/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..7f512c9632708e85a7ea34e739c01b0b8f1ad92e
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/oh-package.json5
@@ -0,0 +1,8 @@
+{
+ "modelVersion": "5.1.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/ohosTest.md b/code/ArkTS1.2/interopSample/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..2e3a38801a866f1f890dcbeb499cfbd06bcf884b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/ohosTest.md
@@ -0,0 +1,10 @@
+# interop配套测试用例
+
+## 用例表
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|-----------------------------------|-------------------------------------|----------------------|------------------------------------|------|------|
+| ArkTS1.2中使用ArkTS1.0 | 1. 需在真机测试
2. 构建并安装测试hap | 点击【Use 1.0 from 1.2】按钮 | 打印以下日志:
A的年龄为18岁。
更新A的年龄为20岁
A的个人信息: 姓名A,学号1001,今年20岁,身高175,电话13820002025, 上次平均成绩是81.75,gradePoint: 3.85, 是一名走读生
总成绩:483,平均分:80.5
reference error| 否 | Pass |
+| ArkTS1.0中使用ArkTS1.2 | 1. 需在真机测试
2. 构建并安装测试hap | 点击【Use 1.2 from 1.0】按钮 | 打印以下日志:
B的年龄为18岁。
更新B的年龄为19岁。
B的个人信息: 姓名B,学号1002,今年19岁,身高175,电话13820002025, 上次平均成绩是81,gradePoint: 3.85, 是一名住宿生
总成绩:478,平均分:79.67
reference error | 否 | Pass |
+| ArkTS1.2中使用JS | 1. 需在真机测试
2. 构建并安装测试hap | 点击【Use JS from 1.2】按钮 | 打印以下日志:
C的年龄为19岁。
更新C的年龄为20岁。
C的个人信息: 姓名C,今年20岁,是一名走读生
总成绩:498,平均分:83
reference error | 否 | Pass |
+| ArkTS1.2中使用TS | 1. 需在真机测试
2. 构建并安装测试hap | 点击【Use TS from 1.2】按钮 | 打印以下日志:
D的年龄为21岁。
更新D的年龄为20岁。
D的个人信息: 姓名D,今年20岁,是一名住宿生
总成绩:490,平均分:81.67
reference error | 否 | Pass |
diff --git a/code/ArkTS1.2/interopSample/tshar/.gitignore b/code/ArkTS1.2/interopSample/tshar/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/BuildProfile.ets b/code/ArkTS1.2/interopSample/tshar/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3a501e5ddee8ea6d28961648fc7dd314a5304bd4
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/BuildProfile.ets
@@ -0,0 +1,17 @@
+/**
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
+ */
+export const HAR_VERSION = '1.0.0';
+export const BUILD_MODE_NAME = 'debug';
+export const DEBUG = true;
+export const TARGET_NAME = 'default';
+
+/**
+ * BuildProfile Class is used only for compatibility purposes.
+ */
+export default class BuildProfile {
+ static readonly HAR_VERSION = HAR_VERSION;
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
+ static readonly DEBUG = DEBUG;
+ static readonly TARGET_NAME = TARGET_NAME;
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/Index.ets b/code/ArkTS1.2/interopSample/tshar/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..42bf4161c271e1b14d42a7ab98c982acc9bc3592
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/Index.ets
@@ -0,0 +1 @@
+export { MainPage } from './src/main/ets/components/MainPage';
diff --git a/code/ArkTS1.2/interopSample/tshar/build-profile.json5 b/code/ArkTS1.2/interopSample/tshar/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d236788de4d4adfdad3dc890d242825a083ec983
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/build-profile.json5
@@ -0,0 +1,32 @@
+{
+ "apiType": "stageMode",
+ "arkTSVersion": "1.0",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/consumer-rules.txt b/code/ArkTS1.2/interopSample/tshar/consumer-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/code/ArkTS1.2/interopSample/tshar/hvigorfile.ts b/code/ArkTS1.2/interopSample/tshar/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/obfuscation-rules.txt b/code/ArkTS1.2/interopSample/tshar/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/oh-package.json5 b/code/ArkTS1.2/interopSample/tshar/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..558ae13b7845034cba918b2318855e1fa6cf6a6e
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/oh-package.json5
@@ -0,0 +1,9 @@
+{
+ "name": "tshar",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "Index.ets",
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {}
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/MainPage.ets b/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a2cd7edbafda054fee35c9bb9cd77ce98bd4e18f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/MainPage.ets
@@ -0,0 +1,17 @@
+@Component
+export struct MainPage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .onClick(() => {
+ this.message = 'Welcome';
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/TSTest.ts b/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/TSTest.ts
new file mode 100644
index 0000000000000000000000000000000000000000..680887e881b482c6808aff3c31279b5adb168b63
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/main/ets/components/TSTest.ts
@@ -0,0 +1,48 @@
+export const SUBJECT = new Set(['语文', '数学', '英语', '物理', '化学', '生物']);
+
+export class Student {
+ public name: string = '';
+ public age: number = 18;
+ public sex: string = '';
+ public isBoarder: boolean = true;
+ public transcript: Map = new Map();
+
+ constructor(name: string, age: number, sex: string, isBoarder: boolean) {
+ this.name = name;
+ this.age = age;
+ this.sex = sex;
+ this.isBoarder = isBoarder;
+ }
+
+ introduce(): string {
+ let boarderStatus: string = this.isBoarder ? '住宿生' : '走读生';
+ return `姓名${this.name},今年${this.age}岁,是一名${boarderStatus}`;
+ }
+
+ setSubjectScore(subject: string, score: number): void {
+ if (score < 0 && score > 100) {
+ throw new Error();
+ }
+ this.transcript.set(subject, score);
+ }
+}
+
+export function calTotalScore(student: Student) {
+ let total: number = 0;
+ for (let score of student.transcript.values()) {
+ total += score;
+ }
+ return total;
+}
+
+export function calAverageScore(totalScore: number, subjectCount: number) {
+ if (subjectCount === 0) {
+ throw new Error();
+ }
+ let averageScore: number = totalScore / subjectCount;
+ let averageScoreStr: string = String(Math.round(averageScore * 100) / 100);
+ return averageScoreStr;
+}
+
+// 7.异常处理
+export let referenceErr: ReferenceError = new ReferenceError('reference error');
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/src/main/module.json5 b/code/ArkTS1.2/interopSample/tshar/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1e142ce468c5e21900d4f37a5fe132d70100fa82
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/main/module.json5
@@ -0,0 +1,11 @@
+{
+ "module": {
+ "name": "tshar",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ]
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/float.json b/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/float.json
@@ -0,0 +1,8 @@
+{
+ "float": [
+ {
+ "name": "page_text_font_size",
+ "value": "50fp"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/string.json b/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/Ability.test.ets b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..85c78f67579d6e31b5f5aeea463e216b9b141048
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,35 @@
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/List.test.ets b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..794c7dc4ed66bd98fa3865e07922906e2fcef545
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/src/ohosTest/module.json5 b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6a8a476d12e5cdfa1f399b9b1fd00071361e6dd9
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/ohosTest/module.json5
@@ -0,0 +1,13 @@
+{
+ "module": {
+ "name": "jshar_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/code/ArkTS1.2/interopSample/tshar/src/test/List.test.ets b/code/ArkTS1.2/interopSample/tshar/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bb5b5c3731e283dd507c847560ee59bde477bbc7
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/test/List.test.ets
@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/ArkTS1.2/interopSample/tshar/src/test/LocalUnit.test.ets b/code/ArkTS1.2/interopSample/tshar/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..165fc1615ee8618b4cb6a622f144a9a707eee99f
--- /dev/null
+++ b/code/ArkTS1.2/interopSample/tshar/src/test/LocalUnit.test.ets
@@ -0,0 +1,33 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file