commit 17f8f499689856df80c74f5b622d7196b0f807ae Author: clz Date: Fri Sep 6 21:57:52 2024 +0800 init project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c60a923 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer +**/cj_res +**/*.cj.macrocall +**/ability_mainability_entry.cj +**/module_**_entry.cj \ No newline at end of file diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000..2a01de0 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.himi", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000..7829591 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "himi" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000..a39445d Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000..1e69556 --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,41 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/code-linter.json5 b/code-linter.json5 new file mode 100644 index 0000000..77b31b5 --- /dev/null +++ b/code-linter.json5 @@ -0,0 +1,20 @@ +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + } +} \ No newline at end of file diff --git a/entry/.gitignore b/entry/.gitignore new file mode 100644 index 0000000..e2713a2 --- /dev/null +++ b/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 new file mode 100644 index 0000000..305d609 --- /dev/null +++ b/entry/build-profile.json5 @@ -0,0 +1,15 @@ +{ + "apiType": "stageMode", + "buildOption": { + "cangjieOptions": { + "path": "./src/main/cangjie/cjpm.toml" + } + }, + "buildOptionSet": [ + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/entry/hvigorfile.ts b/entry/hvigorfile.ts new file mode 100644 index 0000000..2fa3c48 --- /dev/null +++ b/entry/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/cangjie-build-support'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 new file mode 100644 index 0000000..248c3b7 --- /dev/null +++ b/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/entry/src/main/cangjie/cjpm.lock b/entry/src/main/cangjie/cjpm.lock new file mode 100644 index 0000000..c42311c --- /dev/null +++ b/entry/src/main/cangjie/cjpm.lock @@ -0,0 +1,3 @@ +version = 0 + +[requires] diff --git a/entry/src/main/cangjie/cjpm.toml b/entry/src/main/cangjie/cjpm.toml new file mode 100644 index 0000000..870bc08 --- /dev/null +++ b/entry/src/main/cangjie/cjpm.toml @@ -0,0 +1,37 @@ +[target.aarch64-linux-ohos] + compile-option = "-B \"${DEVECO_CANGJIE_HOME}/compiler/third_party/llvm/bin\" -B \"${DEVECO_CANGJIE_HOME}/musl/usr/lib/aarch64-linux-ohos\" -L \"${DEVECO_CANGJIE_HOME}/musl/usr/lib/aarch64-linux-ohos\" -L \"${DEVECO_CANGJIE_HOME}/build/linux_ohos_aarch64_llvm/openssl\" --sysroot \"${DEVECO_CANGJIE_HOME}/musl\"" + +[target.x86_64-linux-ohos] + compile-option = "-B \"${DEVECO_CANGJIE_HOME}/compiler/third_party/llvm/bin\" -B \"${DEVECO_CANGJIE_HOME}/musl/usr/lib/x86_64-linux-ohos\" -L \"${DEVECO_CANGJIE_HOME}/musl/usr/lib/x86_64-linux-ohos\" -L \"${DEVECO_CANGJIE_HOME}/build/linux_ohos_x86_64_llvm/openssl\" --sysroot \"${DEVECO_CANGJIE_HOME}/musl\"" + +[dependencies] + cj_res_entry = {path = "./cj_res", version = "1.0.0"} + +[package] + cjc-version = "0.48.2" + compile-option = "" + description = "CangjieUI Application" + link-option = "" + name = "ohos_app_cangjie_entry" + output-type = "dynamic" + src-dir = "src" + target-dir = "" + version = "1.0.0" + package-configuration = {} + scripts = {} + +[target.aarch64-linux-ohos.bin-dependencies] + path-option = ["${AARCH64_LIBS}", "${AARCH64_MACRO_LIBS}", "${AARCH64_KIT_LIBS}"] + package-option = {} + +[target.x86_64-linux-ohos.bin-dependencies] + path-option = ["${X86_64_OHOS_LIBS}", "${X86_64_OHOS_MACRO_LIBS}", "${X86_64_OHOS_KIT_LIBS}"] + +[target.x86_64-unknown-windows-gnu.bin-dependencies] + path-option = ["${X86_64_LIBS}", "${X86_64_MACRO_LIBS}"] + package-option = {} + +[profile] + build = {incremental = true, lto = ""} + customized-option = {debug = "-g -Woff all", release = "--fast-math -O2 -s -Woff all"} + test = {} diff --git a/entry/src/main/cangjie/src/ability_stage.cj b/entry/src/main/cangjie/src/ability_stage.cj new file mode 100644 index 0000000..e784f53 --- /dev/null +++ b/entry/src/main/cangjie/src/ability_stage.cj @@ -0,0 +1,12 @@ +package ohos_app_cangjie_entry + +internal import ohos.ability.Ability +internal import ohos.ability.Want +internal import ohos.ability.LaunchParam +internal import ohos.window.WindowStage + +class MyAbilityStage <: AbilityStage { + public override func onCreate(): Unit { + AppLog.info("MyAbilityStage onCreated.") + } +} diff --git a/entry/src/main/cangjie/src/index.cj b/entry/src/main/cangjie/src/index.cj new file mode 100644 index 0000000..d55338a --- /dev/null +++ b/entry/src/main/cangjie/src/index.cj @@ -0,0 +1,34 @@ +package ohos_app_cangjie_entry + +internal import ohos.base.LengthProp +internal import ohos.component.Column +internal import ohos.component.Row +internal import ohos.component.Button +internal import ohos.component.Text +internal import ohos.component.CustomView +internal import ohos.component.CJEntry +internal import ohos.component.loadNativeView +internal import ohos.state_manage.SubscriberManager +internal import ohos.state_manage.ObservedProperty +internal import ohos.state_manage.LocalStorage +import ohos.state_macro_manage.Entry +import ohos.state_macro_manage.Component +import ohos.state_macro_manage.State +import ohos.state_macro_manage.r + +@Entry +@Component +class MyView { + @State + var message: String = "Hello Cangjie" + + func build() { + Row { + Column { + Button(message).onClick { + evt => AppLog.info("Hello Cangjie") + }.fontSize(40).height(80) + }.width(100.percent) + }.height(100.percent) + } +} diff --git a/entry/src/main/cangjie/src/main_ability.cj b/entry/src/main/cangjie/src/main_ability.cj new file mode 100644 index 0000000..e4ca831 --- /dev/null +++ b/entry/src/main/cangjie/src/main_ability.cj @@ -0,0 +1,26 @@ +package ohos_app_cangjie_entry + +internal import ohos.base.AppLog +internal import ohos.ability.AbilityStage +internal import ohos.ability.LaunchReason +internal import cj_res_entry.app + +class MainAbility <: Ability { + public init() { + super() + registerSelf() + } + + public override func onCreate(want: Want, launchParam: LaunchParam): Unit { + AppLog.info("MainAbility OnCreated.${want.abilityName}") + match (launchParam.launchReason) { + case LaunchReason.START_ABILITY => AppLog.info("START_ABILITY") + case _ => () + } + } + + public override func onWindowStageCreate(windowStage: WindowStage): Unit { + AppLog.info("MainAbility onWindowStageCreate.") + windowStage.loadContent("MyView") + } +} diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000..4b71f19 --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "srcEntry": "ohos_app_cangjie_entry.MyAbilityStage", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "ohos_app_cangjie_entry.MainAbility", + "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" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000..3c71296 --- /dev/null +++ b/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/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000..f945955 --- /dev/null +++ b/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/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000..f939c9f Binary files /dev/null and b/entry/src/main/resources/base/media/background.png differ diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000..4483dda Binary files /dev/null and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/entry/src/main/resources/base/media/layered_image.json b/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000..fb49920 --- /dev/null +++ b/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/entry/src/main/resources/base/media/startIcon.png b/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000..205ad8b Binary files /dev/null and b/entry/src/main/resources/base/media/startIcon.png differ diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,2 @@ +{ +} diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..f945955 --- /dev/null +++ b/entry/src/main/resources/en_US/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/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..597ecf9 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/hvigor/cangjie-build-support-1.0.5.tgz b/hvigor/cangjie-build-support-1.0.5.tgz new file mode 100644 index 0000000..478116d Binary files /dev/null and b/hvigor/cangjie-build-support-1.0.5.tgz differ diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100644 index 0000000..3d8a34b --- /dev/null +++ b/hvigor/hvigor-config.json5 @@ -0,0 +1,23 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + "@ohos/cangjie-build-support": "file:cangjie-build-support-1.0.5.tgz" + }, + "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*/ + } +} \ No newline at end of file diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100644 index 0000000..cf8233b --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/cangjie-build-support'; + +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/oh-package-lock.json5 b/oh-package-lock.json5 new file mode 100644 index 0000000..205c6cf --- /dev/null +++ b/oh-package-lock.json5 @@ -0,0 +1,27 @@ +{ + "meta": { + "stableOrder": true + }, + "lockfileVersion": 3, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0", + "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" + }, + "packages": { + "@ohos/hamock@1.0.0": { + "name": "@ohos/hamock", + "version": "1.0.0", + "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==", + "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hamock/-/hamock-1.0.0.har", + "registryType": "ohpm" + }, + "@ohos/hypium@1.0.19": { + "name": "@ohos/hypium", + "version": "1.0.19", + "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", + "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", + "registryType": "ohpm" + } + } +} \ No newline at end of file diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100644 index 0000000..bb12751 --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "modelVersion": "5.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.19", + "@ohos/hamock": "1.0.0" + } +}