feat(builder): Android/iOS 构建与 copy_artifact 发布
新增 APK/IPA 轨道和 copy_artifact.sh(本地目录或 container:/dir)。 push 必须委托该脚本,禁止在 makefile 里内联 docker cp。
This commit is contained in:
@@ -11,3 +11,5 @@
|
||||
# DOCKER_REPOSITORY=
|
||||
# IMAGE_TAG=
|
||||
# PLATFORMS= # optional override; project ARCHES lives in makefile.builder
|
||||
# COPY_DEST= # local dir, or docker dest container:/absolute/dir
|
||||
# COPY_AS= # optional extra basenames for the first file
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# Builder 契约文件。放到项目根,用 `make -f makefile.builder <target>`。
|
||||
# Android 轨道:build 产出 dist/<name>_<version>_<arch>.apk,push 走 copy_artifact.sh。
|
||||
# ARCHES 是构建机 ISA;APK 可含多 ABI。不要把这些目标写进用户 Makefile。
|
||||
|
||||
ARCHES ?= amd64
|
||||
ARCH ?= $(firstword $(ARCHES))
|
||||
ifeq ($(strip $(ARCHES)),)
|
||||
$(error ARCHES must not be empty)
|
||||
endif
|
||||
ifneq ($(filter-out amd64 arm64,$(ARCHES)),)
|
||||
$(error ARCHES entries must be amd64 or arm64)
|
||||
endif
|
||||
ifneq ($(filter $(ARCH),$(ARCHES)),$(ARCH))
|
||||
$(error ARCH must be one of: $(ARCHES))
|
||||
endif
|
||||
|
||||
PROJECT_NAME ?= $(notdir $(CURDIR))
|
||||
DIST_DIR ?= dist
|
||||
|
||||
ifneq ($(BUILDER_SKILL_DIR),)
|
||||
include $(BUILDER_SKILL_DIR)/scripts/version.mk
|
||||
else
|
||||
include $(HOME)/.pouch/skills/builder/scripts/version.mk
|
||||
endif
|
||||
|
||||
BUILDER_SCRIPTS := $(or $(BUILDER_SKILL_DIR),$(HOME)/.pouch/skills/builder)/scripts
|
||||
APK_OUT := $(DIST_DIR)/$(PROJECT_NAME)_$(VERSION)_$(ARCH).apk
|
||||
|
||||
.PHONY: help version arches clean build android push
|
||||
|
||||
help:
|
||||
@echo "$(PROJECT_NAME) $(VERSION)"
|
||||
@echo " ARCHES=$(ARCHES) ARCH=$(ARCH)"
|
||||
@echo " make -f makefile.builder build [ARCH=amd64|arm64] - 构建 Release APK"
|
||||
@echo " make -f makefile.builder version - 打印规范版本"
|
||||
@echo " make -f makefile.builder arches - 打印架构清单"
|
||||
@echo " make -f makefile.builder clean - 删除 $(DIST_DIR)"
|
||||
@echo " make -f makefile.builder push - copy_artifact.sh 拷到 COPY_DEST"
|
||||
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
arches:
|
||||
@echo $(ARCHES)
|
||||
|
||||
clean:
|
||||
rm -rf $(DIST_DIR)
|
||||
|
||||
# 替换为项目真实 assemble 命令,且必须使用 $(ARCH)。不得 curl/scp/docker cp。
|
||||
build:
|
||||
mkdir -p $(DIST_DIR)
|
||||
cp app-release.apk $(APK_OUT)
|
||||
|
||||
android: build
|
||||
|
||||
push:
|
||||
$(BUILDER_SCRIPTS)/copy_artifact.sh $(APK_OUT)
|
||||
@@ -0,0 +1,57 @@
|
||||
# Builder 契约文件。放到项目根,用 `make -f makefile.builder <target>`。
|
||||
# iOS 轨道:build 产出 dist/<name>_<version>_<arch>.ipa,push 走 copy_artifact.sh。
|
||||
# ARCHES 是构建机 ISA。不要把这些目标写进用户 Makefile。
|
||||
|
||||
ARCHES ?= arm64
|
||||
ARCH ?= $(firstword $(ARCHES))
|
||||
ifeq ($(strip $(ARCHES)),)
|
||||
$(error ARCHES must not be empty)
|
||||
endif
|
||||
ifneq ($(filter-out amd64 arm64,$(ARCHES)),)
|
||||
$(error ARCHES entries must be amd64 or arm64)
|
||||
endif
|
||||
ifneq ($(filter $(ARCH),$(ARCHES)),$(ARCH))
|
||||
$(error ARCH must be one of: $(ARCHES))
|
||||
endif
|
||||
|
||||
PROJECT_NAME ?= $(notdir $(CURDIR))
|
||||
DIST_DIR ?= dist
|
||||
|
||||
ifneq ($(BUILDER_SKILL_DIR),)
|
||||
include $(BUILDER_SKILL_DIR)/scripts/version.mk
|
||||
else
|
||||
include $(HOME)/.pouch/skills/builder/scripts/version.mk
|
||||
endif
|
||||
|
||||
BUILDER_SCRIPTS := $(or $(BUILDER_SKILL_DIR),$(HOME)/.pouch/skills/builder)/scripts
|
||||
IPA_OUT := $(DIST_DIR)/$(PROJECT_NAME)_$(VERSION)_$(ARCH).ipa
|
||||
|
||||
.PHONY: help version arches clean build ios push
|
||||
|
||||
help:
|
||||
@echo "$(PROJECT_NAME) $(VERSION)"
|
||||
@echo " ARCHES=$(ARCHES) ARCH=$(ARCH)"
|
||||
@echo " make -f makefile.builder build [ARCH=amd64|arm64] - 构建 IPA"
|
||||
@echo " make -f makefile.builder version - 打印规范版本"
|
||||
@echo " make -f makefile.builder arches - 打印架构清单"
|
||||
@echo " make -f makefile.builder clean - 删除 $(DIST_DIR)"
|
||||
@echo " make -f makefile.builder push - copy_artifact.sh 拷到 COPY_DEST"
|
||||
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
arches:
|
||||
@echo $(ARCHES)
|
||||
|
||||
clean:
|
||||
rm -rf $(DIST_DIR)
|
||||
|
||||
# 替换为项目真实 xcodebuild/export 命令,且必须使用 $(ARCH)。不得 curl/scp/docker cp。
|
||||
build:
|
||||
mkdir -p $(DIST_DIR)
|
||||
cp app.ipa $(IPA_OUT)
|
||||
|
||||
ios: build
|
||||
|
||||
push:
|
||||
$(BUILDER_SCRIPTS)/copy_artifact.sh $(IPA_OUT)
|
||||
Reference in New Issue
Block a user