Skip to content

Commit

Permalink
Features/rust harmony (#468)
Browse files Browse the repository at this point in the history
* harmony

* test

* test

* upgrade depenencies for solve nightly build error

* remove unused code

* README.md

* move to stretch

* refacor config

* harmony stretch

* force update git
  • Loading branch information
biezhihua authored Dec 14, 2023
1 parent e8bfb1e commit 5caad47
Show file tree
Hide file tree
Showing 60 changed files with 1,263 additions and 86 deletions.
10 changes: 5 additions & 5 deletions GaiaXHarmony/GaiaX/src/main/ets/gaiax/GXViewBuilder.ets
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ function createViewForContext(gxTemplateContext?: GXTemplateContext) {
if (gxTemplateContext == null) {
Text("GXView is null")
} else {
createViewForNode(GXViewTreeCreator.createRootNode(gxTemplateContext))
createViewTree(GXViewTreeCreator.createNodeTree(gxTemplateContext))
}
}

@Builder
function createViewForNode(gxNode?: GXNode) {
function createViewTree(gxNode?: GXNode) {
if (gxNode == null) {
Text("GXNode is null")
} else {
createViewByNodeTree(gxNode)
createViewTreeByNodeTree(gxNode)
}
}

@Builder
function createViewByNodeTree(gxNode: GXNode) {
function createViewTreeByNodeTree(gxNode: GXNode) {
// View or Template
if (gxNode.gxTemplateNode.isViewType() || gxNode.gxTemplateNode.isGaiaTemplate()) {
createViewOrTemplate(gxNode)
Expand Down Expand Up @@ -87,7 +87,7 @@ function createViewOrTemplate(gxNode: GXNode) {
Column() {
ForEach(gxNode.gxChildren, (gxChildNode: GXNode) => {
// 如果有子节点,那么递归创建子View
createViewByNodeTree(gxChildNode);
createViewTreeByNodeTree(gxChildNode);
}, (item: GXNode, index) => index + item.gxId);
}
.key(gxNode.gxId)
Expand Down
3 changes: 2 additions & 1 deletion GaiaXHarmony/GaiaX/src/main/ets/gaiax/GXViewTreeCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import GXTemplateItem from './GXTemplateItem';
import GXCssConvertStyle from './GXCssConvertStyle';

export class GXViewTreeCreator {
createRootNode(gxTemplateContext: GXTemplateContext): GXNode {

createNodeTree(gxTemplateContext: GXTemplateContext): GXNode {

const gxTemplateData = gxTemplateContext.gxTemplateData.templateData as GXJSONObject;

Expand Down

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions GaiaXStretch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ circle-ci = { repository = "vislyhq/stretch", branch = "master" }
maintenance = { status = "experimental" }

[dependencies]
arrayvec = { version = "0.5.1", default-features = false }
hash32 = "0.1.1"
arrayvec = { version = "0.7.4", default-features = false }
hash32 = "0.3.1"
hash32-derive = "0.1.0"
heapless = "0.5.1"
heapless = "0.8.0"
num-traits = { version = "0.2.10", default-features = false }
typenum = "1.11.2"

[dependencies.hashbrown]
version = "0.6.3"
version = "0.14.3"
optional = true

[dependencies.serde]
Expand All @@ -40,7 +40,7 @@ serde_camel_case = ["serde"]
serde_kebab_case = ["serde"]

[dev-dependencies]
criterion = "0.3.0"
criterion = "0.5.1"

[profile.release]
lto = true
Expand Down
1 change: 1 addition & 0 deletions GaiaXStretch/bindings/harmony/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
18 changes: 18 additions & 0 deletions GaiaXStretch/bindings/harmony/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "harmony-stretch"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "stretch"
crate-type = ["cdylib"]

[dependencies]
# https://docs.rs/libc/latest/libc/
libc = "0.2.151"
stretch = { path = "../.." }

[workspace]
members = []
1 change: 1 addition & 0 deletions GaiaXStretch/bindings/harmony/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cp config ~/.cargo/config
11 changes: 11 additions & 0 deletions GaiaXStretch/bindings/harmony/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

cp ./config ~/.cargo/config

cargo +nightly build -Z build-std --target x86_64-unknown-linux-ohos
cargo +nightly build -Z build-std --target armv7-unknown-linux-ohos
cargo +nightly build -Z build-std --target aarch64-unknown-linux-ohos

cargo +nightly build -Z build-std --target x86_64-unknown-linux-ohos --release
cargo +nightly build -Z build-std --target armv7-unknown-linux-ohos --release
cargo +nightly build -Z build-std --target aarch64-unknown-linux-ohos --release
23 changes: 23 additions & 0 deletions GaiaXStretch/bindings/harmony/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[target.aarch64-linux-android]
ar = "/Users/biezhihua/Software/RUST_NDK/arm64/bin/aarch64-linux-android-ar"
linker = "/Users/biezhihua/Software/RUST_NDK/arm64/bin/aarch64-linux-android-clang"

[target.armv7-linux-androideabi]
ar = "/Users/biezhihua/Software/RUST_NDK/arm/bin/arm-linux-androideabi-ar"
linker = "/Users/biezhihua/Software/RUST_NDK/arm/bin/arm-linux-androideabi-clang"

[target.i686-linux-android]
ar = "/Users/biezhihua/Software/RUST_NDK/x86/bin/i686-linux-android-ar"
linker = "/Users/biezhihua/Software/RUST_NDK/x86/bin/i686-linux-android-clang"

[target.aarch64-unknown-linux-ohos]
linker = "/Users/biezhihua/WorkSpace/YKGAIAX/GaiaX/GaiaXStretch/bindings/harmony/cross-compile-config/aarch64-unknown-linux-ohos-clang.sh"
ar = "/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/llvm-ar"

[target.armv7-unknown-linux-ohos]
linker = "/Users/biezhihua/WorkSpace/YKGAIAX/GaiaX/GaiaXStretch/bindings/harmony/cross-compile-config/armv7-unknown-linux-ohos-clang.sh"
ar = "/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/llvm-ar"

[target.x86_64-unknown-linux-ohos]
linker = "/Users/biezhihua/WorkSpace/YKGAIAX/GaiaX/GaiaXStretch/bindings/harmony/cross-compile-config/x86_64-unknown-linux-ohos-clang.sh"
ar = "/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/llvm-ar"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang++ \
-target aarch64-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang \
-target aarch64-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang++ \
-target arm-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
-march=armv7-a \
-mfloat-abi=softfp \
-mtune=generic-armv7-a \
-mthumb \
"$@"

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang \
-target arm-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
-march=armv7-a \
-mfloat-abi=softfp \
-mtune=generic-armv7-a \
-mthumb \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang++ \
-target x86_64-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /Users/biezhihua/Software/OpenHarmony/Sdk/10/native/llvm/bin/clang \
-target x86_64-linux-ohos \
--sysroot=/Users/biezhihua/Software/OpenHarmony/Sdk/10/native/sysroot \
-D__MUSL__ \
"$@"
3 changes: 3 additions & 0 deletions GaiaXStretch/bindings/harmony/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
max_width = 120
use_field_init_shorthand = true
use_small_heuristics = "Max"
Loading

0 comments on commit 5caad47

Please sign in to comment.