SDK: support generating repository XML with latest XSD. DO NOT MERGE.

The latest version of the repository XSD changes:
- archive attributes (os/arch) are now element (host-os)
- system images are not longer in the repository.xml and
  get their own XML file.

(cherry picked from commit ea40d2f4c5)

Change-Id: Id0363c446014a96a7f78c8e5500fae6092e97dc3
This commit is contained in:
Raphael Moll
2014-04-24 19:13:47 -07:00
committed by Raphael Moll
parent 8062092a46
commit efbf1a3e28
7 changed files with 143 additions and 61 deletions

View File

@@ -21,20 +21,21 @@ endef
# 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.)
# $1=variable where to accumulate args for mk_sdk_repo_xml.
# $2=OS (e.g. linux-x86, windows, etc)
# $3=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
# $4=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 $(basename $(2)) && \
zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) $(3)/*
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3)
@echo "Building SDK repository package $(4) from $(notdir $(3))"
$(hide) cd $(basename $(3)) && \
zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4))) $(4)/*
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
$(1) += $(4) $(2) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
endef
# Defines the rule to build an SDK repository package when the
@@ -42,20 +43,21 @@ endef
# 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.)
# $1=variable where to accumulate args for mk_sdk_repo_xml.
# $2=OS (e.g. linux-x86, windows, etc)
# $3=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
# $4=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 $(basename $(2))/$(3) && \
zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3)
@echo "Building SDK repository package $(4) from $(notdir $(3))"
$(hide) cd $(basename $(3))/$(4) && \
zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
$(1) += $(4) $(2) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
endef
# Defines the rule to build an SDK repository package when the
@@ -65,40 +67,42 @@ endef
# if each directory contains a single sub-directory (e.g. sdk/$4/*/* must be
# unique.)
#
# $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. system-images, support, etc.)
# $4=the root of directory to package in the sdk (e.g. extra/android).
# $1=variable where to accumulate args for mk_sdk_repo_xml.
# $2=OS (e.g. linux-x86, windows, etc)
# $3=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
# $4=package to create (e.g. system-images, support, etc.)
# $5=the root of directory to package in the sdk (e.g. extra/android).
# this must be a 2-segment path, the last one can be *.
#
# The rule depends on the SDK zip file, which is defined by $2.
#
define mk-sdk-repo-pkg-3
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2)
@echo "Building SDK repository package $(3) from $(notdir $(2))"
$(hide) cd $(basename $(2))/$(4) && \
zip -9rq ../../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3)
@echo "Building SDK repository package $(4) from $(notdir $(3))"
$(hide) cd $(basename $(3))/$(5) && \
zip -9rq ../../../$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4))) *
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
$(1) += $(4) $(2) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
endef
# Defines the rule to build an SDK sources package.
#
# $1=OS (e.g. linux-x86, windows, etc)
# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
# $3=package to create, must be "sources"
# $1=variable where to accumulate args for mk_sdk_repo_xml.
# $2=OS (e.g. linux-x86, windows, etc)
# $3=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip)
# $4=package to create, must be "sources"
#
define mk-sdk-repo-sources
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(HOST_OUT)/development/sdk/source_source.properties
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3) $(HOST_OUT)/development/sdk/source_source.properties
@echo "Building SDK sources package"
$(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py --exec-zip \
$(HOST_OUT)/development/sdk/source_source.properties \
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)) \
$(TOPDIR).
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
SDK_REPO_XML_ARGS += $(3) $(1) \
$(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3)))
$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
$(1) += $(4) $(2) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
endef
# -----------------------------------------------------------------
@@ -106,23 +110,25 @@ endef
ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
# Note that extras are now located in addon.xml, not in repository.xml,
# so we capture all extras first.
$(eval $(call mk-sdk-repo-pkg-3,$(HOST_OS),$(MAIN_SDK_ZIP),support,extras/android))
SDK_EXTRAS_XML_ARGS := $(SDK_REPO_XML_ARGS)
SDK_REPO_XML_ARGS :=
# Extras are now located in addon.xml, not in repository.xml.
$(eval $(call mk-sdk-repo-pkg-3,SDK_EXTRAS_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),support,extras/android))
SDK_EXTRAS_DEPS += \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),support)
# Similarly capture all sys-img.xml that are now split out of repository.xml
$(eval $(call mk-sdk-repo-pkg-3,SDK_SYSIMG_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),system-images,system-images/*))
$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),build-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))
$(eval $(call mk-sdk-repo-pkg-3,$(HOST_OS),$(MAIN_SDK_ZIP),system-images,system-images/*))
$(eval $(call mk-sdk-repo-sources,$(HOST_OS),$(MAIN_SDK_ZIP),sources))
SDK_SYSIMG_DEPS += \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \
# All these go in the main repository.xml
$(eval $(call mk-sdk-repo-pkg-2,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),build-tools))
$(eval $(call mk-sdk-repo-pkg-1,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools))
$(eval $(call mk-sdk-repo-pkg-1,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),docs))
$(eval $(call mk-sdk-repo-pkg-2,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),platforms))
$(eval $(call mk-sdk-repo-pkg-2,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),samples))
$(eval $(call mk-sdk-repo-sources,SDK_REPO_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),sources))
SDK_REPO_DEPS += \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),build-tools) \
@@ -130,7 +136,6 @@ SDK_REPO_DEPS += \
$(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) \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),sources)
endif
@@ -141,8 +146,8 @@ endif
ifneq ($(WIN_SDK_ZIP),)
# docs, platforms and samples have nothing OS-dependent right now.
$(eval $(call mk-sdk-repo-pkg-2,windows,$(WIN_SDK_ZIP),build-tools))
$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools))
$(eval $(call mk-sdk-repo-pkg-2,SDK_REPO_XML_ARGS,windows,$(WIN_SDK_ZIP),build-tools))
$(eval $(call mk-sdk-repo-pkg-1,SDK_REPO_XML_ARGS,windows,$(WIN_SDK_ZIP),platform-tools))
SDK_REPO_DEPS += \
$(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),build-tools) \
@@ -165,6 +170,12 @@ SDK_ADDON_XSD := \
$(TOPDIR)prebuilts/devtools/repository/sdk-addon-*.xsd \
))
SDK_SYSIMG_XSD := \
$(lastword \
$(wildcard \
$(TOPDIR)prebuilts/devtools/repository/sdk-sys-img-*.xsd \
))
# -----------------------------------------------------------------
# Rules for sdk addon
@@ -196,6 +207,7 @@ endif
SDK_REPO_XML := $(HOST_OUT)/sdk/repository.xml
SDK_EXTRAS_XML := $(HOST_OUT)/sdk/repo-extras.xml
SDK_SYSIMG_XML := $(HOST_OUT)/sdk/repo-sys-img.xml
ifneq ($(SDK_REPO_XML_ARGS),)
@@ -226,8 +238,23 @@ $(SDK_EXTRAS_XML): ;
endif
ifneq ($(SDK_SYSIMG_XML_ARGS),)
$(SDK_SYSIMG_XML): $(SDK_SYSIMG_DEPS)
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
$(SDK_SYSIMG_XML) $(SDK_SYSIMG_XSD) $(SDK_SYSIMG_XML_ARGS)
$(call dist-for-goals, sdk_repo, $(SDK_SYSIMG_XML))
else
$(SDK_SYSIMG_XML): ;
endif
# -----------------------------------------------------------------
sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) $(SDK_EXTRAS_XML)
sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) $(SDK_EXTRAS_XML) $(SDK_SYSIMG_XML)
@echo "Packing of SDK repository done"