fix: simplify build output path from outputs/default/bundles/signed to outputs

This commit is contained in:
cheliangzhao
2026-02-11 13:23:23 +08:00
parent 8aa8fd567e
commit f5b575c0df
4 changed files with 16 additions and 15 deletions

View File

@@ -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**: 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**: 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**: 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 ### Removed

View File

@@ -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 # Use a random directory name to avoid conflicts with previous installations
INSTALL_DIR="/data/local/tmp/install_$(date +%s)" INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR" hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR hdc -t <UDID> file send outputs $INSTALL_DIR
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed" hdc -t <UDID> shell "bm install -p $INSTALL_DIR/outputs"
hdc -t <UDID> shell "rm -rf $INSTALL_DIR" hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
``` ```
**Note:** Build output path is `outputs/default/bundles/signed/`. **Note:** Build output path is `outputs/`.
## Workflows ## Workflows
@@ -66,7 +66,7 @@ Delegate to subagent with the following steps:
Delegate to subagent with the following steps: Delegate to subagent with the following steps:
1. Read `AppScope/app.json5` to get bundleName 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) 3. Deploy to device (see [Push and Install](#push-and-install) below)
4. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"` 4. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"`
5. Report success/failure with details 5. Report success/failure with details
@@ -170,10 +170,10 @@ hvigorw --sync -p product=default -p buildMode=release --no-daemon
## Build Outputs ## Build Outputs
Build output path: `outputs/default/bundles/signed/` Build output path: `outputs/`
``` ```
outputs/default/bundles/signed/ outputs/
├── entry-default-signed.hap ├── entry-default-signed.hap
└── *.hsp └── *.hsp
``` ```
@@ -220,10 +220,10 @@ INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR" hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
# Push signed bundles # Push signed bundles
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR hdc -t <UDID> file send outputs $INSTALL_DIR
# Install all HAP/HSP in directory # Install all HAP/HSP in directory
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed" hdc -t <UDID> shell "bm install -p $INSTALL_DIR/outputs"
# Clean up temp directory # Clean up temp directory
hdc -t <UDID> shell "rm -rf $INSTALL_DIR" hdc -t <UDID> shell "rm -rf $INSTALL_DIR"

View File

@@ -18,14 +18,14 @@ All HAP/HSP modules must have the **same versionCode**. Mismatched versions caus
# Using Python (cross-platform) # Using Python (cross-platform)
python3 -c " python3 -c "
import zipfile, json, glob 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) z = zipfile.ZipFile(f)
data = json.loads(z.read('module.json')) data = json.loads(z.read('module.json'))
print(f\"{f.split('/')[-1]}: versionCode = {data['app']['versionCode']}\") print(f\"{f.split('/')[-1]}: versionCode = {data['app']['versionCode']}\")
" "
# Using unzip + grep (Linux/macOS) # Using unzip + grep (Linux/macOS)
for f in outputs/default/bundles/signed/*.hsp; do for f in outputs/*.hsp; do
echo -n "$(basename $f): " echo -n "$(basename $f): "
unzip -p "$f" module.json | grep -o '"versionCode":[0-9]*' unzip -p "$f" module.json | grep -o '"versionCode":[0-9]*'
done done
@@ -40,7 +40,7 @@ A module should be removed from the output before installation if:
3. Module versionCode differs from `AppScope/app.json5` 3. Module versionCode differs from `AppScope/app.json5`
```bash ```bash
rm outputs/default/bundles/signed/problematic-module-default-signed.hsp rm outputs/problematic-module-default-signed.hsp
``` ```
## Quick Installation Script ## Quick Installation Script
@@ -52,7 +52,7 @@ Save as `install.sh` (Linux/macOS) or run with Git Bash on Windows:
# === Configuration === # === Configuration ===
DEVICE_ID="${1:-$(hdc list targets | head -1)}" DEVICE_ID="${1:-$(hdc list targets | head -1)}"
SIGNED_PATH="${2:-outputs/default/bundles/signed}" SIGNED_PATH="${2:-outputs}"
BUNDLE_NAME="${3:-}" BUNDLE_NAME="${3:-}"
REMOTE_PATH="/data/local/tmp/install_$(date +%s)" REMOTE_PATH="/data/local/tmp/install_$(date +%s)"
@@ -98,8 +98,8 @@ Usage:
./install.sh 1234567890ABCDEF ./install.sh 1234567890ABCDEF
# Specify device and path # Specify device and path
./install.sh 1234567890ABCDEF outputs/default/bundles/signed ./install.sh 1234567890ABCDEF outputs
# Specify device, path, and bundle name (auto-launch) # 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
``` ```

View File

@@ -136,7 +136,7 @@ Sometimes HSP files appear in the output directory that are **not listed in `bui
```bash ```bash
# Example: Remove modules not in build-profile.json5 # 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. **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.