cm: Modify maven artifact publish makefile.

Now allows you to specify a target module to be
  compiled prior to publish via LOCAL_MAVEN_TARGET_MODULE.

  This utilizes the definition for intermediates-dir-for on
  the target module after it sets an explicit dependency from
  remote to local module.

Change-Id: I65b5e07fdcc3368e350b1935ccca381b74dce59e
This commit is contained in:
Adnan Begovic 2016-01-05 14:13:30 -08:00 committed by Gerrit Code Review
parent 139e798bf9
commit 4198cf685f

View File

@ -20,30 +20,34 @@ endif
ifeq ($(strip $(LOCAL_MAVEN_REPO)),) ifeq ($(strip $(LOCAL_MAVEN_REPO)),)
$(error LOCAL_MAVEN_REPO not defined.) $(error LOCAL_MAVEN_REPO not defined.)
endif endif
ifeq ($(strip $(LOCAL_MAVEN_FILE_PATH)),) ifeq ($(strip $(LOCAL_MAVEN_TARGET_MODULE)),)
$(error LOCAL_MAVEN_FILE_PATH not defined.) $(error LOCAL_MAVEN_TARGET_MODULE not defined.)
endif endif
ifeq ($(strip $(LOCAL_MAVEN_REPO_ID)),) ifeq ($(strip $(LOCAL_MAVEN_REPO_ID)),)
$(error LOCAL_MAVEN_REPO_ID not defined.) $(error LOCAL_MAVEN_REPO_ID not defined.)
endif endif
$(full_target): pomfile := $(LOCAL_MAVEN_POM) $(full_target): pomfile := $(LOCAL_MAVEN_POM)
$(full_target): repo := $(LOCAL_MAVEN_REPO) $(full_target): repo := $(LOCAL_MAVEN_REPO)
$(full_target): path_to_file := $(LOCAL_MAVEN_FILE_PATH) $(full_target): path_to_file := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MAVEN_TARGET_MODULE),,COMMON)/javalib.jar
$(full_target): repoId := $(LOCAL_MAVEN_REPO_ID) $(full_target): repoId := $(LOCAL_MAVEN_REPO_ID)
$(full_target): classifier := $(LOCAL_MAVEN_CLASSIFIER) $(full_target): classifier := $(LOCAL_MAVEN_CLASSIFIER)
$(full_target): sources := $(LOCAL_MAVEN_SOURCES) $(full_target): sources := $(LOCAL_MAVEN_SOURCES)
$(full_target): javadoc := $(LOCAL_MAVEN_JAVADOC) $(full_target): javadoc := $(LOCAL_MAVEN_JAVADOC)
$(full_target): artifact_path := $(LOCAL_MAVEN_ARTIFACT_PATH)
$(full_target): artifact_path ?= $(basename $(path_to_file))
$(full_target): $(full_target): $(LOCAL_MAVEN_TARGET_MODULE) $(path_to_file) $(artifact_path) $(ACP)
@echo -e ${CL_GRN}"Renaming generated sdk javalib jar"${CL_RST}
$(hide) $(ACP) $(path_to_file) $(artifact_path)
@echo -e ${CL_GRN}"Publishing to Maven"${CL_RST}
$(hide) mvn -e -X gpg:sign-and-deploy-file \ $(hide) mvn -e -X gpg:sign-and-deploy-file \
-DpomFile=$(pomfile) \ -DpomFile=$(pomfile) \
-Durl=$(repo) \ -Durl=$(repo) \
-Dfile=$(path_to_file) \ -Dfile=$(artifact_path) \
-DrepositoryId=$(repoId) \ -DrepositoryId=$(repoId) \
-Dclassifier=$(classifier) \ -Dclassifier=$(classifier) \
-Dsources=$(sources) \ -Dsources=$(sources) \
-Djavadoc=$(javadoc) -Djavadoc=$(javadoc)
@echo -e ${CL_GRN}"Publishing:"${CL_RST}" $@" @echo -e ${CL_GRN}"Publishing:"${CL_RST}" $@"
$(LOCAL_MODULE) : $(full_target) $(LOCAL_MODULE): $(full_target)