<project name="buildMpsA" default="build" basedir="../../">
  <!-- Generated by MPS -->
  <property name="build.dir" location="build" />
  <property name="build.tmp" location="${build.dir}/tmp/buildMpsA" />
  <property name="build.layout" location="${build.dir}/artifacts/buildMpsA" />
  <property name="artifacts.buildMpsB" location="${build.dir}/artifacts/buildMpsB" />
  <property name="environment" value="env" />
  <property name="env.JAVA_HOME" value="${java.home}/.." />
  <property name="jdk.home" value="${env.JAVA_HOME}" />
  
  <target name="assemble" depends="classes, fetchDependencies">
    <mkdir dir="${build.layout}/temp" />
    <copy file="${build.tmp}/deps/buildMpsB/my.tar.bz2/tests.msd" todir="${build.layout}/temp" />
    <mkdir dir="${build.tmp}/default/zipfilesettest1.zip" />
    <mkdir dir="${build.tmp}/default/zipfilesettest1.zip/AAA" />
    <copy todir="${build.tmp}/default/zipfilesettest1.zip/AAA">
      <fileset file="${basedir}/jetbrains.mps.build.tests/tests.msd" />
      <filterchain>
        <fixcrlf eol="crlf" eof="remove" />
      </filterchain>
    </copy>
    <zip destfile="${build.layout}/temp/zipfilesettest1.zip">
      <zipfileset file="${basedir}/jetbrains.mps.build.sandbox/samples/build.xml" prefix="AAA" />
      <zipfileset dir="${artifacts.buildMpsB}/X" prefix="AAA/X" />
      <fileset dir="${build.tmp}/default/zipfilesettest1.zip" />
    </zip>
    <tar destfile="${build.layout}/temp/tarfilesettest1.tar" longfile="gnu">
      <tarfileset file="${build.tmp}/deps/buildMpsB/my.tar.gz/A2/A3/tests.msd" prefix="repack/none" />
      <tarfileset file="${build.tmp}/deps/buildMpsB/my.tar/A1/tests.msd" prefix="repack/gzip" />
      <tarfileset dir="${artifacts.buildMpsB}/X" prefix="QQQ/PPP" />
    </tar>
    <mkdir dir="${build.tmp}/default/tarfilesettest2.tar.gz_f640_d750" />
    <mkdir dir="${build.tmp}/default/tarfilesettest2.tar.gz_f600" />
    <copy todir="${build.tmp}/default/tarfilesettest2.tar.gz_f600">
      <fileset dir="${basedir}/jetbrains.mps.build.tests">
        <include name="*.msd" />
      </fileset>
      <flattenmapper />
    </copy>
    <mkdir dir="${build.tmp}/default/tarfilesettest2.tar.gz_f640_d750/prefix3" />
    <copy todir="${build.tmp}/default/tarfilesettest2.tar.gz_f640_d750/prefix3">
      <fileset file="${basedir}/jetbrains.mps.build.sandbox/models/build1.mps" />
      <filterchain>
        <fixcrlf eol="crlf" />
      </filterchain>
    </copy>
    <tar destfile="${build.layout}/temp/tarfilesettest2.tar.gz" compression="gzip" longfile="gnu">
      <tarfileset file="${basedir}/jetbrains.mps.build.tests/tests.msd" prefix="prefix1" filemode="600" />
      <tarfileset dir="${artifacts.buildMpsB}/X" prefix="prefix1/prefix2" filemode="640" dirmode="750" />
      <tarfileset file="${basedir}/jetbrains.mps.build.sandbox/sandbox.msd" prefix="prefix1/prefix2/prefix3" filemode="640" />
      <tarfileset dir="${build.tmp}/default/tarfilesettest2.tar.gz_f640_d750" filemode="640" dirmode="750" prefix="prefix1/prefix2" />
      <tarfileset dir="${build.tmp}/default/tarfilesettest2.tar.gz_f600" filemode="600" prefix="prefix1/prefix2" />
    </tar>
  </target>
  
  <target name="buildDependents">
    <ant antfile="jetbrains.mps.build.sandbox/samples/buildMpsB.xml" inheritAll="false" useNativeBasedir="true" />
  </target>
  
  <target name="fetchDependencies">
    <mkdir dir="${build.tmp}/deps/buildMpsB/MpsB.zip" />
    <unzip src="${artifacts.buildMpsB}/X/MpsB.zip" dest="${build.tmp}/deps/buildMpsB/MpsB.zip" />
    <mkdir dir="${build.tmp}/deps/buildMpsB/my.tar.bz2" />
    <untar src="${artifacts.buildMpsB}/my.tar.bz2" dest="${build.tmp}/deps/buildMpsB/my.tar.bz2" compression="bzip2" />
    <mkdir dir="${build.tmp}/deps/buildMpsB/my.tar.gz" />
    <untar src="${artifacts.buildMpsB}/my.tar.gz" dest="${build.tmp}/deps/buildMpsB/my.tar.gz" compression="gzip" />
    <mkdir dir="${build.tmp}/deps/buildMpsB/my.tar" />
    <untar src="${artifacts.buildMpsB}/my.tar" dest="${build.tmp}/deps/buildMpsB/my.tar" compression="none" />
  </target>
  
  <target name="build" depends="assemble" />
  
  <target name="clean">
    <delete dir="${build.tmp}" />
    <delete dir="${build.layout}" />
  </target>
  
  <target name="compileJava" depends="java.compile.A, java.compile.testImportJarReexport" />
  
  <target name="processResources" />
  
  <target name="classes" depends="compileJava, processResources" />
  
  <target name="test" depends="classes" />
  
  <target name="check" depends="test" />
  
  <target name="java.compile.A" depends="fetchDependencies">
    <mkdir dir="${basedir}/jetbrains.mps.build.sandbox/samples/buildD/src" />
    <mkdir dir="${build.tmp}/java/out/A" />
    <javac destdir="${build.tmp}/java/out/A" fork="true" encoding="utf8" includeantruntime="false" debug="true">
      <compilerarg value="-Xlint:none" />
      <src>
        <path location="${basedir}/jetbrains.mps.build.sandbox/samples/buildD/src" />
      </src>
      <classpath>
        <fileset file="${build.tmp}/deps/buildMpsB/MpsB.zip/abcde.jar" />
      </classpath>
    </javac>
  </target>
  
  <target name="java.compile.testImportJarReexport" depends="java.compile.A, fetchDependencies">
    <mkdir dir="${basedir}/jetbrains.mps.build.sandbox/samples/buildA/src" />
    <mkdir dir="${build.tmp}/java/out/testImportJarReexport" />
    <javac destdir="${build.tmp}/java/out/testImportJarReexport" fork="true" encoding="utf8" includeantruntime="false" debug="true">
      <compilerarg value="-Xlint:none" />
      <src>
        <path location="${basedir}/jetbrains.mps.build.sandbox/samples/buildA/src" />
      </src>
      <classpath>
        <pathelement path="${build.tmp}/java/out/A" />
        <fileset file="${build.tmp}/deps/buildMpsB/MpsB.zip/abcde.jar" />
      </classpath>
    </javac>
  </target>
</project>