diff --git a/CHANGELOG.md b/CHANGELOG.md index 6faebb6..43a7e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - **harmonyos-build-deploy**: Fixed unquoted variable in install.sh script - **harmonyos-build-deploy**: Deploy Only workflow now checks for empty output directory and collects signed artifacts from module build directories - **harmonyos-build-deploy**: Simplified build output path from `outputs/default/bundles/signed/` to `outputs/` +- **harmonyos-build-deploy**: Device push now filters by `.hap`/`.hsp` extension instead of sending entire directory ### Removed diff --git a/harmonyos-build-deploy/SKILL.md b/harmonyos-build-deploy/SKILL.md index 689e41a..7591d4f 100644 --- a/harmonyos-build-deploy/SKILL.md +++ b/harmonyos-build-deploy/SKILL.md @@ -39,8 +39,11 @@ hvigorw assembleApp --mode project -p product=default -p buildMode=release --no- # Use a random directory name to avoid conflicts with previous installations INSTALL_DIR="/data/local/tmp/install_$(date +%s)" hdc -t shell "mkdir -p $INSTALL_DIR" -hdc -t file send outputs $INSTALL_DIR -hdc -t shell "bm install -p $INSTALL_DIR/outputs" +# Only push .hap and .hsp files +for f in outputs/*.hap outputs/*.hsp; do + [ -f "$f" ] && hdc -t file send "$f" $INSTALL_DIR/ +done +hdc -t shell "bm install -p $INSTALL_DIR" hdc -t shell "rm -rf $INSTALL_DIR" ``` @@ -219,11 +222,13 @@ hdc -t shell "whoami" # Test connection INSTALL_DIR="/data/local/tmp/install_$(date +%s)" hdc -t shell "mkdir -p $INSTALL_DIR" -# Push signed bundles -hdc -t file send outputs $INSTALL_DIR +# Only push .hap and .hsp files +for f in outputs/*.hap outputs/*.hsp; do + [ -f "$f" ] && hdc -t file send "$f" $INSTALL_DIR/ +done # Install all HAP/HSP in directory -hdc -t shell "bm install -p $INSTALL_DIR/outputs" +hdc -t shell "bm install -p $INSTALL_DIR" # Clean up temp directory hdc -t shell "rm -rf $INSTALL_DIR" diff --git a/harmonyos-build-deploy/references/device-installation.md b/harmonyos-build-deploy/references/device-installation.md index 46aba64..cb58696 100644 --- a/harmonyos-build-deploy/references/device-installation.md +++ b/harmonyos-build-deploy/references/device-installation.md @@ -68,12 +68,13 @@ echo "Remote: $REMOTE_PATH" # === Create remote directory === hdc -t "$DEVICE_ID" shell "mkdir -p $REMOTE_PATH" -# === Push signed files === -hdc -t "$DEVICE_ID" file send "$SIGNED_PATH" "$REMOTE_PATH" +# === Push only .hap and .hsp files === +for f in "$SIGNED_PATH"/*.hap "$SIGNED_PATH"/*.hsp; do + [ -f "$f" ] && hdc -t "$DEVICE_ID" file send "$f" "$REMOTE_PATH/" +done # === Install === -BASENAME="$(basename "$SIGNED_PATH")" -hdc -t "$DEVICE_ID" shell "bm install -p $REMOTE_PATH/$BASENAME" +hdc -t "$DEVICE_ID" shell "bm install -p $REMOTE_PATH" # === Clean up === hdc -t "$DEVICE_ID" shell "rm -rf $REMOTE_PATH"