Debian - Maven build.
authorroubert@google.com <roubert@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 22 Aug 2014 14:44:19 +0000 (14:44 +0000)
committerroubert@google.com <roubert@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 22 Aug 2014 14:44:19 +0000 (14:44 +0000)
This adapts the Debian package to build all the Java tools and the
library just using Maven, not using Ant any more.

This depends on the patch submitted earlier in the email titled "build
the tools and libraries all at once with Maven"

Author: daniel@pocock.pro

R=jia.shao.peng@gmail.com
BUG=

Review URL: https://codereview.appspot.com/126430044

git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@688 ee073f10-1060-11df-b6a4-87a95322a99c

debian/control
debian/libphonenumber6-java.poms [new file with mode: 0644]
debian/maven.cleanIgnoreRules [new file with mode: 0644]
debian/maven.ignoreRules [new file with mode: 0644]
debian/maven.properties [new file with mode: 0644]
debian/maven.publishedRules [new file with mode: 0644]
debian/maven.rules [new file with mode: 0644]
debian/patches/0003-maven-exclude-demo.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules
debian/source/format

index a850966..7492220 100644 (file)
@@ -2,13 +2,10 @@ Source: libphonenumber
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
 Uploaders: Daniel Pocock <daniel@pocock.pro>, Fredrik Roubert <roubert@google.com>
-Build-Depends: ant,
-               ant-optional,
+Build-Depends: cdbs,
                cmake,
                debhelper (>= 9),
                default-jdk | java-sdk,
-               javahelper (>= 0.34),
-               junit,
                libboost-dev (>= 1.40),
                libboost-system-dev (>= 1.40),
                libboost-thread-dev (>= 1.40),
@@ -16,13 +13,38 @@ Build-Depends: ant,
                libicu-dev (>= 4.4),
                libprotobuf-dev (>= 2.4),
                libre2-dev,
-               protobuf-compiler
+               maven-debian-helper (>= 1.5),
+               protobuf-compiler,
+               default-jdk-doc,
+               junit4,
+               libbuild-helper-maven-plugin-java,
+               libmaven-antrun-plugin-java,
+               libmaven-assembly-plugin-java,
+               libmaven-compiler-plugin-java,
+               libmaven-exec-plugin-java,
+               libmaven-jar-plugin-java,
+               libmaven-javadoc-plugin-java,
+               libmaven-war-plugin-java,
+               libprotobuf-java,
+               libservlet2.5-java,
+               libservlet2.5-java-doc
 Standards-Version: 3.9.5
 Section: libs
 Homepage: http://code.google.com/p/libphonenumber/
 Vcs-Browser: http://code.google.com/p/libphonenumber/source/browse/
 Vcs-Svn: http://libphonenumber.googlecode.com/svn/trunk/
 
+Package: libphonenumber6-java
+Section: java
+Architecture: all
+Depends: ${misc:Depends}, ${maven:Depends}
+Recommends: ${maven:OptionalDepends}
+Description: parsing/formatting/validating phone numbers - java
+ Google's common C++ and Java library for parsing, formatting, storing and
+ validating international phone numbers.
+ .
+ This package contains the runtime library JARs for Java users.
+
 Package: libphonenumber6-dev
 Section: libdevel
 Architecture: any
@@ -45,13 +67,3 @@ Description: parsing/formatting/validating phone numbers
  validating international phone numbers.
  .
  This package contains the runtime libraries for C++ users.
-
-Package: libphonenumber6-java
-Section: java
-Architecture: all
-Depends: ${java:Depends}, ${misc:Depends}
-Description: parsing/formatting/validating phone numbers - java
- Google's common C++ and Java library for parsing, formatting, storing and
- validating international phone numbers.
- .
- This package contains the runtime library JARs for Java users.
diff --git a/debian/libphonenumber6-java.poms b/debian/libphonenumber6-java.poms
new file mode 100644 (file)
index 0000000..8108894
--- /dev/null
@@ -0,0 +1,39 @@
+# List of POM files for the package
+# Format of this file is:
+# <path to pom file> [option]*
+# where option can be:
+#   --ignore: ignore this POM and its artifact if any
+#   --ignore-pom: don't install the POM. To use on POM files that are created
+#     temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms]
+#   --no-parent: remove the <parent> tag from the POM
+#   --package=<package>: an alternative package to use when installing this POM
+#      and its artifact
+#   --has-package-version: to indicate that the original version of the POM is the same as the upstream part
+#      of the version for the package.
+#   --keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM
+#      during a clean operation with mh_cleanpom or mh_installpom
+#   --artifact=<path>: path to the build artifact associated with this POM,
+#      it will be installed when using the command mh_install. [mh_install]
+#   --java-lib: install the jar into /usr/share/java to comply with Debian
+#      packaging guidelines
+#   --usj-name=<name>: name to use when installing the library in /usr/share/java
+#   --usj-version=<version>: version to use when installing the library in /usr/share/java
+#   --no-usj-versionless: don't install the versionless link in /usr/share/java
+#   --dest-jar=<path>: the destination for the real jar.
+#     It will be installed with mh_install. [mh_install]
+#   --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.
+#   --site-xml=<location>: Optional, the location for site.xml if it needs to be installed.
+#     Empty by default. [mh_install]
+#
+pom.xml
+tools/java/pom.xml
+tools/java/common/pom.xml
+tools/java/cpp-build/pom.xml
+tools/java/data/pom.xml
+tools/java/java-build/pom.xml
+java/pom.xml
+java/libphonenumber/pom.xml --java-lib
+java/internal/prefixmapper/pom.xml --java-lib
+java/carrier/pom.xml --java-lib
+java/geocoder/pom.xml --java-lib
+java/demo/pom.xml --ignore
diff --git a/debian/maven.cleanIgnoreRules b/debian/maven.cleanIgnoreRules
new file mode 100644 (file)
index 0000000..d9825b6
--- /dev/null
@@ -0,0 +1,17 @@
+# Maven clean ignore rules - ignore some Maven dependencies and plugins
+# during the clean phase of a Maven build
+# Format of this file is:
+# [group] [artifact] [type] [version] [classifier] [scope]
+# where each element can be either
+# - the exact string, for example org.apache for the group, or 3.1
+#   for the version. In this case, the element is simply matched
+#   and left as it is
+# - * (the star character, alone). In this case, anything will
+#   match and be left as it is. For example, using * on the
+#  position of the artifact field will match any artifact id
+# All elements much match before a rule can be applied
+# Example rule: match jar with groupid= junit, artifactid= junit
+# and version starting with 3., this dependency is then removed
+# from the POM before mvn clean is called
+#   junit junit jar s/3\..*/3.x/
+
diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules
new file mode 100644 (file)
index 0000000..835f560
--- /dev/null
@@ -0,0 +1,23 @@
+# Maven ignore rules - ignore some Maven dependencies and plugins
+# Format of this file is:
+# [group] [artifact] [type] [version] [classifier] [scope]
+# where each element can be either
+# - the exact string, for example org.apache for the group, or 3.1
+#   for the version. In this case, the element is simply matched
+#   and left as it is
+# - * (the star character, alone). In this case, anything will
+#   match and be left as it is. For example, using * on the
+#  position of the artifact field will match any artifact id
+# All elements much match before a rule can be applied
+# Example rule: match jar with groupid= junit, artifactid= junit
+# and version starting with 3., this dependency is then removed
+# from the POM
+#   junit junit jar s/3\..*/3.x/
+
+net.kindleit maven-gae-plugin * * * *
+org.apache.maven.plugins maven-assembly-plugin * * * *
+org.apache.maven.plugins maven-javadoc-plugin * * * *
+org.apache.maven.plugins maven-release-plugin * * * *
+org.apache.maven.plugins maven-source-plugin * * * *
+org.mortbay.jetty maven-jetty-plugin * * * *
+org.sonatype.oss oss-parent * * * *
diff --git a/debian/maven.properties b/debian/maven.properties
new file mode 100644 (file)
index 0000000..7c29bd7
--- /dev/null
@@ -0,0 +1,4 @@
+# Include here properties to pass to Maven during the build.
+# For example:
+# maven.test.skip=true
+
diff --git a/debian/maven.publishedRules b/debian/maven.publishedRules
new file mode 100644 (file)
index 0000000..77aa245
--- /dev/null
@@ -0,0 +1,19 @@
+# Maven published rules - additional rules to publish, to help
+# the packaging work of Debian maintainers using mh_make
+# Format of this file is:
+# [group] [artifact] [type] [version] [classifier] [scope]
+# where each element can be either
+# - the exact string, for example org.apache for the group, or 3.1
+#   for the version. In this case, the element is simply matched
+#   and left as it is
+# - * (the star character, alone). In this case, anything will
+#   match and be left as it is. For example, using * on the
+#  position of the artifact field will match any artifact id
+# - a regular expression of the form s/match/replace/
+#   in this case, elements that match are transformed using
+#   the regex rule.
+# All elements much match before a rule can be applied
+# Example rule: match jar with groupid= junit, artifactid= junit
+# and version starting with 3., replacing the version with 3.x
+#   junit junit jar s/3\..*/3.x/
+
diff --git a/debian/maven.rules b/debian/maven.rules
new file mode 100644 (file)
index 0000000..3c71dfa
--- /dev/null
@@ -0,0 +1,31 @@
+# Maven rules - transform Maven dependencies and plugins
+# Format of this file is:
+# [group] [artifact] [type] [version] [classifier] [scope]
+# where each element can be either
+# - the exact string, for example org.apache for the group, or 3.1
+#   for the version. In this case, the element is simply matched
+#   and left as it is
+# - * (the star character, alone). In this case, anything will
+#   match and be left as it is. For example, using * on the
+#  position of the artifact field will match any artifact id
+# - a regular expression of the form s/match/replace/
+#   in this case, elements that match are transformed using
+#   the regex rule.
+# All elements much match before a rule can be applied
+# Example rule: match jar with groupid= junit, artifactid= junit
+# and version starting with 3., replacing the version with 3.x
+#   junit junit jar s/3\..*/3.x/
+
+com.google.i18n.phonenumbers data-tools jar s/1\..*/1.x/ * *
+com.google.i18n.phonenumbers libphonenumber-build-parent pom s/1\..*/1.x/ * *
+com.google.i18n.phonenumbers tools pom s/1\..*/1.x/ * *
+com.google.i18n.phonenumbers.tools common-build jar s/1\..*/1.x/ * *
+com.google.i18n.phonenumbers.tools cpp-build jar s/1\..*/1.x/ * *
+com.google.i18n.phonenumbers.tools java-build jar s/1\..*/1.x/ * *
+com.googlecode.libphonenumber carrier jar s/1\..*/1.x/ * *
+com.googlecode.libphonenumber geocoder jar s/2\..*/2.x/ * *
+com.googlecode.libphonenumber libphonenumber-parent pom s/6\..*/6.x/ * *
+com.googlecode.libphonenumber libphonenumber jar s/6\..*/6.x/ * *
+com.googlecode.libphonenumber prefixmapper jar s/2\..*/2.x/ * *
+junit junit jar s/4\..*/4.x/ * *
+s/org.apache.tomcat/javax.servlet/ servlet-api jar s/.*/2.5/ * *
diff --git a/debian/patches/0003-maven-exclude-demo.patch b/debian/patches/0003-maven-exclude-demo.patch
new file mode 100644 (file)
index 0000000..1713f9a
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/java/pom.xml b/java/pom.xml
+index 4e7cdb5..eb68bcc 100644
+--- a/java/pom.xml
++++ b/java/pom.xml
+@@ -76,7 +76,7 @@
+     <module>internal/prefixmapper</module>
+     <module>carrier</module>
+     <module>geocoder</module>
+-    <module>demo</module>
++    <!--<module>demo</module>-->
+   </modules>
+
+   <build>
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..b2aab47
--- /dev/null
@@ -0,0 +1 @@
+0003-maven-exclude-demo.patch
index 8beed53..7e24879 100755 (executable)
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-ANT ?= ant
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/maven.mk
+
+JAVA_HOME := /usr/lib/jvm/default-java
+DEB_MAVEN_DOC_TARGET := javadoc:jar javadoc:aggregate
+
 CMAKE ?= cmake
-JAVA_HOME ?= /usr/lib/jvm/default-java
 
 CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/usr
 CPP_BUILD := cpp/build
@@ -45,31 +49,39 @@ ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
   MAKEFLAGS += -j$(NUMJOBS)
 endif
 
-%:
-       dh $@ --with javahelper
+#%:
+#      dh $@ --with javahelper
 
-override_dh_auto_configure:
+#override_dh_auto_configure:
+configure/libphonenumber6::
        mkdir -p $(CPP_BUILD) && cd $(CPP_BUILD) && $(CMAKE) $(CMAKE_FLAGS) ..
 
-override_dh_auto_build:
+#override_dh_auto_build:
+#      ( cd tools/java && $(MVN) package )
+#      mkdir java/lib
+#      ln -s /usr/share/java/junit4.jar java/lib/junit-4.8.1.jar
+#      $(ANT) -f $(JAVA_BUILD).xml jar
+build/libphonenumber6::
        $(MAKE) -C $(CPP_BUILD) phonenumber phonenumber-shared
-       $(ANT) -f $(JAVA_BUILD).xml jar
 
-override_dh_auto_test:
-ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
-       $(MAKE) -C $(CPP_BUILD) test
-       $(ANT) -f $(JAVA_BUILD).xml junit
-endif
+#override_dh_auto_test:
+#ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+#      $(MAKE) -C $(CPP_BUILD) test
+#      $(ANT) -f $(JAVA_BUILD).xml junit
+#endif
 
 # Hack for multiarch: CMake doesn't really support libdir so we just manually
 # move /usr/lib/* to a proper multiarch location.
-override_dh_auto_install:
+#override_dh_auto_install:
+common-install-arch::
        dh_auto_install --builddirectory=$(CPP_BUILD)
        mkdir -p debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH)
        mv debian/tmp/usr/lib/* debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH)
        mv debian/tmp/usr/lib-$(DEB_HOST_MULTIARCH) \
                debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
 
-override_dh_auto_clean:
+#override_dh_auto_clean:
+clean::
        -test -d $(CPP_BUILD) && $(MAKE) -C $(CPP_BUILD) clean
-       -$(ANT) -f $(JAVA_BUILD).xml clean
+       #-$(ANT) -f $(JAVA_BUILD).xml clean
+       #-( cd tools/java && $(MVN) clean )
index 89ae9db..163aaf8 100644 (file)
@@ -1 +1 @@
-3.0 (native)
+3.0 (quilt)