summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-07-23 16:15:50 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-07-23 16:15:50 -0400
commita27a46e63efe2e3e77cd0accb21b55595051c6bd (patch)
tree87c358bafa43cfa1d5ae6c73ce4194289947e8af /rules
parentc63599f77c3c139abb3bb36a15888c5563e7b269 (diff)
generic: don't use such long variable names, also support compiler-plugin.
Diffstat (limited to 'rules')
-rw-r--r--rules/commons-lang2/encoding.mk2
-rw-r--r--rules/generic/Makefile31
2 files changed, 17 insertions, 16 deletions
diff --git a/rules/commons-lang2/encoding.mk b/rules/commons-lang2/encoding.mk
index 365809f..b2d3aca 100644
--- a/rules/commons-lang2/encoding.mk
+++ b/rules/commons-lang2/encoding.mk
@@ -1 +1 @@
-project.build.sourceEncoding = ISO-8859-1
+javac_encoding = ISO-8859-1
diff --git a/rules/generic/Makefile b/rules/generic/Makefile
index 7229a88..fa5e845 100644
--- a/rules/generic/Makefile
+++ b/rules/generic/Makefile
@@ -21,24 +21,25 @@ SED = sed
TOUCH = touch
XMLSTARLET = xml
-JAVAC_FLAGS += $(if $(maven.compiler.source),-source $(maven.compiler.source))
-JAVAC_FLAGS += $(if $(maven.compiler.target),-target $(maven.compiler.target))
-JAVAC_FLAGS += $(if $(project.build.sourceEncoding),-encoding $(project.build.sourceEncoding))
+JAVAC_FLAGS += $(if $(javac_source),-source $(javac_source))
+JAVAC_FLAGS += $(if $(javac_target),-target $(javac_target))
+JAVAC_FLAGS += $(if $(javac_encoding),-encoding $(javac_encoding))
# Detect information from POMs
-pom_get = $(shell $(XMLSTARLET) sel -T -t $(foreach xpath,$1, -c $(subst /,/_:,$(xpath)) -n) pom.xml)
+pom_get = $(shell $(XMLSTARLET) sel -T -t $(foreach xpath,$1, -v '$(subst /,/_:,$(xpath))' -n) pom.xml)
+plugin_conf = /project/build/plugins/plugin[./artifactId[text()="$1"]]/configuration/$2
-artifactId := $(call pom_get,/project/artifactId)
-version := $(firstword $(call pom_get,/project/version /project/parent/version) $(value version))
-groupId := $(firstword $(call pom_get,/project/groupId /project/parent/groupId))
+artifactId := $(call pom_get,/project/artifactId)
+version := $(firstword $(call pom_get,/project/version /project/parent/version) $(value version))
+groupId := $(firstword $(call pom_get,/project/groupId /project/parent/groupId))
-sourceDirectory := $(firstword $(call pom_get,/project/build/sourceDirectory ) $(value sourceDirectory) src/main/java )
-resources := $(firstword $(call pom_get,/project/build/resources ) $(value resources) src/main/resources)
-maven.compiler.source := $(firstword $(call pom_get,/project/properties/maven.compile.source \
- /project/properties/maven.compiler.source ) $(value maven_compiler_source) )
-maven.compiler.target := $(firstword $(call pom_get,/project/properties/maven.compile.target \
- /project/properties/maven.compiler.target ) $(value maven_compiler_target) )
-project.build.sourceEncoding := $(firstword $(call pom_get,/project/properties/project.build.sourceEncoding) $(value project_build_sourceEncoding) )
+sourceDirectory := $(firstword $(call pom_get,/project/build/sourceDirectory) $(value sourceDirectory) src/main/java )
+resources := $(firstword $(call pom_get,/project/build/resources ) $(value resources) src/main/resources)
+
+# The order of precidence with these isn't quite right, but it's rare that multiple are set.
+javac_source := $(firstword $(call pom_get,/project/properties/maven.compile.source /project/properties/maven.compiler.source $(call plugin_conf,maven-compiler-plugin,source) ) $(value javac_source))
+javac_target := $(firstword $(call pom_get,/project/properties/maven.compile.target /project/properties/maven.compiler.target $(call plugin_conf,maven-compiler-plugin,target) ) $(value javac_target))
+javac_encoding := $(firstword $(call pom_get,/project/properties/project.build.sourceEncoding $(call plugin_conf,maven-compiler-plugin,encoding)) $(value javac_encoding))
basedir = .
project.basedir = $(basedir)
@@ -47,7 +48,7 @@ targets = pom $(if $(wildcard src/main/ $(sourceDirectory) $(resources)
# Post-processing
-inherit_vars = version sourceDirectory resources maven.compiler.source maven.compiler.target project.build.sourceEncoding
+inherit_vars = version sourceDirectory resources javac_source javac_target javac_encoding
$(foreach var,$(inherit_vars),$(eval $(var) = $($(var))))
$(if $(extra_makefiles),$(eval include $(extra_makefiles)))