[Libreoffice-commits] core.git: bin/fake_pom.xml bin/mvn.py

David Ostrovsky david at ostrovsky.org
Sat Nov 2 11:06:53 CET 2013


 bin/fake_pom.xml |    6 +++++
 bin/mvn.py       |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

New commits:
commit 78e4b97a18a18f84c228de64fc48cee48138fbfe
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Sun Oct 27 20:32:40 2013 +0100

    Set up tool chain to install LO artifacts in Maven repositories
    
    Add <path_to_libo>/bin to your path.
    After full LO compile, the LO Java artifacts can be installed in the local
    Maven repository:
    
    mvn.py -a install -v 4.2.0 -s juh:jar:<path_to>/juh.jar
    mvn.py -a install -v 4.2.0 -s jurt:jar:<path_to>/jurt.jar
    mvn.py -a install -v 4.2.0 -s ridl:jar:<path_to>/ridl.jar
    mvn.py -a install -v 4.2.0 -s unoil:jar:<path_to>/unoil.jar
    
    With the artifacts installed this way, it is now possible
    to consume LO artifacts from custom pom.xml:
    
    [...]
      <properties>
        <LibreOffice-Version>4.2.0</LibreOffice-Version>
      </properties>
    [...]
      <dependencies>
        <dependency>
          <groupId>org.libreoffice</groupId>
          <artifactId>juh</artifactId>
          <version>${LibreOffice-Version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.libreoffice</groupId>
          <artifactId>jurt</artifactId>
          <version>${LibreOffice-Version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.libreoffice</groupId>
          <artifactId>ridl</artifactId>
          <version>${LibreOffice-Version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.libreoffice</groupId>
          <artifactId>unoil</artifactId>
          <version>${LibreOffice-Version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    
    Change-Id: I2ad982ae23c78242ed8f1ac4c88c6be424cc7a0d
    Reviewed-on: https://gerrit.libreoffice.org/6453
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/bin/fake_pom.xml b/bin/fake_pom.xml
new file mode 100644
index 0000000..50599f3
--- /dev/null
+++ b/bin/fake_pom.xml
@@ -0,0 +1,6 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.libreoffice</groupId>
+  <artifactId>LibreOffice-Maven</artifactId>
+  <version>1</version>
+</project>
diff --git a/bin/mvn.py b/bin/mvn.py
new file mode 100755
index 0000000..d5a1c9a
--- /dev/null
+++ b/bin/mvn.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function
+from optparse import OptionParser
+from os import path
+from sys import stderr
+try:
+  from subprocess import check_output
+except ImportError:
+  from subprocess import Popen, PIPE
+  def check_output(*cmd):
+    return Popen(*cmd, stdout=PIPE).communicate()[0]
+opts = OptionParser()
+opts.add_option('--repository', help='maven repository id')
+opts.add_option('--url', help='maven repository url')
+opts.add_option('-a', help='action (valid actions are: install,deploy)')
+opts.add_option('-v', help='libreoffice version')
+opts.add_option('-s', action='append', help='triplet of artifactId:type:path')
+
+args, ctx = opts.parse_args()
+if not args.v:
+  print('version is empty', file=stderr)
+  exit(1)
+
+common = [
+  '-DgroupId=org.libreoffice',
+  '-Dversion=%s' % args.v,
+]
+
+self = path.dirname(path.abspath(__file__))
+mvn = ['mvn', '--file', path.join(self, 'fake_pom.xml')]
+
+if 'install' == args.a:
+  cmd = mvn + ['install:install-file'] + common
+elif 'deploy' == args.a:
+  cmd = mvn + [
+    'deploy:deploy-file',
+    '-DrepositoryId=%s' % args.repository,
+    '-Durl=%s' % args.url,
+  ] + common
+else:
+  print("unknown action -a %s" % args.a, file=stderr)
+  exit(1)
+
+for spec in args.s:
+  artifact, packaging_type, src = spec.split(':')
+  try:
+    check_output(cmd + [
+      '-DartifactId=%s' % artifact,
+      '-Dpackaging=%s' % packaging_type,
+      '-Dfile=%s' % src,
+    ])
+  except Exception as e:
+    print('%s command failed: %s' % (args.a, e), file=stderr)
+    exit(1)


More information about the Libreoffice-commits mailing list