From 982748df45f460cbfae8e1b32c4f532f9d2e2389 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" <dvelasco@solidgear.es> Date: Wed, 9 Apr 2014 12:17:15 +0200 Subject: [PATCH] Added Ant custom rules to overwrite setup.xml values from environment variables --- test_client/custom_rules.xml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test_client/custom_rules.xml diff --git a/test_client/custom_rules.xml b/test_client/custom_rules.xml new file mode 100644 index 00000000..965385e0 --- /dev/null +++ b/test_client/custom_rules.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="custom_rules"> + <target name="-pre-build" > + <!-- Replace OC server URL if set in environment --> + <if> + <condition> + <isset property="env.OCTEST_SERVER_BASE_URL" /> + </condition> + <then> + <replaceregexp + file="res/values/setup.xml" + match='("server_base_url">)\s*(<)' + replace="\1${env.OCTEST_SERVER_BASE_URL}\2" + byline="true" /> + </then> + </if> + + <!-- Replace test username if set in environment --> + <if> + <condition> + <isset property="env.OCTEST_USERNAME" /> + </condition> + <then> + <echo>Setting username ${env.OC_TEST_USERNAME}</echo> + <replaceregexp + file="res/values/setup.xml" + match='("username">)\s*(<)' + replace="\1${env.OCTEST_USERNAME}\2" + byline="true" /> + </then> + </if> + + <!-- Replace test username if set in environment --> + <if> + <condition> + <isset property="env.OCTEST_PASSWORD" /> + </condition> + <then> + <replaceregexp + file="res/values/setup.xml" + match='("password">)\s*(<)' + replace="\1${env.OCTEST_PASSWORD}\2" + byline="true" /> + </then> + </if> + </target> +</project> \ No newline at end of file