Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ on:
description: ABI flavor
type: choice
required: true
default: universal
default: arm64
options:
- arm64
- universal
build_type:
description: Build type
type: choice
Expand All @@ -48,7 +47,7 @@ on:

env:
DEFAULT_APP_FLAVOR: google
DEFAULT_ABI_FLAVOR: universal
DEFAULT_ABI_FLAVOR: arm64
DEFAULT_BUILD_TYPE: debug

concurrency:
Expand All @@ -62,15 +61,15 @@ jobs:
should_publish_release: ${{ steps.compute.outputs.should_publish_release }}
release_tag: ${{ steps.compute.outputs.release_tag }}

# tag 推送: 海外(google/foss)各出 universal + arm64, 国内 6 渠道各出 arm64(给 GitCode 当国内更新源);
# tag 推送: 海外(google/foss)各出 arm64, 国内 6 渠道各出 arm64(给 GitCode 当国内更新源);
# 手动触发: 单个所选变体(include 为空, 行为与以前完全一致)
strategy:
fail-fast: false
matrix:
app_flavor: ${{ github.event_name == 'push' && fromJSON('["google","foss"]') || fromJSON(format('["{0}"]', inputs.app_flavor || 'google')) }}
abi_flavor: ${{ github.event_name == 'push' && fromJSON('["universal","arm64"]') || fromJSON(format('["{0}"]', inputs.abi_flavor || 'universal')) }}
abi_flavor: ${{ github.event_name == 'push' && fromJSON('["arm64"]') || fromJSON(format('["{0}"]', inputs.abi_flavor || 'arm64')) }}
# 国内渠道用 include 追加(不覆盖上面的组合): arm64 一个架构足够 ——
# 手机端全是 arm64, 且 arm64/universal 两个 abi flavor 的 abiFilters 都是 arm64-v8a。
# 手机端全是 arm64, 且 abi 维度只有 arm64 这一个 flavor。
include: ${{ github.event_name == 'push' && fromJSON('[{"app_flavor":"xiaomi","abi_flavor":"arm64"},{"app_flavor":"yyb","abi_flavor":"arm64"},{"app_flavor":"oppo","abi_flavor":"arm64"},{"app_flavor":"vivo","abi_flavor":"arm64"},{"app_flavor":"huawei","abi_flavor":"arm64"},{"app_flavor":"onebox","abi_flavor":"arm64"}]') || fromJSON('[]') }}

runs-on: ubuntu-latest
Expand Down Expand Up @@ -156,7 +155,7 @@ jobs:

BUILD_TYPE_CAPITALIZED="$(capitalize "$BUILD_TYPE")"
VARIANT_NAME="$(capitalize "$APP_FLAVOR")$(capitalize "$ABI_FLAVOR")$BUILD_TYPE_CAPITALIZED"
# AGP 输出目录是 flavor 组合的 camelCase: 第一个小写, 后续首字母大写 (googleUniversal)
# AGP 输出目录是 flavor 组合的 camelCase: 第一个小写, 后续首字母大写 (googleArm64)
VARIANT_DIR="${APP_FLAVOR}$(capitalize "$ABI_FLAVOR")"
APK_DIR="app/build/outputs/apk/$VARIANT_DIR/$BUILD_TYPE"
OUTPUT_APK_NAME="OneBox-${ARTIFACT_SUFFIX}-${APP_FLAVOR}-${ABI_FLAVOR}-${BUILD_TYPE}.apk"
Expand Down Expand Up @@ -275,7 +274,7 @@ jobs:
exit 0
fi

# VARIANT_DIR 由前面的步骤算出, 已是 AGP 产物目录的小写首字母形式 (googleUniversal)
# VARIANT_DIR 由前面的步骤算出, 已是 AGP 产物目录的小写首字母形式 (googleArm64)
MAPPING="app/build/outputs/mapping/${VARIANT_DIR}Release/mapping.txt"
if [[ ! -f "$MAPPING" ]]; then
MAPPING="$(find app/build/outputs/mapping -maxdepth 2 -type f -name mapping.txt \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ jobs:

# 选 foss: 不含 GMS / Firebase / 微信 / 支付宝 SDK, 也不需要 keystore,
# 但仍然会编译全部 127 个模块, 是最便宜又不缺覆盖的变体。
- name: Assemble foss universal debug
run: ./gradlew :app:assembleFossUniversalDebug --stacktrace
- name: Assemble foss arm64 debug
run: ./gradlew :app:assembleFossArm64Debug --stacktrace
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ git remote add upstream https://github.com/wangzhishou/OneBox.git
### Build

```bash
./gradlew :app:assembleFossUniversalDebug # the variant CI checks
./gradlew :app:assembleGoogleUniversalDebug # recommended local build (Google / Play channel)
./gradlew :feature:ai:compileGoogleUniversalDebugKotlin # one module, much faster
./gradlew :app:assembleFossArm64Debug # the variant CI checks
./gradlew :app:assembleGoogleArm64Debug # recommended local build (Google / Play channel)
./gradlew :feature:ai:compileGoogleArm64DebugKotlin # one module, much faster
```

`google` is the overseas / Play flavor and the default local build target; swap `Google` for `Onebox`, `Xiaomi`, `Huawei`, … when you need a domestic channel.
Expand All @@ -58,7 +58,7 @@ git remote add upstream https://github.com/wangzhishou/OneBox.git
If you hit `InjectProcessingStep was unable to process ... could not be resolved`, that is a KSP/Hilt cache problem, not your code:

```bash
./gradlew clean :feature:app:kspGoogleUniversalDebugKotlin
./gradlew clean :feature:app:kspGoogleArm64DebugKotlin
```

### Keys are optional
Expand Down Expand Up @@ -89,7 +89,7 @@ Be aware before you write any: this project has almost no test culture, delibera
1. Branch from `main`. Name the branch after what you are fixing.
2. Keep the PR to one concern. A rename plus a behaviour change plus a formatting pass is three PRs.
3. Describe what changed and **how you verified it**.
4. CI builds `:app:assembleFossUniversalDebug` on every PR. A red PR will not be reviewed until it is green.
4. CI builds `:app:assembleFossArm64Debug` on every PR. A red PR will not be reviewed until it is green.
5. The maintainer is one person in UTC+8. Expect a first response within a few days. If a week passes with no reply, a ping is welcome, not rude.
6. PRs are squash-merged, so do not worry about cleaning up branch history.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ git clone --depth=1 https://github.com/wangzhishou/OneBox.git
### Common Commands

```bash
./gradlew :app:assembleGoogleUniversalDebug # single-variant debug APK (google = default channel)
./gradlew :app:assembleGoogleArm64Debug # single-variant debug APK (google = default channel)
./gradlew tasks --group=assemble # list all assemble tasks
./gradlew :app:tasks
```
Expand All @@ -126,11 +126,11 @@ The `app` module uses two flavor dimensions:

- `app`: `xiaomi` / `yyb` / `oppo` / `vivo` / `huawei` / `onebox` / `google` / `foss`
(`foss` is the fully-FOSS build: no GMS, Firebase, WeChat or Alipay SDKs; this is the variant CI verifies)
- `abi`: `arm64` / `universal` (64-bit only)
- `abi`: `arm64` (64-bit only)

**Build and verify with the `google` (overseas / Play) flavor by default**; pick a domestic flavor only when it is actually needed. Task names combine the two dimensions, e.g.:

- `:app:assembleGoogleUniversalDebug`
- `:app:assembleGoogleArm64Debug`
- `:app:assembleGoogleArm64Release`
- `:app:assembleHuaweiArm64Debug`

Expand All @@ -153,10 +153,10 @@ Both target files are git-ignored; never commit real values.

### Multi-channel Release Builds

`build_release.sh` builds **7 channels × 2 ABIs (arm64 / universal, 64-bit only) = 14 release APKs** into `release/` with a `release/manifest.txt` summary. Examples:
`build_release.sh` builds **7 channels × 1 ABI (arm64, 64-bit only) = 7 release APKs** into `release/` with a `release/manifest.txt` summary. Examples:

```bash
./build_release.sh # all 14
./build_release.sh # all 7
./build_release.sh --channel xiaomi huawei # selected channels
./build_release.sh --abi arm64 # 64-bit only
./build_release.sh --no-offline --clean # fetch deps online + clean first
Expand Down
14 changes: 7 additions & 7 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ AI 理解、执行、反馈,一气呵成。
### 常用命令

```bash
./gradlew :app:assembleGoogleUniversalDebug # 单变体 debug 包
./gradlew :app:assembleGoogleArm64Debug # 单变体 debug 包
./gradlew tasks --group=assemble # 查看全部打包任务
./gradlew :app:tasks
```
Expand All @@ -115,11 +115,11 @@ AI 理解、执行、反馈,一气呵成。

- `app`:`xiaomi` / `yyb` / `oppo` / `vivo` / `huawei` / `onebox` / `google` / `foss`
(`foss` 为完全 FOSS 构建:无 GMS、Firebase、微信/支付宝 SDK,也是 CI 校验的变体)
- `abi`:`arm64` / `universal`(仅 64 位)
- `abi`:`arm64`(仅 64 位)

**默认使用 `google`(海外 / Play 渠道)变体做构建与验证**,确需国内渠道时再替换。最终任务名会组合为:

- `:app:assembleGoogleUniversalDebug`
- `:app:assembleGoogleArm64Debug`
- `:app:assembleGoogleArm64Release`
- `:app:assembleHuaweiArm64Debug`

Expand All @@ -142,14 +142,14 @@ AI 理解、执行、反馈,一气呵成。

### 多渠道发布打包

项目根目录提供 `build_release.sh` 脚本,用于本地一次性打出 **7 渠道 × 2 架构 (arm64 / universal,仅 64 位) = 14 个 Release APK**,统一归集到 `release/` 目录,并生成 `release/manifest.txt` 汇总清单。
项目根目录提供 `build_release.sh` 脚本,用于本地一次性打出 **7 渠道 × 1 架构 (arm64,仅 64 位) = 7 个 Release APK**,统一归集到 `release/` 目录,并生成 `release/manifest.txt` 汇总清单。

文件名沿用 Gradle 生成的 `OneBox-<version>-<渠道>-<架构>-release.apk`(如 `OneBox-1.2.3-xiaomi-arm64-release.apk`)。

**常用命令**

```bash
./build_release.sh # 全部 14 个
./build_release.sh # 全部 7 个
./build_release.sh --channel xiaomi huawei # 指定渠道
./build_release.sh --abi arm64 # 只打 arm64 (7 个)
./build_release.sh --channel onebox --abi arm64 # 单个组合
Expand All @@ -162,7 +162,7 @@ AI 理解、执行、反馈,一气呵成。
| 参数 | 说明 |
| --- | --- |
| `--channel <a> [b...]` | 只构建指定渠道 (可空格分隔多个) |
| `--abi <arm64\|universal>` | 只构建指定架构 (可空格分隔多个) |
| `--abi <arm64>` | 只构建指定架构 (可空格分隔多个) |
| `--no-offline` | 覆盖离线模式配置,允许联网拉依赖(本仓库默认在线) |
| `--clean` | 构建前先执行 `clean` |
| `--skip-build` | 跳过 `gradlew`,只把已有 `app/build/outputs/apk/...` 复制到 `release/` |
Expand Down Expand Up @@ -206,7 +206,7 @@ git push gitcode --tags
./scripts/publish_gitcode_release.py --tag 1.4.0 --dir release --abi arm64
```

GitHub Release 只挂海外包(google/foss 各 universal + arm64),国内 6 渠道包只进 GitCode。
GitHub Release 只挂海外包(google/foss 各 arm64),国内 6 渠道包只进 GitCode。
**GitCode 仓库必须公开**,否则匿名 API 返回 403。

## AI / Agent 能力边界
Expand Down
14 changes: 1 addition & 13 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,6 @@ android {
// Crashlytics 反混淆 id, 仅 google flavor 的 SDK 会读; 国内包无 Firebase, 资源闲置
resValue("string", "com.google.firebase.crashlytics.mapping_file_id", crashlyticsMappingFileId("arm64"))
}

create("universal") {
dimension = "abi"
ndk {
abiFilters.clear()
abiFilters.add("arm64-v8a")
}
manifestPlaceholders["flavorAbi"] = "universal"
resValue("string", "com.google.firebase.crashlytics.mapping_file_id", crashlyticsMappingFileId("universal"))
}
}


Expand Down Expand Up @@ -477,10 +467,9 @@ base {
// 由 build_release.sh 在 google release 构建后用于手动上传
val writeCrashlyticsMappingFileIds by tasks.registering {
val outputDir = layout.buildDirectory.dir("crashlytics")
// 配置期算好两个 id, doLast 只捕获普通 Map, 避免引用脚本对象破坏 configuration cache
// 配置期算好 id, doLast 只捕获普通 Map, 避免引用脚本对象破坏 configuration cache
val idByAbi = mapOf(
"arm64" to crashlyticsMappingFileId("arm64"),
"universal" to crashlyticsMappingFileId("universal"),
)
outputs.dir(outputDir)
doLast {
Expand Down Expand Up @@ -527,7 +516,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
api(libs.coil)
api(libs.coil.network)
api(libs.ktor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ class ImageToolboxLibraryPlugin : Plugin<Project> {
abiFilters.add("arm64-v8a")
}
}
create("universal") {
dimension = "abi"
ndk {
abiFilters.clear()
abiFilters.add("arm64-v8a")
}
}
}

val properties = Properties()
Expand Down
10 changes: 5 additions & 5 deletions build_release.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# build_release.sh — 打各个渠道的 Release 包 (仅 64 位: arm64 / universal)
# build_release.sh — 打各个渠道的 Release 包 (仅 64 位: arm64)
#
# 用法:
# ./build_release.sh # 7 渠道 × 2 架构 = 14 个 APK
# ./build_release.sh # 7 渠道 × 1 架构 = 7 个 APK
# ./build_release.sh --channel xiaomi huawei
# ./build_release.sh --abi arm64
# ./build_release.sh --channel onebox --abi arm64
Expand All @@ -25,7 +25,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

ALL_CHANNELS=("xiaomi" "yyb" "oppo" "vivo" "huawei" "onebox" "google")
ALL_ABIS=("arm64" "universal")
ALL_ABIS=("arm64")
OUT_DIR="release"
GRADLE="./gradlew"
KEYSTORE_FILE="keystore.properties"
Expand Down Expand Up @@ -167,7 +167,7 @@ MANIFEST="$OUT_DIR/manifest.txt"
FOUND=0
for c in "${CHANNELS[@]}"; do
for a in "${ABIS[@]}"; do
variant_dir="app/build/outputs/apk/${c}${a}/release"
variant_dir="app/build/outputs/apk/${c}$(to_pascal <<< "$a")/release"
# 取该目录下第一个 .apk(正常只有一个 release apk)
apk="$(find "$variant_dir" -maxdepth 1 -name '*.apk' -type f 2>/dev/null | head -n1 || true)"
if [[ -z "$apk" ]]; then
Expand Down Expand Up @@ -216,7 +216,7 @@ for c in data.get("client", []):
echo " [跳过] 未能从 google-services.json 解析 com.shifenmiao.app 的 mobilesdk_app_id"
else
for a in "${ABIS[@]}"; do
# AGP 产物目录首字母小写 (googleUniversalRelease); macOS 大小写不敏感所以
# AGP 产物目录首字母小写 (googleArm64Release); macOS 大小写不敏感所以
# 之前写成 Google 也能命中, 但脚本若在 Linux 上跑就会找不到文件
variant="google$(to_pascal <<< "$a")Release"
mapping="app/build/outputs/mapping/$variant/mapping.txt"
Expand Down
1 change: 0 additions & 1 deletion core/base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
/**
* lottie
*/
Expand Down
1 change: 0 additions & 1 deletion core/database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

/**
* 数据库
Expand Down
1 change: 0 additions & 1 deletion core/empty/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

implementation(projects.core.model)
implementation(projects.core.theme)
Expand Down
1 change: 0 additions & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
/**
* 事件总线
*/
Expand Down
1 change: 0 additions & 1 deletion core/storage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

implementation(libs.datastore.preferences.android)

Expand Down
2 changes: 1 addition & 1 deletion fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ python3 -m venv .venv && .venv/bin/pip install google-api-python-client google-a
`push_release.py` 把本地构建的 AAB 上传并发布到指定轨道(内部 edits.insert → bundles.upload → tracks.update → edits.commit,失败自动 delete edit 回滚;版本名形如 `130 (1.3.0)`,changelog 取 `metadata/android/<locale>/changelogs/<versionCode>.txt`,单条 ≤500 字符):

```bash
./gradlew :app:bundleGoogleUniversalRelease # 构建 AAB(在 android/ 下)
./gradlew :app:bundleGoogleArm64Release # 构建 AAB(在 android/ 下)
.venv/bin/python push_release.py --dry-run # 预览(默认最新 AAB + production)
.venv/bin/python push_release.py # 正式发布
```
Expand Down
2 changes: 1 addition & 1 deletion fastlane/push_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
HERE = os.path.dirname(os.path.abspath(__file__))
META = os.path.join(HERE, "metadata", "android")
DEFAULT_AAB_GLOB = os.path.join(
HERE, "..", "app", "build", "outputs", "bundle", "googleUniversalRelease", "*.aab"
HERE, "..", "app", "build", "outputs", "bundle", "googleArm64Release", "*.aab"
)
VERSIONS_TOML = os.path.join(HERE, "..", "gradle", "libs.versions.toml")
NOTES_LIMIT = 500
Expand Down
1 change: 0 additions & 1 deletion feature/ad-watch/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dependencies {

// MMKV (by ABI, 每日观看计数持久化)
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

// AdMob 激励广告仅 google 渠道, GroMore 聚合激励广告仅国内 6 渠道, foss 不携带广告 SDK
"googleApi"(libs.play.services.ads)
Expand Down
1 change: 0 additions & 1 deletion feature/ai/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

/**
* 数据库
Expand Down
1 change: 0 additions & 1 deletion feature/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
implementation(libs.com.airbnb.lottie)

implementation(projects.feature.settings)
Expand Down
1 change: 0 additions & 1 deletion feature/blog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
//Di
implementation(libs.dagger.hilt.android)
/**
Expand Down
1 change: 0 additions & 1 deletion feature/cloud-storage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
}
1 change: 0 additions & 1 deletion feature/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

implementation(projects.core.theme)
implementation(projects.core.model)
Expand Down
1 change: 0 additions & 1 deletion feature/decision-wheel/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dependencies {
* mmkv
*/
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)

/**
* 数据库
Expand Down
1 change: 0 additions & 1 deletion feature/dice-roller/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ dependencies {

// MMKV (按 ABI)
"arm64Api"(libs.com.tencent.mmkv)
"universalApi"(libs.com.tencent.mmkv)
}

Loading