-<project name="react.ui" default="package" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
+<project name="cspace.ui" default="package" xmlns:if="ant:if" xmlns:unless="ant:unless">
<description>
- CollectionSpace UI Component build
+ CollectionSpace UI
</description>
+ <macrodef name="propertycopy">
+ <attribute name="name"/>
+ <attribute name="from"/>
+ <sequential>
+ <property name="@{name}" value="${@{from}}"/>
+ </sequential>
+ </macrodef>
+
+ <scriptdef name="uppercase" language="javascript">
+ <attribute name="property" />
+ <attribute name="string" />
+
+ project.setProperty(attributes.get("property"), attributes.get("string").toUpperCase());
+ </scriptdef>
+
<!-- set global properties for this build -->
<property name="services.trunk" value=".."/>
- <!-- Enviornment should be declared before reading build.properties -->
+ <!-- Environment should be declared before reading build.properties -->
<property environment="env" />
<property file="${services.trunk}/build.properties" />
- <!--
- Properties set in this file will override all corresponding <property> definitions
- made in this Ant file.
- -->
- <property file="${jee.server.cspace}/primary.tenant.properties" />
- <property name="primary.profile.plugin.enabled" value="${env.CSPACE_PRIMARY_UIPLUGIN}"/>
-
- <!--
- #
- # Default tenant ID's for profiles - You can override these values in the "primary.tenant.properties" file at
- # the top-level directory of the tomcat deployment location.
- #
- -->
- <property name="cspace.profile.core.default.id" value="1"/>
- <property name="cspace.profile.testsci.default.id" value="2"/>
- <property name="cspace.profile.anthro.default.id" value="1500"/>
- <property name="cspace.profile.publicart.default.id" value="5000"/>
- <property name="cspace.profile.bonsai.default.id" value="3000"/>
- <property name="cspace.profile.botgarden.default.id" value="3500"/>
- <property name="cspace.profile.fcart.default.id" value="1000"/>
- <property name="cspace.profile.herbarium.default.id" value="4000"/>
- <property name="cspace.profile.lhmc.default.id" value="501"/>
- <property name="cspace.profile.materials.default.id" value="2000"/>
-
- <condition property="osfamily-unix">
- <os family="unix" />
- </condition>
- <condition property="osfamily-windows">
- <os family="windows" />
- </condition>
-
- <target name="package" depends="deploy">
- </target>
-
- <!--
- Set all the values for a single/primary tenant deployment
- -->
- <target name="set_primary" if="${primary.profile.plugin.enabled}">
- <echo>Setting primary vars</echo>
- <echo>The value of primary.profile.plugin.name is ${primary.profile.plugin.name}</echo>
- <property name="primary.profile.plugin.name" value="${env.CSPACE_PRIMARY_UIPLUGIN_NAME}" />
- <!--
- <condition property="primary.profile.plugin.name" value="${env.CSPACE_PRIMARY_UIPLUGIN_NAME}">
- <not>
- <isset property="primary.profile.plugin.name"/>
- </not>
- </condition>
- -->
- <echo>The value of primary.profile.plugin.name is ${primary.profile.plugin.name}</echo>
-
-
- <property name="primary.profile.plugin.version" value="${env.CSPACE_PRIMARY_UIPLUGIN_VERSION}" />
- <property name="primary.profile.plugin.package" value="${env.CSPACE_PRIMARY_UIPLUGIN_PACKAGE}" />
- <property name="primary.profile.plugin.dir" value="${env.CSPACE_PRIMARY_UIPLUGIN_DIR}" />
- <property name="primary.profile.plugin.basename" value="${env.CSPACE_PRIMARY_UIPLUGIN_BASENAME}" />
- <property name="primary.profile.plugin.tenantid" value="${env.CSPACE_PRIMARY_UIPLUGIN_TENANTID}" />
- <property name="primary.profile.plugin.message.title" value="${env.CSPACE_PRIMARY_UIPLUGIN_TITLE_MESSAGE}" />
- <property name="primary.profile.plugin.message.about" value="${env.CSPACE_PRIMARY_UIPLUGIN_ABOUT_MESSAGE}" />
- <property name="primary.profile.plugin.logo" value="${env.CSPACE_PRIMARY_UIPLUGIN_LOGO}" />
-
- <!-- Derived from the other props -->
- <property name="primary.profile.plugin.js" value="${primary.profile.plugin.name}@${primary.profile.plugin.version}.min.js" />
-
- <!-- Set the logo URL value base on the env var CSPACE_PRIMARY_UIPLUGIN_LOGO value.
- #
- # Use empty string or "undefined" for default logo, a full URL to an image file, or a partial URL path to a local image resource
- # Ex #1:
- # export CSPACE_PRIMARY_UIPLUGIN_LOGO=""
- # Ex #2
- # export CSPACE_PRIMARY_UIPLUGIN_LOGO="http://mydomain.com/myimage.png"
- # Ex #3
- # export CSPACE_PRIMARY_UIPLUGIN_LOGO="/images/myimage.png"
- #
- -->
- <condition property="primary.profile.plugin.logo.final" value="undefined">
- <matches pattern="^undefined$" string="${primary.profile.plugin.logo}"/>
- </condition>
- <condition property="primary.profile.plugin.logo.final" value="undefined">
- <matches pattern="^$" string="${primary.profile.plugin.logo}"/>
- </condition>
- <condition property="primary.profile.plugin.logo.final" value="'${primary.profile.plugin.logo}'">
- <matches pattern="^(?!\s*$).+" string="primary.profile.plugin.logo"/>
- </condition>
-
- <!--
-
- -->
- <condition property="primary.profile.plugin.message.about.final" value="undefined">
- <matches pattern="^undefined$" string="${primary.profile.plugin.message.about}"/>
- </condition>
- <condition property="primary.profile.plugin.message.about.final" value="undefined">
- <matches pattern="^$" string="${primary.profile.plugin.message.about}"/>
- </condition>
- <condition property="primary.profile.plugin.message.about.final" value="`${primary.profile.plugin.message.about}`">
- <matches pattern="^(?!\s*$).+" string="${primary.profile.plugin.message.about}"/>
- </condition>
-
- <!-- Test to see if "core" tenant is being asked for, since we'll need to do something special for it. -->
- <condition property="is.primary.core" value="true">
- <matches pattern="^cspaceUI$" string="${primary.profile.plugin.name}"/>
- </condition>
- </target>
+ <property name="cspace.ui.filename" value="${cspace.ui.library.name}@${cspace.ui.version}.min.js" />
- <!--
- Since "core" is a special tenant, we need to do a special check
- -->
- <target name="deploy_core_as_generic" if="${is.primary.core}">
- <property name="webapp.template.dir" value="cspace#core#template" />
- <antcall target="deploy_primary" />
- </target>
-
- <!--
- Since "core" is a special tenant, we need to do a special check
- -->
- <target name="deploy_other_as_generic" unless="${is.primary.core}">
- <property name="webapp.template.dir" value="cspace#template" />
- <antcall target="deploy_primary" />
- </target>
-
- <target name="deploy_generic" depends="set_primary">
- <antcall target="deploy_core_as_generic" />
- <antcall target="deploy_other_as_generic" />
- </target>
-
- <!--
- Primary tenant - Use the props to decide what tenant plugin to deploy
- -->
- <target name="download_primary" if="${primary.profile.plugin.enabled}">
- <!-- Default primary tenant -->
- <echo>-o ${primary.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/${primary.profile.plugin.package}@${primary.profile.plugin.version}/dist/${primary.profile.plugin.name}.min.js</echo>
- <exec executable="curl" failonerror="true">
- <arg line="-o ${primary.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/${primary.profile.plugin.package}@${primary.profile.plugin.version}/dist/${primary.profile.plugin.name}.min.js"/>
+ <target name="deploy_cspace_ui_js">
+ <exec executable="curl" failonerror="true">
+ <arg line="-o ${cspace.ui.filename} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.library.name}.min.js"/>
</exec>
- </target>
-
- <target name="deploy_primary" depends="download_primary" if="${primary.profile.plugin.enabled}" description="deploy cspace ui to ${jee.server.cspace}">
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${primary.profile.plugin.version}" />
- <filter token="PLUGIN_NAME" value="${primary.profile.plugin.name}" />
- <filter token="PLUGIN_BASENAME" value="${primary.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${primary.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${primary.profile.plugin.message.title}" />
- <filter token="LOGO" value="${primary.profile.plugin.logo.final}" />
- <filter token="ABOUT" value="${primary.profile.plugin.message.about.final}" />
- <copy todir="${jee.deploy.cspace}/${primary.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${webapp.template.dir}"/>
- </copy>
- <move file="${primary.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
+ <move file="${cspace.ui.filename}" todir="${jee.deploy.cspace.ui.shared}"></move>
</target>
- <target name="undeploy_primary" if="${primary.profile.plugin.enabled}" depends="set_primary" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <delete dir="${jee.deploy.cspace}/${primary.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${primary.profile.plugin.js}" />
+ <target name="undeploy_cspace_ui_js" description="undeploy collectionspace ui common components from ${jee.server.cspace}">
+ <delete file="${jee.deploy.cspace.ui.shared}/${cspace.ui.filename}" />
</target>
- <!--
- Common UI components
- -->
- <target name="download_common">
- <!-- Core UI -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${cspace.ui.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.webapp.name}.min.js"/>
- </exec>
+ <target name="deploy_tenants" depends="deploy_cspace_ui_js">
+ <subant target="deploy_tenant" genericantfile="${ant.file}" inheritall="true">
+ <dirset dir="." includes="*" />
+ </subant>
</target>
- <target name="deploy_common" depends="download_common">
- <move file="${cspace.ui.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
+ <target name="deploy_tenant">
+ <basename property="tenant.shortname" file="${basedir}" />
+ <uppercase property="tenant.shortname.upper" string="${tenant.shortname}" />
+ <propertycopy name="tenant.create.disabled" from="env.CSPACE_${tenant.shortname.upper}_CREATE_DISABLED_OPT" />
- <target name="undeploy_common" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Core webapp -->
- <delete file="${jee.deploy.cspace.ui.shared}/${cspace.ui.js}" />
- </target>
+ <property file="${basedir}/build.properties" />
+ <property name="tenant.ui.profile.plugin.filename" value="${tenant.ui.profile.plugin.library.name}@${tenant.ui.profile.plugin.version}.min.js" />
- <!--
- Core UI components
- -->
- <target name="download_core">
- <!-- Core UI -->
- <echo>Downloading from https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.webapp.name}.min.js</echo>
+ <!-- Default values, in case these weren't set in the tenant's build.properties. -->
+ <property name="tenant.ui.webapp.dir" value="cspace#${tenant.shortname}" />
+ <property name="tenant.ui.basename" value="/cspace/${tenant.shortname}" />
- <exec executable="curl" failonerror="true">
- <arg line="-o ${cspace.ui.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.webapp.name}.min.js"/>
- </exec>
- <move file="${cspace.ui.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
-
- <target name="deploy_core" depends="download_core" unless="${env.CSPACE_CORE_CREATE_DISABLED_OPT}">
- <property name="cspace.profile.core.default.id" value="${cspace.ui.tenantid}" />
- <condition property="cspace.profile.core.default.id" value="1234">
- <not>
- <isset property="cspace.profile.core.default.id"/>
- </not>
- </condition>
+ <!-- Get the configured tenant ID from tenant bindings. This will be in the property tenant:tenantBinding.id. -->
+ <xmlproperty keepRoot="false" collapseAttributes="true" file="../../services/common/src/main/cspace/config/services/tenants/${tenant.shortname}/${tenant.shortname}-tenant-bindings.delta.xml" />
- <!-- Core UI Webapp-->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_BASENAME" value="${cspace.ui.basename}" />
- <filter token="TENANT_ID" value="${cspace.profile.core.default.id}" />
- <filter token="MESSAGE_TITLE" value="${cspace.ui.message.title}" />
- <filter token="LOGO" value="${cspace.ui.logo}" />
+ <!-- A tenant ID must either exist tenant bindings, or be specified in the tenant.id property. -->
+ <fail message="Tenant ID not found for ${tenant.shortname}. Configure the tenantBinding id in ${tenant.shortname}-tenant-bindings.delta.xml, or set the tenant.id property in ${basedir}/build.properties.">
+ <condition>
+ <and>
+ <not>
+ <isset property="tenant.id"/>
+ </not>
+ <not>
+ <isset property="tenant:tenantBinding.id"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
- <copy todir="${jee.deploy.cspace}/${cspace.ui.webapp}" filtering="true" overwrite="true">
- <fileset dir="${cspace.ui.webapp}"/>
- </copy>
- </target>
-
- <target name="undeploy_core" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Core webapp -->
- <delete dir="${jee.deploy.cspace}/${cspace.ui.webapp}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${cspace.ui.js}" />
- </target>
-
- <!--
- Public Art Tenant
- -->
- <property name="publicart.profile.plugin.tenantid" value="${cspace.profile.publicart.default.id}" />
- <property name="publicart.profile.plugin.message.title" value="Default Public Art Profile Tenant" />
- <property name="publicart.profile.plugin.version" value="^1.0.0" />
- <property name="publicart.profile.plugin.name" value="cspaceUIPluginProfilePublicArt" />
- <property name="publicart.profile.plugin.dir" value="cspace#publicart" />
- <property name="publicart.profile.plugin.js" value="${publicart.profile.plugin.name}@${publicart.profile.plugin.version}.min.js" />
- <property name="publicart.profile.plugin.basename" value="/cspace/publicart" />
- <!-- Use a value of "undefined" to use the default logo -->
- <property name="publicart.profile.plugin.logo" value="undefined" />
-
- <target name="download_publicart" unless="${env.CSPACE_PUBLICART_CREATE_DISABLED_OPT}">
- <!-- Public Art Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${publicart.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-publicart@${publicart.profile.plugin.version}/dist/${publicart.profile.plugin.name}.min.js"/>
- </exec>
- </target>
-
- <target name="deploy_publicart" depends="download_publicart" unless="${env.CSPACE_PUBLICART_CREATE_DISABLED_OPT}">
- <!-- Public Art Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${publicart.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${publicart.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${publicart.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${publicart.profile.plugin.message.title}" />
- <filter token="LOGO" value="${publicart.profile.plugin.logo}" />
-
- <copy todir="${jee.deploy.cspace}/${publicart.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${publicart.profile.plugin.dir}"/>
- </copy>
- <move file="${publicart.profile.plugin.name}@${publicart.profile.plugin.version}.min.js" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
-
- <target name="undeploy_publicart" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Public Art Profile -->
- <delete dir="${jee.deploy.cspace}/${publicart.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${publicart.profile.plugin.js}" />
- </target>
-
- <!--
- Anthropology Tenant
- -->
- <property name="anthro.profile.plugin.tenantid" value="${cspace.profile.anthro.default.id}" />
- <property name="anthro.profile.plugin.message.title" value="Default Anthropology Profile" />
- <property name="anthro.profile.plugin.logo" value="undefined" />
- <property name="anthro.profile.plugin.version" value="^2.0.0" />
- <property name="anthro.profile.plugin.name" value="cspaceUIPluginProfileAnthro" />
- <property name="anthro.profile.plugin.dir" value="cspace#anthro" />
- <property name="anthro.profile.plugin.js" value="${anthro.profile.plugin.name}@${anthro.profile.plugin.version}.min.js" />
- <property name="anthro.profile.plugin.basename" value="/cspace/anthro" />
-
- <target name="download_anthro" unless="${env.CSPACE_ANTHRO_CREATE_DISABLED_OPT}">
- <!-- Anthropology Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${anthro.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-anthro@${anthro.profile.plugin.version}/dist/${anthro.profile.plugin.name}.min.js"/>
- </exec>
- </target>
-
- <target name="deploy_anthro" unless="${env.CSPACE_ANTHRO_CREATE_DISABLED_OPT}" depends="download_anthro">
- <!-- Anthropology Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${anthro.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${anthro.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${anthro.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${anthro.profile.plugin.message.title}" />
- <filter token="LOGO" value="${anthro.profile.plugin.logo}" />
-
- <copy todir="${jee.deploy.cspace}/${anthro.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${anthro.profile.plugin.dir}"/>
- </copy>
- <move file="${anthro.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
-
- <target name="undeploy_anthro" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Anthropology Profile -->
- <delete dir="${jee.deploy.cspace}/${anthro.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${anthro.profile.plugin.js}" />
- </target>
-
- <!--
- Bonsai Tenant
- -->
- <property name="bonsai.profile.plugin.tenantid" value="${cspace.profile.bonsai.default.id}" />
- <property name="bonsai.profile.plugin.message.title" value="Default Bonsai Profile" />
- <property name="bonsai.profile.plugin.logo" value="undefined" />
- <property name="bonsai.profile.plugin.version" value="^1.0.0" />
- <property name="bonsai.profile.plugin.name" value="cspaceUIPluginProfileBonsai" />
- <property name="bonsai.profile.plugin.dir" value="cspace#bonsai" />
- <property name="bonsai.profile.plugin.js" value="${bonsai.profile.plugin.name}@${bonsai.profile.plugin.version}.min.js" />
- <property name="bonsai.profile.plugin.basename" value="/cspace/bonsai" />
-
- <target name="download_bonsai" unless="${env.CSPACE_BONSAI_CREATE_DISABLED_OPT}">
- <!-- Bonsai Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${bonsai.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-bonsai@${bonsai.profile.plugin.version}/dist/${bonsai.profile.plugin.name}.min.js"/>
- </exec>
- </target>
-
- <target name="deploy_bonsai" unless="${env.CSPACE_BONSAI_CREATE_DISABLED_OPT}" depends="download_bonsai">
- <!-- Bonsai Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${bonsai.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${bonsai.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${bonsai.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${bonsai.profile.plugin.message.title}" />
- <filter token="LOGO" value="${bonsai.profile.plugin.logo}" />
-
- <copy todir="${jee.deploy.cspace}/${bonsai.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${bonsai.profile.plugin.dir}"/>
- </copy>
- <move file="${bonsai.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
+ <condition property="resolved.tenant.id" value="${tenant:tenantBinding.id}" else="${tenant.id}">
+ <isset property="tenant:tenantBinding.id"/>
+ </condition>
- <target name="undeploy_bonsai" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Bonsai Profile -->
- <delete dir="${jee.deploy.cspace}/${bonsai.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${bonsai.profile.plugin.js}" />
+ <antcall target="deploy_tenant_js" />
+ <antcall target="deploy_tenant_webapp" />
</target>
- <!--
- Fine and Contemporary Art Tenant
- -->
- <property name="fcart.profile.plugin.tenantid" value="${cspace.profile.fcart.default.id}" />
- <property name="fcart.profile.plugin.message.title" value="Default Fine and Contemporary Art" />
- <property name="fcart.profile.plugin.logo" value="undefined" />
- <property name="fcart.profile.plugin.version" value="^1.0.0" />
- <property name="fcart.profile.plugin.name" value="cspaceUIPluginProfileFCart" />
- <property name="fcart.profile.plugin.dir" value="cspace#fcart" />
- <property name="fcart.profile.plugin.js" value="${fcart.profile.plugin.name}@${fcart.profile.plugin.version}.min.js" />
- <property name="fcart.profile.plugin.basename" value="/cspace/fcart" />
-
- <target name="download_fcart" unless="${env.CSPACE_FCART_CREATE_DISABLED_OPT}">
- <!-- FCart Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${fcart.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-fcart@${fcart.profile.plugin.version}/dist/${fcart.profile.plugin.name}.min.js"/>
+ <target name="deploy_tenant_js" if="tenant.ui.profile.plugin.package.name" unless="${tenant.create.disabled}">
+ <exec executable="curl" failonerror="true">
+ <arg line="-o ${tenant.ui.profile.plugin.filename} --fail --insecure --remote-name --location https://unpkg.com/${tenant.ui.profile.plugin.package.name}@${tenant.ui.profile.plugin.version}/dist/${tenant.ui.profile.plugin.library.name}.min.js"/>
</exec>
- </target>
-
- <target name="deploy_fcart" unless="${env.CSPACE_FCART_CREATE_DISABLED_OPT}" depends="download_fcart">
- <!-- FCart Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${fcart.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${fcart.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${fcart.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${fcart.profile.plugin.message.title}" />
- <filter token="LOGO" value="${fcart.profile.plugin.logo}" />
- <copy todir="${jee.deploy.cspace}/${fcart.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${fcart.profile.plugin.dir}"/>
- </copy>
- <move file="${fcart.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
- </target>
-
- <target name="undeploy_fcart" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- FCart Profile -->
- <delete dir="${jee.deploy.cspace}/${fcart.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${fcart.profile.plugin.js}" />
+ <move file="${tenant.ui.profile.plugin.filename}" todir="${jee.deploy.cspace.ui.shared}"></move>
</target>
- <!--
- Local History and Material Culture Tenant
- -->
- <property name="lhmc.profile.plugin.tenantid" value="${cspace.profile.lhmc.default.id}" />
- <property name="lhmc.profile.plugin.message.title" value="Default Local History and Material Culture Profile" />
- <property name="lhmc.profile.plugin.logo" value="undefined" />
- <property name="lhmc.profile.plugin.version" value="^1.0.0" />
- <property name="lhmc.profile.plugin.name" value="cspaceUIPluginProfileLHMC" />
- <property name="lhmc.profile.plugin.dir" value="cspace#lhmc" />
- <property name="lhmc.profile.plugin.js" value="${lhmc.profile.plugin.name}@${lhmc.profile.plugin.version}.min.js" />
- <property name="lhmc.profile.plugin.basename" value="/cspace/lhmc" />
-
- <target name="download_lhmc" unless="${env.CSPACE_LHMC_CREATE_DISABLED_OPT}">
- <!-- LHMC Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${lhmc.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-lhmc@${lhmc.profile.plugin.version}/dist/${lhmc.profile.plugin.name}.min.js"/>
- </exec>
- </target>
+ <target name="deploy_tenant_webapp" unless="${tenant.create.disabled}">
+ <filter token="UI_FILENAME" value="${cspace.ui.filename}" />
+ <filter token="UI_PROFILE_PLUGIN_FILENAME" value="${tenant.ui.profile.plugin.filename}" />
+ <filter token="UI_PROFILE_PLUGIN_LIBRARY_NAME" value="${tenant.ui.profile.plugin.library.name}" />
+ <filter token="BASENAME" value="${tenant.ui.basename}" />
+ <filter token="TENANT_ID" value="${resolved.tenant.id}" />
- <target name="deploy_lhmc" unless="${env.CSPACE_LHMC_CREATE_DISABLED_OPT}" depends="download_lhmc">
- <!-- LHMC Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${lhmc.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${lhmc.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${lhmc.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${lhmc.profile.plugin.message.title}" />
- <filter token="LOGO" value="${lhmc.profile.plugin.logo}" />
-
- <copy todir="${jee.deploy.cspace}/${lhmc.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${lhmc.profile.plugin.dir}"/>
+ <copy todir="${jee.deploy.cspace}/${tenant.ui.webapp.dir}" failonerror="false" filtering="true" overwrite="true">
+ <fileset dir="${basedir}" excludes="build.properties" />
</copy>
- <move file="${lhmc.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
</target>
- <target name="undeploy_lhmc" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- LHMC Profile -->
- <delete dir="${jee.deploy.cspace}/${lhmc.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${lhmc.profile.plugin.js}" />
+ <target name="undeploy_tenants">
+ <subant target="undeploy_tenant" genericantfile="${ant.file}" inheritall="true">
+ <dirset dir="." includes="*" />
+ </subant>
</target>
- <!--
- Materials Authority Tenant
- -->
- <property name="materials.profile.plugin.tenantid" value="${cspace.profile.materials.default.id}" />
- <property name="materials.profile.plugin.message.title" value="Default Materials Authority" />
- <property name="materials.profile.plugin.logo" value="undefined" />
- <property name="materials.profile.plugin.version" value="^1.0.0" />
- <property name="materials.profile.plugin.name" value="cspaceUIPluginProfileMaterials" />
- <property name="materials.profile.plugin.dir" value="cspace#materials" />
- <property name="materials.profile.plugin.js" value="${materials.profile.plugin.name}@${materials.profile.plugin.version}.min.js" />
- <property name="materials.profile.plugin.basename" value="/cspace/materials" />
-
- <target name="download_materials" unless="${env.CSPACE_MATERIALS_CREATE_DISABLED_OPT}">
- <!-- Materials Authority Profile -->
- <exec executable="curl" failonerror="true">
- <arg line="-o ${materials.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui-plugin-profile-materials@${materials.profile.plugin.version}/dist/${materials.profile.plugin.name}.min.js"/>
- </exec>
- </target>
+ <target name="undeploy_tenant">
+ <basename property="tenant.shortname" file="${basedir}" />
- <target name="deploy_materials" unless="${env.CSPACE_MATERIALS_CREATE_DISABLED_OPT}" depends="download_materials">
- <!-- Materials Authority Profile -->
- <filter token="UI_VERSION" value="${cspace.ui.version}" />
- <filter token="PLUGIN_VERSION" value="${materials.profile.plugin.version}" />
- <filter token="PLUGIN_BASENAME" value="${materials.profile.plugin.basename}" />
- <filter token="TENANT_ID" value="${materials.profile.plugin.tenantid}" />
- <filter token="MESSAGE_TITLE" value="${materials.profile.plugin.message.title}" />
- <filter token="LOGO" value="${materials.profile.plugin.logo}" />
+ <property file="${basedir}/build.properties" />
- <copy todir="${jee.deploy.cspace}/${materials.profile.plugin.dir}" filtering="true" overwrite="true">
- <fileset dir="${materials.profile.plugin.dir}"/>
- </copy>
- <move file="${materials.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
+ <antcall target="undeploy_tenant_webapp" />
</target>
- <target name="undeploy_materials" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- <!-- Materials Authority Profile -->
- <delete dir="${jee.deploy.cspace}/${materials.profile.plugin.dir}" />
- <delete file="${jee.deploy.cspace.ui.shared}/${materials.profile.plugin.js}" />
+ <target name="undeploy_tenant_webapp">
+ <delete dir="${jee.deploy.cspace}/${tenant.ui.webapp.dir}" />
</target>
- <!--
- General deploy target
- -->
- <target name="deploy_others" unless="${primary.profile.plugin.enabled}">
- <antcall target="deploy_common" />
- <antcall target="deploy_core" />
- <antcall target="deploy_publicart" />
- <antcall target="deploy_anthro" />
- <antcall target="deploy_bonsai" />
- <antcall target="deploy_fcart" />
- <antcall target="deploy_lhmc" />
- <antcall target="deploy_materials" />
+ <target name="undeploy_js">
+ <delete>
+ <fileset dir="${jee.deploy.cspace.ui.shared}" includes="*" />
+ </delete>
</target>
- <target name="deploy" depends="deploy_common, deploy_generic, deploy_others" description="deploy cspace ui to ${jee.server.cspace}">
- <ant antfile="incubator/build.xml" target="deploy" inheritAll="false" />
- </target>
-
- <!-- General undeploy target -->
-
- <target name="undeploy_others">
- <antcall target="undeploy_materials" />
- <antcall target="undeploy_lhmc" />
- <antcall target="undeploy_fcart" />
- <antcall target="undeploy_bonsai" />
- <antcall target="undeploy_anthro" />
- <antcall target="undeploy_publicart" />
- <antcall target="undeploy_core" />
- <antcall target="undeploy_common" />
- <ant antfile="incubator/build.xml" target="undeploy" inheritAll="false" />
- </target>
-
- <target name="undeploy" depends="undeploy_common, undeploy_primary, undeploy_others" description="undeploy collectionspace ui components from ${jee.server.cspace}">
- </target>
+ <target name="deploy" depends="deploy_tenants" description="deploy cspace ui to ${jee.server.cspace}" />
+ <target name="undeploy" depends="undeploy_tenants, undeploy_js" description="undeploy collectionspace ui components from ${jee.server.cspace}" />
</project>