<ant antfile="services/build.xml" target="gen_ddl" inheritAll="false" />\r
</target>\r
\r
- <target name="create_db" depends="create_db-unix,create_db-windows" description="create database(s), invoke subtasks for indexes, etc.">\r
+ <!--\r
+ Top-level target to create (or recreate) CollectionSpace related databases. Checks the \r
+ 'recreate_db' property or environment variable.\r
+ -->\r
+ <target name="create_db" depends="-create_db, -create_db_erase, -create_db_warn"\r
+ description="Creates or recreates CollectionSpace database(s), invoke subtasks for indexes, etc.">\r
+ </target>\r
+ \r
+ <!--\r
+ This target sets the Ant property 'create_db.recreate' based on the value of the Ant environment variable 'recreate_db'\r
+ and the command line property 'recreate_db'. A command line value of 'true' for the 'recreate_db' property will override\r
+ the environment variable 'recreate_db' value.\r
+ \r
+ If the environment variable 'recreate_db' is set to true then the Ant property 'create_db.recreate' will get set to true; otherwise,\r
+ it will get set to the current value of the Ant property 'recreate_db' -which will be null if not set on the command line.\r
+ -->\r
+ <target name="-create_db">\r
+ <property environment="env"/>\r
+ <condition property="create_db.recreate" else="${recreate_db}" value="true">\r
+ <equals arg1="${env.recreate_db}" arg2="true"/>\r
+ </condition>\r
+ </target> \r
+\r
+ <!--\r
+ This target sends the 'create_nuxeo_db' and 'create_nuxeo_db' targets to all the Ant sub-modules/directories\r
+ -->\r
+ <target name="-create_db_erase" if="${create_db.recreate}" depends="create_db-unix, create_db-windows">\r
<antcall target="create_nuxeo_db" />\r
<antcall target="create_cspace_db" />\r
</target>\r
\r
+ <!--\r
+ Outputs a warning to the user that existing CollectionSpace databases will be replaced/overridden.\r
+ -->\r
+ <target name="-create_db_warn" unless="${create_db.recreate}">\r
+ <echo message="*** WARNING! This target will delete any and all existing CollectionSpace databases."/>\r
+ <echo message="*** WARNING! You must set the Ant recreate_db property to 'true' to invoke this target."/>\r
+ <echo message="*** WARNING! For example,"/>\r
+ <echo message="*** WARNING!"/>\r
+ <echo message="*** WARNING! 'ant create_db -Drecreate_db=true'."/>\r
+ <echo message="*** WARNING!"/>\r
+ <echo message="*** WARNING! Optionally, you can set an environment variable named recreate_db=true as well."/>\r
+ <fail message="*** ERROR - Ant property 'recreate_db' was not set to 'true'. See warning messages above."/>\r
+ </target> \r
+\r
<target name="create_db-unix" if="osfamily-unix">\r
<exec executable="mvn" failonerror="true">\r
<arg value="validate" /> <!-- Ensure proper env vars are set -->\r
<arg value="${mvn.opts}" />\r
</exec>\r
</target>\r
+ \r
<target name="create_db-windows" if="osfamily-windows">\r
<exec executable="cmd" failonerror="true">\r
<arg value="/c" />\r