Merge 2ff496b8a1: 'Build SDK repository.' Do not merge.
When the build is invoked with the fake target "sdk_repo" and a main target of sdk, win_sdk or sdk_addon, we now create packages in DIST_DIR that can directly be used to populate the SDK Repository. This is quite close to how we actually distribute the SDK. Change-Id: I671e8ff1bc2a6e9f5c097241d65da1cfdde21154
This commit is contained in:
106
build/tools/sdk_repo.mk
Normal file
106
build/tools/sdk_repo.mk
Normal file
@@ -0,0 +1,106 @@
|
||||
# Makefile to build the SDK repository packages.
|
||||
|
||||
.PHONY: sdk_repo
|
||||
|
||||
# Define the name of a package zip file to generate
|
||||
# $1=OS (e.g. linux-x86, windows, etc)
|
||||
# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
|
||||
# $3=package to create (e.g. tools, docs, etc.)
|
||||
#
|
||||
define sdk-repo-pkg-zip
|
||||
$(dir $(2))/sdk-repo-$(1)-$(3).zip
|
||||
endef
|
||||
|
||||
# Defines the rule to build an SDK repository package by zipping all
|
||||
# the content of the given directory.
|
||||
# E.g. given a folder out/host/linux.../sdk/android-eng-sdk/tools
|
||||
# this generates an sdk-repo-linux-tools that contains tools/*
|
||||
#
|
||||
# $1=OS (e.g. linux-x86, windows, etc)
|
||||
# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
|
||||
# $3=package to create (e.g. tools, docs, etc.)
|
||||
#
|
||||
# The rule depends on the SDK zip file, which is defined by $2.
|
||||
#
|
||||
define mk-sdk-repo-pkg-1
|
||||
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
|
||||
@echo "Building SDK repository package $(3) from $(notdir $(2))"
|
||||
$(hide) cd $(dir $(2)) && \
|
||||
zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) \
|
||||
$(basename $(2))/*
|
||||
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
|
||||
endef
|
||||
|
||||
# Defines the rule to build an SDK repository package when the
|
||||
# package directory contains a single platform-related inner directory.
|
||||
# E.g. given a folder out/host/linux.../sdk/android-eng-sdk/samples/android-N
|
||||
# this generates an sdk-repo-linux-samples that contains android-N/*
|
||||
#
|
||||
# $1=OS (e.g. linux-x86, windows, etc)
|
||||
# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
|
||||
# $3=package to create (e.g. platforms, samples, etc.)
|
||||
#
|
||||
# The rule depends on the SDK zip file, which is defined by $2.
|
||||
#
|
||||
define mk-sdk-repo-pkg-2
|
||||
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
|
||||
@echo "Building SDK repository package $(3) from $(notdir $(2))"
|
||||
$(hide) cd $(dir $(2))/$(3) && \
|
||||
zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) \
|
||||
$(basename $(2))/*
|
||||
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
|
||||
endef
|
||||
|
||||
|
||||
SDK_REPO_DEPS :=
|
||||
|
||||
# Rules for win_sdk
|
||||
|
||||
ifneq ($(WIN_SDK_ZIP),)
|
||||
|
||||
# docs, platforms and samples have nothing OS-dependent right now.
|
||||
$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools))
|
||||
$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools))
|
||||
|
||||
SDK_REPO_DEPS += \
|
||||
$(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \
|
||||
$(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools)
|
||||
|
||||
endif
|
||||
|
||||
# Rules for main host sdk
|
||||
|
||||
ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
|
||||
|
||||
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools))
|
||||
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools))
|
||||
$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs))
|
||||
$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms))
|
||||
$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),samples))
|
||||
|
||||
SDK_REPO_DEPS += \
|
||||
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \
|
||||
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \
|
||||
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \
|
||||
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \
|
||||
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \
|
||||
|
||||
endif
|
||||
|
||||
# Rules for sdk addon
|
||||
|
||||
ifneq ($(ADDON_SDK_ZIP),)
|
||||
|
||||
# ADDON_SDK_ZIP is defined in build/core/tasks/sdk-addon.sh and is
|
||||
# already packaged correctly. All we have to do is dist it with
|
||||
# a different destination name.
|
||||
|
||||
$(call dist-for-goals, sdk_repo, \
|
||||
$(ADDON_SDK_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_ZIP),addon)))
|
||||
|
||||
endif
|
||||
|
||||
|
||||
sdk_repo: $(SDK_REPO_DEPS)
|
||||
@echo "Packing of SDK repository done"
|
||||
|
||||
@@ -33,9 +33,9 @@ WIN_TARGETS := \
|
||||
sdklauncher sqlite3 \
|
||||
zipalign
|
||||
|
||||
# LINUX_SDK_NAME/DIR is set in build/core/Makefile
|
||||
WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(LINUX_SDK_NAME))
|
||||
WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(LINUX_SDK_DIR))
|
||||
# MAIN_SDK_NAME/DIR is set in build/core/Makefile
|
||||
WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_NAME))
|
||||
WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_DIR))
|
||||
WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip
|
||||
|
||||
$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP))
|
||||
@@ -49,7 +49,7 @@ $(info )
|
||||
endef
|
||||
|
||||
define winsdk-info
|
||||
$(info LINUX_SDK_NAME: $(LINUX_SDK_NAME))
|
||||
$(info MAIN_SDK_NAME: $(MAIN_SDK_NAME))
|
||||
$(info WIN_SDK_NAME : $(WIN_SDK_NAME))
|
||||
$(info WIN_SDK_DIR : $(WIN_SDK_DIR))
|
||||
$(info WIN_SDK_ZIP : $(WIN_SDK_ZIP))
|
||||
@@ -67,7 +67,7 @@ $(WIN_SDK_ZIP): winsdk-tools sdk
|
||||
$(call winsdk-info)
|
||||
$(hide) rm -rf $(WIN_SDK_DIR)
|
||||
$(hide) mkdir -p $(WIN_SDK_DIR)
|
||||
$(hide) cp -rf $(LINUX_SDK_DIR)/$(LINUX_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
|
||||
$(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
|
||||
$(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
|
||||
$(TOPDIR)development/build/tools/patch_windows_sdk.sh \
|
||||
$(subst @,-q,$(hide)) \
|
||||
|
||||
Reference in New Issue
Block a user