diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ffae4..6faebb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - **harmonyos-build-deploy**: Extracted module discovery, build outputs, and unwanted modules into `references/module-discovery.md` (~138 lines moved out of SKILL.md) - **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/` ### Removed diff --git a/harmonyos-build-deploy/SKILL.md b/harmonyos-build-deploy/SKILL.md index cee13a3..689e41a 100644 --- a/harmonyos-build-deploy/SKILL.md +++ b/harmonyos-build-deploy/SKILL.md @@ -39,12 +39,12 @@ 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/default/bundles/signed $INSTALL_DIR -hdc -t shell "bm install -p $INSTALL_DIR/signed" +hdc -t file send outputs $INSTALL_DIR +hdc -t shell "bm install -p $INSTALL_DIR/outputs" hdc -t shell "rm -rf $INSTALL_DIR" ``` -**Note:** Build output path is `outputs/default/bundles/signed/`. +**Note:** Build output path is `outputs/`. ## Workflows @@ -66,7 +66,7 @@ Delegate to subagent with the following steps: Delegate to subagent with the following steps: 1. Read `AppScope/app.json5` to get bundleName -2. Check `outputs/default/bundles/signed/` for existing build outputs. If empty or missing, collect signed HAP/HSP from each module's build directory (`{srcPath}/build/default/outputs/default/*-signed.*`) into `outputs/default/bundles/signed/`. See [module-discovery.md](references/module-discovery.md) for details. +2. Check `outputs/` for existing build outputs. If empty or missing, collect signed HAP/HSP from each module's build directory (`{srcPath}/build/default/outputs/default/*-signed.*`) into `outputs/`. See [module-discovery.md](references/module-discovery.md) for details. 3. Deploy to device (see [Push and Install](#push-and-install) below) 4. Launch: `hdc -t shell "aa start -a EntryAbility -b "` 5. Report success/failure with details @@ -170,10 +170,10 @@ hvigorw --sync -p product=default -p buildMode=release --no-daemon ## Build Outputs -Build output path: `outputs/default/bundles/signed/` +Build output path: `outputs/` ``` -outputs/default/bundles/signed/ +outputs/ ├── entry-default-signed.hap └── *.hsp ``` @@ -220,10 +220,10 @@ INSTALL_DIR="/data/local/tmp/install_$(date +%s)" hdc -t shell "mkdir -p $INSTALL_DIR" # Push signed bundles -hdc -t file send outputs/default/bundles/signed $INSTALL_DIR +hdc -t file send outputs $INSTALL_DIR # Install all HAP/HSP in directory -hdc -t shell "bm install -p $INSTALL_DIR/signed" +hdc -t shell "bm install -p $INSTALL_DIR/outputs" # 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 374488a..46aba64 100644 --- a/harmonyos-build-deploy/references/device-installation.md +++ b/harmonyos-build-deploy/references/device-installation.md @@ -18,14 +18,14 @@ All HAP/HSP modules must have the **same versionCode**. Mismatched versions caus # Using Python (cross-platform) python3 -c " import zipfile, json, glob -for f in glob.glob('outputs/default/bundles/signed/*.hsp'): +for f in glob.glob('outputs/*.hsp'): z = zipfile.ZipFile(f) data = json.loads(z.read('module.json')) print(f\"{f.split('/')[-1]}: versionCode = {data['app']['versionCode']}\") " # Using unzip + grep (Linux/macOS) -for f in outputs/default/bundles/signed/*.hsp; do +for f in outputs/*.hsp; do echo -n "$(basename $f): " unzip -p "$f" module.json | grep -o '"versionCode":[0-9]*' done @@ -40,7 +40,7 @@ A module should be removed from the output before installation if: 3. Module versionCode differs from `AppScope/app.json5` ```bash -rm outputs/default/bundles/signed/problematic-module-default-signed.hsp +rm outputs/problematic-module-default-signed.hsp ``` ## Quick Installation Script @@ -52,7 +52,7 @@ Save as `install.sh` (Linux/macOS) or run with Git Bash on Windows: # === Configuration === DEVICE_ID="${1:-$(hdc list targets | head -1)}" -SIGNED_PATH="${2:-outputs/default/bundles/signed}" +SIGNED_PATH="${2:-outputs}" BUNDLE_NAME="${3:-}" REMOTE_PATH="/data/local/tmp/install_$(date +%s)" @@ -98,8 +98,8 @@ Usage: ./install.sh 1234567890ABCDEF # Specify device and path -./install.sh 1234567890ABCDEF outputs/default/bundles/signed +./install.sh 1234567890ABCDEF outputs # Specify device, path, and bundle name (auto-launch) -./install.sh 1234567890ABCDEF outputs/default/bundles/signed com.example.app +./install.sh 1234567890ABCDEF outputs com.example.app ``` diff --git a/harmonyos-build-deploy/references/module-discovery.md b/harmonyos-build-deploy/references/module-discovery.md index b3b494b..67307b1 100644 --- a/harmonyos-build-deploy/references/module-discovery.md +++ b/harmonyos-build-deploy/references/module-discovery.md @@ -136,7 +136,7 @@ Sometimes HSP files appear in the output directory that are **not listed in `bui ```bash # Example: Remove modules not in build-profile.json5 -rm outputs/default/bundles/signed/unwanted-module-default-signed.hsp +rm outputs/unwanted-module-default-signed.hsp ``` **Note:** Installation will fail with "version code not same" error if these unwanted modules have a different versionCode than the main app. The root cause is that these modules shouldn't be deployed at all.