Merge "Clean up sdk building, use built xmllint"
This commit is contained in:
@@ -40,6 +40,10 @@ if [[ ! -x $(which sha1sum) ]]; then
|
|||||||
error "Missing tool: sha1sum (Linux: apt-get install coreutils; Mac: port install md5sha1sum)"
|
error "Missing tool: sha1sum (Linux: apt-get install coreutils; Mac: port install md5sha1sum)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$XMLLINT" ]]; then
|
||||||
|
XMLLINT=xmllint
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse input params
|
# Parse input params
|
||||||
OUT="$1"
|
OUT="$1"
|
||||||
[[ -z "$OUT" ]] && error "Missing output.xml name."
|
[[ -z "$OUT" ]] && error "Missing output.xml name."
|
||||||
@@ -54,7 +58,7 @@ shift
|
|||||||
# This will be something like "http://schemas.android.com/sdk/android/addon/3"
|
# This will be something like "http://schemas.android.com/sdk/android/addon/3"
|
||||||
XMLNS=$(sed -n '/xmlns:sdk="/s/.*"\(.*\)".*/\1/p' "$SCHEMA")
|
XMLNS=$(sed -n '/xmlns:sdk="/s/.*"\(.*\)".*/\1/p' "$SCHEMA")
|
||||||
[[ -z "$XMLNS" ]] && error "Failed to find xmlns:sdk in $SCHEMA."
|
[[ -z "$XMLNS" ]] && error "Failed to find xmlns:sdk in $SCHEMA."
|
||||||
echo "## Using xmlns:sdk=$XMLNS"
|
#echo "## Using xmlns:sdk=$XMLNS"
|
||||||
|
|
||||||
# Extract the schema version number from the XMLNS, e.g. it would extract "3"
|
# Extract the schema version number from the XMLNS, e.g. it would extract "3"
|
||||||
XSD_VERSION="${XMLNS##*/}"
|
XSD_VERSION="${XMLNS##*/}"
|
||||||
@@ -63,7 +67,7 @@ XSD_VERSION="${XMLNS##*/}"
|
|||||||
# which name starts with "sdk-" (e.g. sdk-repository, sdk-addon)
|
# which name starts with "sdk-" (e.g. sdk-repository, sdk-addon)
|
||||||
ROOT=$(sed -n -e '/xsd:element.*name="sdk-/s/.*name="\(sdk-[^"]*\)".*/\1/p' "$SCHEMA")
|
ROOT=$(sed -n -e '/xsd:element.*name="sdk-/s/.*name="\(sdk-[^"]*\)".*/\1/p' "$SCHEMA")
|
||||||
[[ -z "$ROOT" ]] && error "Failed to find root element in $SCHEMA."
|
[[ -z "$ROOT" ]] && error "Failed to find root element in $SCHEMA."
|
||||||
echo "## Using root element $ROOT"
|
#echo "## Using root element $ROOT"
|
||||||
|
|
||||||
# Generate XML header
|
# Generate XML header
|
||||||
cat > "$OUT" <<EOFH
|
cat > "$OUT" <<EOFH
|
||||||
@@ -415,7 +419,7 @@ while [[ -n "$1" ]]; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate archive info
|
# Generate archive info
|
||||||
echo "## Add $TYPE/$OS archive $SRC"
|
#echo "## Add $TYPE/$OS archive $SRC"
|
||||||
if [[ $( uname ) == "Darwin" ]]; then
|
if [[ $( uname ) == "Darwin" ]]; then
|
||||||
SIZE=$( stat -f %z "$SRC" )
|
SIZE=$( stat -f %z "$SRC" )
|
||||||
else
|
else
|
||||||
@@ -461,6 +465,5 @@ done
|
|||||||
# Generate XML footer
|
# Generate XML footer
|
||||||
echo "</sdk:$ROOT>" >> "$OUT"
|
echo "</sdk:$ROOT>" >> "$OUT"
|
||||||
|
|
||||||
echo "## Validate XML against schema"
|
#echo "## Validate XML against schema"
|
||||||
xmllint --schema $SCHEMA "$OUT"
|
$XMLLINT --noout --schema $SCHEMA "$OUT"
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ SDK_REPO_DEPS :=
|
|||||||
SDK_REPO_XML_ARGS :=
|
SDK_REPO_XML_ARGS :=
|
||||||
SDK_EXTRAS_DEPS :=
|
SDK_EXTRAS_DEPS :=
|
||||||
SDK_EXTRAS_XML_ARGS :=
|
SDK_EXTRAS_XML_ARGS :=
|
||||||
|
SDK_SYSIMG_DEPS :=
|
||||||
|
SDK_SYSIMG_XML_ARGS :=
|
||||||
|
|
||||||
# Define the name of a package zip file to generate
|
# Define the name of a package zip file to generate
|
||||||
# $1=OS (e.g. linux-x86, windows, etc)
|
# $1=OS (e.g. linux-x86, windows, etc)
|
||||||
@@ -97,17 +99,29 @@ endef
|
|||||||
# $4=package to create, must be "sources"
|
# $4=package to create, must be "sources"
|
||||||
#
|
#
|
||||||
define mk-sdk-repo-sources
|
define mk-sdk-repo-sources
|
||||||
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3) $(HOST_OUT)/development/sdk/source_source.properties
|
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3) development/build/tools/mk_sources_zip.py $(HOST_OUT)/development/sdk/source_source.properties
|
||||||
@echo "Building SDK sources package"
|
@echo "Building SDK sources package"
|
||||||
$(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py --exec-zip \
|
development/build/tools/mk_sources_zip.py --exec-zip \
|
||||||
$(HOST_OUT)/development/sdk/source_source.properties \
|
$(HOST_OUT)/development/sdk/source_source.properties \
|
||||||
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)) \
|
$$@ .
|
||||||
$(TOPDIR).
|
|
||||||
$(call dist-for-goals, sdk_repo, $(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) \
|
$(1) += $(4) $(2) \
|
||||||
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
|
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Defines the rule to build an XML file for a package.
|
||||||
|
#
|
||||||
|
# $1=output file
|
||||||
|
# $2=schema file
|
||||||
|
# $3=deps
|
||||||
|
# $4=args
|
||||||
|
define mk-sdk-repo-xml
|
||||||
|
$(1): $$(XMLLINT) development/build/tools/mk_sdk_repo_xml.sh $(2) $(3)
|
||||||
|
XMLLINT=$$(XMLLINT) development/build/tools/mk_sdk_repo_xml.sh $$@ $(2) $(4)
|
||||||
|
|
||||||
|
$$(call dist-for-goals,sdk_repo,$(1))
|
||||||
|
endef
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Rules for main host sdk
|
# Rules for main host sdk
|
||||||
|
|
||||||
@@ -158,19 +172,19 @@ endif
|
|||||||
SDK_REPO_XSD := \
|
SDK_REPO_XSD := \
|
||||||
$(lastword \
|
$(lastword \
|
||||||
$(wildcard \
|
$(wildcard \
|
||||||
$(TOPDIR)prebuilts/devtools/repository/sdk-repository-*.xsd \
|
prebuilts/devtools/repository/sdk-repository-*.xsd \
|
||||||
))
|
))
|
||||||
|
|
||||||
SDK_ADDON_XSD := \
|
SDK_ADDON_XSD := \
|
||||||
$(lastword \
|
$(lastword \
|
||||||
$(wildcard \
|
$(wildcard \
|
||||||
$(TOPDIR)prebuilts/devtools/repository/sdk-addon-*.xsd \
|
prebuilts/devtools/repository/sdk-addon-*.xsd \
|
||||||
))
|
))
|
||||||
|
|
||||||
SDK_SYSIMG_XSD := \
|
SDK_SYSIMG_XSD := \
|
||||||
$(lastword \
|
$(lastword \
|
||||||
$(wildcard \
|
$(wildcard \
|
||||||
$(TOPDIR)prebuilts/devtools/repository/sdk-sys-img-*.xsd \
|
prebuilts/devtools/repository/sdk-sys-img-*.xsd \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
@@ -192,11 +206,10 @@ $(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_ZIP))
|
|||||||
|
|
||||||
SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml
|
SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml
|
||||||
|
|
||||||
$(SDK_ADDON_XML): $(ADDON_SDK_ZIP)
|
$(eval $(call mk-sdk-repo-xml,$(SDK_ADDON_XML),$(SDK_ADDON_XSD),$(ADDON_SDK_ZIP),add-on $(HOST_OS) $(RENAMED_ADDON_ZIP)))
|
||||||
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
|
|
||||||
$(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP)
|
|
||||||
|
|
||||||
$(call dist-for-goals, sdk_repo, $(SDK_ADDON_XML))
|
SDK_ADDON_XML :=
|
||||||
|
RENAMED_ADDON_ZIP :=
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -212,11 +225,10 @@ $(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_IMG_ZIP))
|
|||||||
|
|
||||||
SDK_ADDON_IMG_XML := $(dir $(ADDON_SDK_ZIP))/addon-sys-img.xml
|
SDK_ADDON_IMG_XML := $(dir $(ADDON_SDK_ZIP))/addon-sys-img.xml
|
||||||
|
|
||||||
$(SDK_ADDON_IMG_XML): $(ADDON_SDK_IMG_ZIP)
|
$(eval $(call mk-sdk-repo-xml,$(SDK_ADDON_IMG_XML),$(SDK_SYSIMG_XSD),$(ADDON_SDK_IMG_ZIP),system-image $(HOST_OS) $(RENAMED_ADDON_IMG_ZIP)))
|
||||||
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
|
|
||||||
$(SDK_ADDON_IMG_XML) $(SDK_SYSIMG_XSD) system-image $(HOST_OS) $(RENAMED_ADDON_IMG_ZIP)
|
|
||||||
|
|
||||||
$(call dist-for-goals, sdk_repo, $(SDK_ADDON_IMG_XML))
|
SDK_ADDON_IMG_XML :=
|
||||||
|
RENAMED_ADDON_IMG_ZIP :=
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -229,51 +241,42 @@ SDK_EXTRAS_XML := $(MAIN_SDK_DIR)/repo-extras.xml
|
|||||||
SDK_SYSIMG_XML := $(MAIN_SDK_DIR)/repo-sys-img.xml
|
SDK_SYSIMG_XML := $(MAIN_SDK_DIR)/repo-sys-img.xml
|
||||||
|
|
||||||
ifneq ($(SDK_REPO_XML_ARGS),)
|
ifneq ($(SDK_REPO_XML_ARGS),)
|
||||||
|
$(eval $(call mk-sdk-repo-xml,$(SDK_REPO_XML),$(SDK_REPO_XSD),$(SDK_REPO_DEPS),$(SDK_REPO_XML_ARGS)))
|
||||||
$(SDK_REPO_XML): $(SDK_REPO_DEPS)
|
|
||||||
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
|
|
||||||
$(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS)
|
|
||||||
|
|
||||||
$(call dist-for-goals, sdk_repo, $(SDK_REPO_XML))
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
SDK_REPO_XML :=
|
||||||
$(SDK_REPO_XML): ;
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(SDK_EXTRAS_XML_ARGS),)
|
ifneq ($(SDK_EXTRAS_XML_ARGS),)
|
||||||
|
$(eval $(call mk-sdk-repo-xml,$(SDK_EXTRAS_XML),$(SDK_ADDON_XSD),$(SDK_EXTRAS_DEPS),$(SDK_EXTRAS_XML_ARGS)))
|
||||||
$(SDK_EXTRAS_XML): $(SDK_EXTRAS_DEPS)
|
|
||||||
$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
|
|
||||||
$(SDK_EXTRAS_XML) $(SDK_ADDON_XSD) $(SDK_EXTRAS_XML_ARGS)
|
|
||||||
|
|
||||||
$(call dist-for-goals, sdk_repo, $(SDK_EXTRAS_XML))
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
SDK_EXTRAS_XML :=
|
||||||
$(SDK_EXTRAS_XML): ;
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(SDK_SYSIMG_XML_ARGS),)
|
ifneq ($(SDK_SYSIMG_XML_ARGS),)
|
||||||
|
$(eval $(call mk-sdk-repo-xml,$(SDK_SYSIMG_XML),$(SDK_SYSIMG_XSD),$(SDK_SYSIMG_DEPS),$(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
|
else
|
||||||
|
SDK_SYSIMG_XML :=
|
||||||
$(SDK_SYSIMG_XML): ;
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) $(SDK_EXTRAS_XML) $(SDK_SYSIMG_XML)
|
sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) $(SDK_EXTRAS_XML) $(SDK_SYSIMG_XML)
|
||||||
@echo "Packing of SDK repository done"
|
|
||||||
|
|
||||||
|
SDK_REPO_DEPS :=
|
||||||
|
SDK_REPO_XML :=
|
||||||
|
SDK_REPO_XML_ARGS :=
|
||||||
|
SDK_EXTRAS_DEPS :=
|
||||||
|
SDK_EXTRAS_XML :=
|
||||||
|
SDK_EXTRAS_XML_ARGS :=
|
||||||
|
SDK_SYSIMG_DEPS :=
|
||||||
|
SDK_SYSIMG_XML :=
|
||||||
|
SDK_SYSIMG_XML_ARGS :=
|
||||||
|
|
||||||
|
mk-sdk-repo-pkg-1 :=
|
||||||
|
mk-sdk-repo-pkg-2 :=
|
||||||
|
mk-sdk-repo-pkg-3 :=
|
||||||
|
mk-sdk-repo-sources :=
|
||||||
|
mk-sdk-repo-xml :=
|
||||||
|
sdk-repo-pkg-zip :=
|
||||||
|
|||||||
Reference in New Issue
Block a user