From ea326686fbb7357cd5b48a03177c407e048e67ee Mon Sep 17 00:00:00 2001 From: Chris Sarbora Date: Wed, 17 Jun 2015 16:29:56 -0700 Subject: [PATCH] Support downloading from Maven Change-Id: I94b8627a3bd15726cb4918b9a64b696f2a26e587 --- build/core/clear_vars.mk | 7 +++++ build/core/config.mk | 4 ++- build/core/maven_artifact.mk | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 build/core/maven_artifact.mk diff --git a/build/core/clear_vars.mk b/build/core/clear_vars.mk index 5b86d692..f996179b 100644 --- a/build/core/clear_vars.mk +++ b/build/core/clear_vars.mk @@ -2,3 +2,10 @@ #CM-specific variable clears # LOCAL_IGNORE_SUBDIR := + +LOCAL_MAVEN_GROUP := +LOCAL_MAVEN_ARTIFACT := +LOCAL_MAVEN_VERSION := +LOCAL_MAVEN_CLASSIFIER := +LOCAL_MAVEN_PACKAGING := +LOCAL_MAVEN_REPO := \ No newline at end of file diff --git a/build/core/config.mk b/build/core/config.mk index 41a63b00..d948789d 100644 --- a/build/core/config.mk +++ b/build/core/config.mk @@ -3,4 +3,6 @@ CM_SRC_SYSTEM_API_DIR := $(TOPDIR)vendor/cmsdk/system-api INTERNAL_CM_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/cm_public_api.txt INTERNAL_CM_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/cm_removed.txt INTERNAL_CM_PLATFORM_SYSTEM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/cm_system-api.txt -INTERNAL_CM_PLATFORM_SYSTEM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/cm_system-removed.txt \ No newline at end of file +INTERNAL_CM_PLATFORM_SYSTEM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/cm_system-removed.txt + +BUILD_MAVEN_PREBUILT := $(TOP)/vendor/cm/build/core/maven_artifact.mk diff --git a/build/core/maven_artifact.mk b/build/core/maven_artifact.mk new file mode 100644 index 00000000..2666b9c8 --- /dev/null +++ b/build/core/maven_artifact.mk @@ -0,0 +1,50 @@ +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(strip $(LOCAL_MAVEN_GROUP)),) + $(error LOCAL_MAVEN_GROUP not defined.) +endif +ifeq ($(strip $(LOCAL_MAVEN_ARTIFACT)),) + $(error LOCAL_MAVEN_ARTIFACT not defined.) +endif +ifeq ($(strip $(LOCAL_MAVEN_VERSION)),) + $(error LOCAL_MAVEN_VERSION not defined.) +endif +ifeq ($(strip $(LOCAL_MAVEN_REPO)),) + $(error LOCAL_MAVEN_REPO not defined.) +endif +ifeq ($(strip $(LOCAL_MAVEN_PACKAGING)),) + LOCAL_MAVEN_PACKAGING := jar +endif + +artifact_filename := $(LOCAL_MAVEN_GROUP).$(LOCAL_MAVEN_ARTIFACT)-$(LOCAL_MAVEN_VERSION)$(if $(LOCAL_MAVEN_CLASSIFIER),-$(LOCAL_MAVEN_CLASSIFIER)).$(LOCAL_MAVEN_PACKAGING) + +LOCAL_PREBUILT_MODULE_FILE := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),,COMMON)/$(artifact_filename) + +$(LOCAL_PREBUILT_MODULE_FILE): specifier := $(LOCAL_MAVEN_GROUP):$(LOCAL_MAVEN_ARTIFACT):$(LOCAL_MAVEN_VERSION):$(LOCAL_MAVEN_PACKAGING)$(if $(LOCAL_MAVEN_CLASSIFIER),:$(LOCAL_MAVEN_CLASSIFIER)) +$(LOCAL_PREBUILT_MODULE_FILE): repo := $(LOCAL_MAVEN_REPO) +$(LOCAL_PREBUILT_MODULE_FILE): + @mvn -q dependency:get dependency:copy \ + -DremoteRepositories=central::::$(repo) \ + -Dartifact=$(specifier) \ + -DoutputDirectory=$(dir $@) \ + -Dmdep.prependGroupId=true \ + -Dmdep.overWriteSnapshots=true \ + -Dmdep.overWriteReleases=true + @echo -e ${CL_GRN}"Download:"${CL_RST}" $@" + +include $(BUILD_PREBUILT) + +# the "fetchprebuilts" target will go through and pre-download all of the maven dependencies in the tree +fetchprebuilts: $(LOCAL_PREBUILT_MODULE_FILE) \ No newline at end of file