summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-08 01:28:08 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-08 01:28:08 -0400
commit9b89cd1b21280111a87aced6e6c857a8d0b69664 (patch)
tree1601df82486ab137a1ae5d9811b580150ba5a903
parent7c4de79ba6f95d88a7adde236aac52f38a94bdd1 (diff)
Add cal10n, and make required changes to generic/Makefile.
This means handling resources in a manner more similar to actual maven.
-rw-r--r--conf/dependencies.mk3
-rw-r--r--conf/sources.mk1
-rw-r--r--rules/cal10n/subdir-deps.mk4
-rw-r--r--rules/generic/Makefile34
4 files changed, 30 insertions, 12 deletions
diff --git a/conf/dependencies.mk b/conf/dependencies.mk
index a6c3356..8252d38 100644
--- a/conf/dependencies.mk
+++ b/conf/dependencies.mk
@@ -98,6 +98,9 @@ build/packages/aether-core-bootstrap: \
$(dep-jsr330) \
build/packages/httpcomponents-core \
build/packages/httpcomponents-client-bootstrap
+build/packages/cal10n: \
+ build/packages/maven-artifact-bootstrap \
+ build/packages/maven-plugin-api-bootstrap
build/packages/guava: \
$(dep-jsr305)
build/packages/qdox: \
diff --git a/conf/sources.mk b/conf/sources.mk
index 6ef3f2f..fc720fd 100644
--- a/conf/sources.mk
+++ b/conf/sources.mk
@@ -25,6 +25,7 @@ plexus-container-default = git|git://github.com/sonatype/ple
aether-core-bootstrap = git|git://git.eclipse.org/gitroot/aether/aether-core.git|aether-1.0.0.v20140518
+cal10n = git|git://github.com/qos-ch/cal10n.git|v_0.8.1
guava = git|https://code.google.com/p/guava-libraries/|v17.0/guava
qdox = tar|http://nexus.codehaus.org/content/repositories/releases/com/thoughtworks/qdox/qdox/2.0-M1/qdox-2.0-M1-project.tar.bz2
commons-cli = tar|$(_apache_mirror)/commons/cli/source/commons-cli-1.2-src.tar.gz
diff --git a/rules/cal10n/subdir-deps.mk b/rules/cal10n/subdir-deps.mk
new file mode 100644
index 0000000..5830ddd
--- /dev/null
+++ b/rules/cal10n/subdir-deps.mk
@@ -0,0 +1,4 @@
+JAVAC += -encoding ISO-8859-1
+
+maven-cal10n-plugin-smoke_deps = cal10n-api
+maven-cal10n-plugin_deps = cal10n-api
diff --git a/rules/generic/Makefile b/rules/generic/Makefile
index b80fc50..a7a0309 100644
--- a/rules/generic/Makefile
+++ b/rules/generic/Makefile
@@ -5,24 +5,29 @@ DESTDIR ?=
MAVEN_LOCAL_REPO ?= ~/.m2
# Utilities
-XMLSTARLET = xml
+CP = cp
+ECHO = echo
FAIL = exit 1
FIND = find
-JAVAC = javac
INSTALL = install
+JAR = jar
+JAVAC = javac
MKDIRS = mkdir -p
+PRINTF = printf
RM = rm -f
-JAR = jar
-CP = cp
+XMLSTARLET = xml
# Detect information from POMs
artifactId := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:artifactId -n pom.xml)
version := $(firstword $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:version -n -c /_:project/_:parent/_:version pom.xml) $(version))
groupId := $(firstword $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:groupId -n -c /_:project/_:parent/_:groupId pom.xml))
+
sourceDirectory := $(firstword $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:build/_:sourceDirectory -n pom.xml) $(sourceDirectory) src/main/java)
+resources := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:build/_:resources -n pom.xml)
+resources := $(if $(resources),$(resources),src/main/resources)
subdirs = $(patsubst %/pom.xml,%,$(wildcard */pom.xml))
-targets = pom $(if $(wildcard src/main/ $(sourceDirectory)),jar)
+targets = pom $(if $(wildcard src/main/ $(sourceDirectory) $(resources)),jar)
$(if $(extra_makefiles),$(eval include $(extra_makefiles)))
@@ -46,20 +51,19 @@ target/$(artifactId)-$(version).jar: %.jar: %
target/$(artifactId)-$(version): %: \
target/META-INF/maven/$(groupId)/$(artifactId)/pom.properties \
target/META-INF/maven/$(groupId)/$(artifactId)/pom.xml \
- $(call dep_dir,target/classes) \
- $(call dep_optdir,src/main/resources)
+ $(call dep_dir,target/classes)
$(RM) -r $@
$(MKDIRS) $@
- $(CP) -r target/META-INF $(wildcard target/classes/* src/main/resources/*) $@
+ $(CP) -r target/META-INF $(wildcard target/classes/*) $@
target/META-INF/maven/$(groupId)/$(artifactId)/pom.xml: pom.xml
- install -Dm644 $< $@
+ $(INSTALL) -Dm644 $< $@
# That is almost the default date format for locale=C, but the DOM is
# 0-padded instead of space-padded.
target/META-INF/maven/$(groupId)/$(artifactId)/pom.properties: pom.xml
$(MKDIRS) $(@D)
- printf '%s\n' \
+ $(PRINTF) '%s\n' \
'#Generated by Make' \
"#$$(LC_ALL=C date '+%a %b %d %H:%M:%S %Z %Y')" \
'version=$(version)' \
@@ -67,9 +71,15 @@ target/META-INF/maven/$(groupId)/$(artifactId)/pom.properties: pom.xml
'artifactId=$(artifactId)' \
> $@
-target/classes: $(call dep_optdir,$(sourceDirectory))
+exec_nonempty_q = $(if $(strip $1),@$(ECHO) $2; $(subst {},$1,$2))
+exec_nonempty_v = $(if $(strip $1),$(subst {},$1,$2))
+# Maven puts `target/classes` in the classpath, but that's unnecessary
+# here, as we don't do incremental/segmented compilation.
+target/classes: $(call dep_optdir,$(sourceDirectory) $(resources))
+ $(RM) -r $@
$(MKDIRS) $@
- @echo $(JAVAC) -d $@ ...; $(if $^,$(JAVAC) -d $@ $(filter %.java,$^) || { $(RM) -r $@; $(FAIL); })
+ $(call exec_nonempty_q,$(wildcard $(addsuffix /*,$(resources))),$(CP) -r {} $@ || { $(RM) -r $@; $(FAIL); })
+ $(call exec_nonempty_q,$(filter %.java,$^) ,$(JAVAC) -d $@ {} || { $(RM) -r $@; $(FAIL); })
# install