Commit 08424c2f authored by dong's avatar dong

改为自渲染

parent e8982ddb
...@@ -25,8 +25,8 @@ kotlin.debug.generateLocalVariables=true ...@@ -25,8 +25,8 @@ kotlin.debug.generateLocalVariables=true
ohosSkikoVersion=0.9.22.2-0.4.0-09 ohosSkikoVersion=0.9.22.2-0.4.0-09
# 统一渲染(fusion-renderer);自渲染用 skia # 统一渲染(fusion-renderer);自渲染用 skia
rendererBackend=fusion-renderer #rendererBackend=fusion-renderer
#rendererBackend=skia rendererBackend=skia
#Enable all of the following switches to improve debug incremental compilation performance. #Enable all of the following switches to improve debug incremental compilation performance.
org.gradle.caching=true org.gradle.caching=true
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
"material": { "material": {
"certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.cer", "certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.cer",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001A99FB765C15C3BE861F29354D47721EC3CC8119E06D14B347A1698FA5824467C934C39C26F6AE", "keyPassword": "0000001BAB3482EFCC9B6648127AF59A98EE6DDD6901143B1740D1A022A7DD9B44EDA48C97680F24279346",
"profile": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.p7b", "profile": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.p7b",
"signAlg": "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.p12", "storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_7ofaDImBKbWsZVhjGAeOTyhToW4KCk7GMqQbmMIzdE4=.p12",
"storePassword": "0000001A68AAC83AC7EB9C5CB5CB64DF590495E8CE0AA6FAC7A658175D488C9B79EF97E0DDE3B5526219" "storePassword": "0000001B78B605F39985D45A07B0A9EDF20FF34406FE6397B7174F6A410697A661A6D3E402FE45D2F2DDC3"
} }
} }
] ]
......
#!/bin/bash
#
# Install a signed HAP onto connected HarmonyOS devices via hdc.
#
# Usage:
# ./installOhosHap-Mac.sh
# ./installOhosHap-Mac.sh -f /path/to/app.hap
# ./installOhosHap-Mac.sh -f app.hap -t 127.0.0.1:5555 -u
#
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEFAULT_HAP="/Users/dongsq/Library/Containers/com.tencent.xinWeChat/Data/Documents/xwechat_files/wxid_r4h5wm6tbw9q22_8d0b/msg/file/2026-07/entry-default-signed(1).hap"
DEFAULT_ABILITY="EntryAbility"
REMOTE_DIR="/data/local/tmp/hap_install"
HAP_FILE="$DEFAULT_HAP"
TARGET_ID=""
BUNDLE_NAME=""
ABILITY_NAME="$DEFAULT_ABILITY"
FORCE_UNINSTALL=0
NO_START=0
usage() {
cat <<EOF
Usage: $0 [options]
Install a signed HAP to connected HarmonyOS device(s).
Options:
-f PATH HAP file path (default: WeChat shared entry-default-signed(1).hap)
-t ID Device id from 'hdc list targets' (default: all connected devices)
-b NAME Bundle name (default: read from HAP pack.info, else app.json5)
-a NAME Ability name for aa start (default: $DEFAULT_ABILITY)
-u Uninstall existing app before install
-n Install only, do not launch app
-h Help
Examples:
$0
$0 -f ./harmonyApp/entry/build/default/outputs/default/entry-default-signed.hap
$0 -f ~/Downloads/app.hap -t 127.0.0.1:5555 -u
EOF
exit 0
}
while [[ $# -gt 0 ]]; do
case "$1" in
-f) HAP_FILE="$2"; shift 2 ;;
-t) TARGET_ID="$2"; shift 2 ;;
-b) BUNDLE_NAME="$2"; shift 2 ;;
-a) ABILITY_NAME="$2"; shift 2 ;;
-u) FORCE_UNINSTALL=1; shift ;;
-n) NO_START=1; shift ;;
-h) usage ;;
*) echo "Unknown option: $1"; usage ;;
esac
done
DEVECO_PATH="${DEVECO_PATH:-/Applications/DevEco-Studio.app}"
DEVECO_HOME="${DEVECO_HOME:-$DEVECO_PATH/Contents}"
HDC_BIN="$DEVECO_HOME/sdk/default/openharmony/toolchains/hdc"
if [[ ! -x "$HDC_BIN" ]]; then
echo "Error: hdc not found at $HDC_BIN"
exit 1
fi
if [[ ! -f "$HAP_FILE" ]]; then
echo "Error: HAP not found: $HAP_FILE"
exit 1
fi
HAP_FILE="$(cd "$(dirname "$HAP_FILE")" && pwd)/$(basename "$HAP_FILE")"
HAP_BASENAME="$(basename "$HAP_FILE")"
read_bundle_from_hap() {
local pack
pack="$(unzip -p "$HAP_FILE" pack.info 2>/dev/null || true)"
if [[ -n "$pack" ]]; then
echo "$pack" | sed -n 's/.*"bundleName"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1
fi
}
if [[ -z "$BUNDLE_NAME" ]]; then
BUNDLE_NAME="$(read_bundle_from_hap || true)"
fi
if [[ -z "$BUNDLE_NAME" && -f "$SCRIPT_DIR/harmonyApp/AppScope/app.json5" ]]; then
BUNDLE_NAME="$(grep '"bundleName"' "$SCRIPT_DIR/harmonyApp/AppScope/app.json5" \
| sed 's/.*"bundleName"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/' | head -1 | tr -d '\r')"
fi
if [[ -z "$BUNDLE_NAME" ]]; then
echo "Error: could not determine bundle name; pass -b com.example.app"
exit 1
fi
mapfile -t DEVICE_IDS < <("$HDC_BIN" list targets 2>/dev/null \
| awk 'NF>=1 && $1 !~ /^\[Empty\]$/{print $1}' \
| tr -d '\r')
if [[ -n "$TARGET_ID" ]]; then
DEVICE_IDS=("$TARGET_ID")
fi
if [[ ${#DEVICE_IDS[@]} -eq 0 ]]; then
echo "Error: no device connected. Connect phone and run: $HDC_BIN list targets"
exit 1
fi
install_on_device() {
local tid="$1"
echo "============================================================"
echo "Device: $tid"
echo "HAP: $HAP_FILE"
echo "Bundle: $BUNDLE_NAME"
if [[ "$FORCE_UNINSTALL" -eq 1 ]]; then
echo "Uninstalling $BUNDLE_NAME ..."
"$HDC_BIN" -t "$tid" shell bm uninstall -n "$BUNDLE_NAME" >/dev/null 2>&1 || true
fi
echo "Pushing HAP ..."
"$HDC_BIN" -t "$tid" shell mkdir -p "$REMOTE_DIR"
"$HDC_BIN" -t "$tid" file send "$HAP_FILE" "$REMOTE_DIR/$HAP_BASENAME"
echo "Installing ..."
local output
output="$("$HDC_BIN" -t "$tid" shell bm install -p "$REMOTE_DIR/$HAP_BASENAME" 2>&1 || true)"
echo "$output"
if echo "$output" | grep -qiE 'fail|error'; then
echo "Install failed, retrying after uninstall ..."
"$HDC_BIN" -t "$tid" shell bm uninstall -n "$BUNDLE_NAME" >/dev/null 2>&1 || true
sleep 2
output="$("$HDC_BIN" -t "$tid" shell bm install -p "$REMOTE_DIR/$HAP_BASENAME" 2>&1 || true)"
echo "$output"
if echo "$output" | grep -qiE 'fail|error'; then
echo "Error: install failed on $tid"
return 1
fi
fi
if [[ "$NO_START" -eq 0 ]]; then
echo "Launching $ABILITY_NAME ..."
"$HDC_BIN" -t "$tid" shell aa start -a "$ABILITY_NAME" -b "$BUNDLE_NAME"
fi
echo "Done on $tid"
}
FAIL=0
for tid in "${DEVICE_IDS[@]}"; do
if ! install_on_device "$tid"; then
FAIL=1
fi
done
exit "$FAIL"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment