<commit_before><?xml version="1.0"?>
<!--
  Copyright 2002-2004 The Apache Software Foundation or its licensors,
  as applicable.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<project basedir="." name="skins">
   <!-- public targets -->     
     
    <target name="available-skins"
          depends="init-props, skin-unavailable, fetch-skins-descriptors"
          description="What skins are available?">
    <for param="skin-descriptor-file">
      <path>
        <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
      </path>
      <sequential>
        <xslt in="@{skin-descriptor-file}" 
          out="${project.temp-dir}/skinlist2echobuild.xml"
          style="${forrest.core}/var/skinlist2echo.xsl"/>  
    <ant antfile="${project.temp-dir}/skinlist2echobuild.xml"/>
      </sequential>
    </for>
  </target>  
  
  <target name="package-skin" description="Make a package of an existing skin" depends="init-props">
    <input message="Which skin do you want to package?"
           addproperty="skin-name"/>
    <zip destfile="${forrest.skins-dir}/${skin-name}-${forrest.version}.zip"
       basedir="${forrest.skins-dir}/"
       includes="${skin-name}/**"/>
  </target>

  <target name="install-skin" 
          depends = "init-skins"
          description="Install the needed skin from the remote repository"/>
          
  <!-- private -->        
                
  <target name="init-skins" depends="init-props, check-skin, fetch-skin, unpack-skins"/>   

  <target name="skin-unavailable">   
    <property name="skin.unavailable" value="true"/>
  </target>  
  
  <target name="check-skin">   
    <condition property="skin.unavailable">
      <and>
        <not>
          <available type="dir" file="${forrest.skins-dir}/${project.skin}"/>
        </not>
        <not>
          <available type="file" file="${forrest.skins-dir}/${project.skin}.zip"/>
        </not>
        <not>
          <available type="dir" file="${skins-dir}/${project.skin}"/>
        </not>        
      </and>
    </condition>
  </target>  
            
  <target name="unpack-skins"
          depends="init-props">
     <unzip dest="${forrest.skins-dir}/">
       <fileset dir="${forrest.skins-dir}/">
          <include name="*.zip"/>
        </fileset>
     </unzip>       
     <delete>
        <fileset dir="${forrest.skins-dir}/">
          <include name="*.zip"/>
        </fileset>
     </delete>
  </target>  

  <target name="fetch-skins-descriptors" if="skin.unavailable" depends="init-proxy">
    <delete>
      <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
    </delete>
  
    <var name="skin-counter" value="1"/>
    <for list="${forrest.skins.descriptors}" param="url">
      <sequential>
        <echo>fetching descriptor: @{url}</echo>
        <get src="@{url}" 
           dest="${forrest.skins-dir}/skins-${skin-counter}.xml"
           verbose="true" usetimestamp="true" ignoreerrors="true"/>
        <math result="skin-counter" operand1="${skin-counter}" operation="+" operand2="1" datatype="int"/>
      </sequential>
    </for>
  </target>  
  
  <target name="fetch-skin" 
          if = "skin.unavailable"
          depends="init-props, fetch-skins-descriptors">
    <for param="skin-descriptor-file">
      <path>
        <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
      </path>
      <sequential>
        <xslt in="@{skin-descriptor-file}" 
          out="${project.temp-dir}/skinlist2fetchbuild.xml"
          style="${forrest.core}/var/skinlist2fetch.xsl"
          force="true">
      <param name="skin-name" expression="${project.skin}"/>      
      <param name="forrest-version" expression="${forrest.version}"/>   
    </xslt>  
    <ant antfile="${project.temp-dir}/skinlist2fetchbuild.xml"/>
      </sequential>
    </for>
  </target>    <commit_msg>Provide error message skin descriptor download fails (thanks to <NAME><commit_after><?xml version="1.0"?>
<!--
  Copyright 2002-2004 The Apache Software Foundation or its licensors,
  as applicable.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<project basedir="." name="skins">
   <!-- public targets -->     
     
    <target name="available-skins"
          depends="init-props, skin-unavailable, fetch-skins-descriptors"
          description="What skins are available?">
    <for param="skin-descriptor-file">
      <path>
        <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
      </path>
      <sequential>
        <xslt in="@{skin-descriptor-file}" 
          out="${project.temp-dir}/skinlist2echobuild.xml"
          style="${forrest.core}/var/skinlist2echo.xsl"/>  
    <ant antfile="${project.temp-dir}/skinlist2echobuild.xml"/>
      </sequential>
    </for>
  </target>  
  
  <target name="package-skin" description="Make a package of an existing skin" depends="init-props">
    <input message="Which skin do you want to package?"
           addproperty="skin-name"/>
    <zip destfile="${forrest.skins-dir}/${skin-name}-${forrest.version}.zip"
       basedir="${forrest.skins-dir}/"
       includes="${skin-name}/**"/>
  </target>

  <target name="install-skin" 
          depends = "init-skins"
          description="Install the needed skin from the remote repository"/>
          
  <!-- private -->        
                
  <target name="init-skins" depends="init-props, check-skin, fetch-skin, unpack-skins"/>   

  <target name="skin-unavailable">   
    <property name="skin.unavailable" value="true"/>
  </target>  
  
  <target name="check-skin">   
    <condition property="skin.unavailable">
      <and>
        <not>
          <available type="dir" file="${forrest.skins-dir}/${project.skin}"/>
        </not>
        <not>
          <available type="file" file="${forrest.skins-dir}/${project.skin}.zip"/>
        </not>
        <not>
          <available type="dir" file="${skins-dir}/${project.skin}"/>
        </not>        
      </and>
    </condition>
  </target>  
            
  <target name="unpack-skins"
          depends="init-props">
     <unzip dest="${forrest.skins-dir}/">
       <fileset dir="${forrest.skins-dir}/">
          <include name="*.zip"/>
        </fileset>
     </unzip>       
     <delete>
        <fileset dir="${forrest.skins-dir}/">
          <include name="*.zip"/>
        </fileset>
     </delete>
  </target>  

  <target name="fetch-skins-descriptors" if="skin.unavailable" depends="init-proxy">
    <delete>
      <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
    </delete>
  
    <var name="skin-counter" value="1"/>
    <for list="${forrest.skins.descriptors}" param="url">
      <sequential>
        <echo>fetching descriptor: @{url}</echo>
        <get src="@{url}" 
           dest="${forrest.skins-dir}/skins-${skin-counter}.xml"
           verbose="true" usetimestamp="true" ignoreerrors="true"/>
        <if>
        <not>
       		<available file="${forrest.skins-dir}/skins-${skin-counter}.xml"/>
       	</not>
       <then>
       <fail>Stopped...
ERROR
=====
       
Unable to retrieve the skins descriptors at @{url}.
There may be more information about the reason for this in ouput
above. The usual cause is that Forrest has been unable to download
the file. If you are behind a firewall then set the proxy.host 
and proxy.port values in the forrest.properties file.
       </fail>
     </then>
   </if>
        <math result="skin-counter" operand1="${skin-counter}" operation="+" operand2="1" datatype="int"/>
      </sequential>
    </for>
  </target>  
  
  <target name="fetch-skin" 
          if = "skin.unavailable"
          depends="init-props, fetch-skins-descriptors">
    <for param="skin-descriptor-file">
      <path>
        <fileset dir="${forrest.skins-dir}" includes="skins-*.xml"/>
      </path>
      <sequential>
        <xslt in="@{skin-descriptor-file}" 
          out="${project.temp-dir}/skinlist2fetchbuild.xml"
          style="${forrest.core}/var/skinlist2fetch.xsl"
          force="true">
      <param name="skin-name" expression="${project.skin}"/>      
      <param name="forrest-version" expression="${forrest.version}"/>   
    </xslt>  
    <ant antfile="${project.temp-dir}/skinlist2fetchbuild.xml"/>
      </sequential>
    </for>
  </target>    
{'fraction_non_alphanumeric': 0.16464602727863173, 'fraction_numerical': 0.005195929854946958, 'mean_word_length': 2.5603082851637766, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 2, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 19}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7449705', 'n_tokens_mistral': 2809, 'n_tokens_neox': 2720, 'n_words': 627}