<commit_before><project name="ui-layer-tenant-management" default="clone-from-template" basedir=".">
  <description>Manage UI layer folders and files containing per-tenant configurations</description>
  
  <!-- 'environment' must be declared to bring values of system -->
  <!-- environment variables into Ant, prior to reading any -->
  <!-- properties files that may reference those values. -->
  <property environment="env" />
  
  <!-- If a 'tenant.properties' file is provided, values for -->
  <!-- properties used in this Ant buildfile will be read -->
  <!-- from that file. -->
  <!-- Values for those properties can also be provided at the command -->
  <!-- line when invoking Ant, via -Dvariable.name=somevalue arguments. -->
  <!-- Where there are conflicts, values provided via the command line -->
  <!-- are used in preference to those provided in this properties file. -->
  <property file="tenant.properties" />
  <property name="src.dir" value="." />
  <property name="tenants.dir" value="${src.dir}/src/main/webapp/tenants"/>
    
  <target name="clone-from-template" if="${template.exists}" unless="${tenant.exists}"
    depends="template-exists-message,tenant-exists-message">
    <echo message="Cloning configuration from template tenant '${template.tenant.shortname}' to new tenant '${tenant.shortname}' ..."/>
    <copy todir="${tenants.dir}/${tenant.shortname}">
      <fileset dir="${tenants.dir}/${template.tenant.shortname}"/>
    </copy>
  </target>
  
  <target name="check-template-properties">
    <echo message="Checking that required template properties have been set ..."/>
    <!-- Short name of the existing tenant to use as a template, when -->
    <!-- creating a new tenant -->  
    <antcall target="check-property-is-present">
      <param name="property-to-check" value="template.tenant.shortname"/>
    </antcall>
    <echo message="template.tenant.shortname=${template.tenant.shortname}"/><commit_msg>CSPACE-6583: Replace tenant names in newly-cloned tenant folder's bundle file(s).<commit_after><project name="ui-layer-tenant-management" default="update-text-in-cloned-tenant" basedir=".">
  <description>Manage UI layer folders and files containing per-tenant configurations</description>
  
  <!-- 'environment' must be declared to bring values of system -->
  <!-- environment variables into Ant, prior to reading any -->
  <!-- properties files that may reference those values. -->
  <property environment="env" />
  
  <!-- If a 'tenant.properties' file is provided, values for -->
  <!-- properties used in this Ant buildfile will be read -->
  <!-- from that file. -->
  <!-- Values for those properties can also be provided at the command -->
  <!-- line when invoking Ant, via -Dvariable.name=somevalue arguments. -->
  <!-- Where there are conflicts, values provided via the command line -->
  <!-- are used in preference to those provided in this properties file. -->
  <property file="tenant.properties" />
  <property name="src.dir" value="." />
  <property name="tenants.dir" value="${src.dir}/src/main/webapp/tenants"/>

  <!-- Note: this text replacement is brute-force and will even replace sub-strings, -->
  <!-- if found, so you'll need to ensure that your template tenant shortname is -->
  <!-- unique - that it won't be inadvertently contained within text elsewhere. -->
  <!-- TODO: This replacement is also currently case-sensitive, and needs to be revised -->
  <!-- to detect matches of the template tenant shortname regardless of case. -->
  <!-- (See the Ant ReplaceRegExp task for one potential method.) -->
  <target name="update-text-in-cloned-tenant" depends="clone-from-template">
    <!-- Update tenant names where found in property bundle files. -->
    <replace dir="${tenants.dir}/${tenant.shortname}/bundle" token="${template.tenant.shortname}"
      value="${tenant.shortname}">
    </replace>
  </target>

  <target name="clone-from-template" if="${template.exists}" unless="${tenant.exists}"
    depends="template-exists-message,tenant-exists-message">
    <echo message="Cloning configuration from template tenant '${template.tenant.shortname}' to new tenant '${tenant.shortname}' ..."/>
    <copy todir="${tenants.dir}/${tenant.shortname}">
      <fileset dir="${tenants.dir}/${template.tenant.shortname}"/>
    </copy>
  </target>
  
  <target name="check-template-properties">
    <echo message="Checking that required template properties have been set ..."/>
    <!-- Short name of the existing tenant to use as a template, when -->
    <!-- creating a new tenant -->  
    <antcall target="check-property-is-present">
      <param name="property-to-check" value="template.tenant.shortname"/>
    </antcall>
    <echo message="template.tenant.shortname=${template.tenant.shortname}"/>
{'fraction_non_alphanumeric': 0.15592298032649643, 'fraction_numerical': 0.0008371703641691084, 'mean_word_length': 3.6488326848249026, 'pattern_counts': {'":': 0, '<': 76, '<?xml version=': 0, '>': 76, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2512589', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1271, 'n_words': 418}