commit 6393e814f28545b011289b5ee29339ed80805f40
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Tue Apr 9 15:03:06 2013 +0200
Implement %mvn_config
macros.xmvn | 16 +++++++++++++
scripts/mvn-config | 48 +++++++++++++++++++++++++++++++++++++++++
scripts/xmvn_config_editor.sh | 7 +++++-
3 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/macros.xmvn b/macros.xmvn
index 0b7769b..9e0e332 100644
--- a/macros.xmvn
+++ b/macros.xmvn
@@ -82,6 +82,22 @@
%mvn_file mvn-file
+# %mvn_config - set XMvn configuration option
+#
+# Usage: %mvn_config <option> <value>
+#
+# This macro sets value of specified XMvn configuration option.
+#
+# Option is a sequence of slash-delimited XML node names that identify
+# XMvn configuration option, as in XMvn configuration reference; for
+# example: buildSettings/compilerSource.
+#
+# For information about available configuration options, see XMvn
+# configuration reference, available on XMvn website.
+#
+%mvn_config mvn-config
+
+
# %mvn_build - build Maven project
#
# Usage: %mvn_build [options]
diff --git a/scripts/mvn-config b/scripts/mvn-config
new file mode 100755
index 0000000..66c1cc2
--- /dev/null
+++ b/scripts/mvn-config
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+# Copyright (c) 2013 Red Hat, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name of Red Hat nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Mikolaj Izdebski <mizdebsk(a)redhat.com>
+
+if [ $# -ne 2 ]; then
+ echo "$0: Exactly 2 arguments are required." >&2
+ exit 1
+fi
+
+open=
+close=
+for node in $(sed "s|/| |g" <<<"${1}"); do
+ open="${open}<${node}>"
+ close="</${node}>${close}"
+done
+xml="${open}${2}${close}"
+
+. /usr/share/java-utils/xmvn_config_editor.sh
+_write_xmvn_config "%mvn_config macro" "$xml"
+exit 0
diff --git a/scripts/xmvn_config_editor.sh b/scripts/xmvn_config_editor.sh
index 76c4620..408e76d 100644
--- a/scripts/xmvn_config_editor.sh
+++ b/scripts/xmvn_config_editor.sh
@@ -56,7 +56,12 @@ _write_xmvn_config()
<configuration
xmlns="http://fedorahosted.org/xmvn/CONFIG/0.4.0">
EOF
- if [[ $# -eq 4 ]]; then
+ if [[ $# -eq 2 ]]; then
+ cat >>.xmvn/config.d/javapackages-config-$suffix.xml <<EOF
+ $2
+</configuration>
+EOF
+ elif [[ $# -eq 4 ]]; then
cat >>.xmvn/config.d/javapackages-config-$suffix.xml <<EOF
<$2>
<$3>