<!--

    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<project name="common.setup" basedir="." default="setup">
 
    <!-- IMPORTS -->
    <import file="../../bin/xml/ts.common.props.xml"/>
 
    <property environment="userenv"/> 

 <target name="setup" > 

  <echo message="ts.home = ${ts.home}"/>

  <mkdir dir="${ts.home}/classes"/>
  <mkdir dir="${ts.home}/dist"/>
  <mkdir dir="${ts.home}/tmp"/>
  <copy todir="${ts.home}/src" overwrite="true">
    <fileset dir="${ts.home}/install/common/other" includes="rebuildable.properties"/>
  </copy>
  <copy todir="${ts.home}/src" overwrite="true">
    <fileset dir="${ts.home}/install/common/other" includes="keyword.properties"/>
  </copy>
  <copy todir="${common.bin.dir}" overwrite="true">
    <fileset dir="../${deliverable.dir}/bin" includes="**/*" excludes="ts.jtx"/>
    <fileset dir="." includes="ts.jtx"/>
  </copy>
  <copy todir="${common.bin.dir}" overwrite="true">
    <filterset>
      <filter token="XX_REPLACETHIS_XX" value="${ts.home}"/>
    </filterset>
  </copy>
  <copy todir="${ts.home}/lib" overwrite="true" failonerror="false">
    <fileset dir="../${deliverable.dir}/lib" includes="*"/>
  </copy>
  <copy todir="${ts.home}/src" overwrite="true">
    <fileset dir="../${deliverable.dir}/other" includes="*.properties, testsuite.jtt"/>
  </copy>
  
  <chmod perm="a+rx">
    <fileset dir="${common.bin.dir}" excludes="build.xml"/>
  </chmod>
  <chmod perm="u+rw" dir="${ts.home}/src" includes="finder.properties, testsuite.jtt"/>

  <echo message="Common setup completed for the ${deliverable.dir} deliverable."/>
  <echo message="Review the ${ts.home}${dir.path.sep}bin${dir.path.sep}ts.jte file and set the properties as required by the ${deliverable.dir} TCK."/>
    
 </target>
</project>
