<project name="mpsPluginCommon" default="build" basedir="../">
  <!-- Generated by MPS -->
  <property name="build.dir" location="build" />
  <property name="build.tmp" location="${build.dir}/tmp/mpsPluginCommon" />
  <property name="build.layout" location="${build.dir}/artifacts/mpsPluginCommon" />
  <property name="plugin.version" value="1.1.SNAPSHOT" />
  <tstamp>
    <format property="date" pattern="yyyyMMdd" />
  </tstamp>
  <property name="idea_home" location="" />
  <property name="mps_home" location="${basedir}" />
  <property name="artifacts.mpsBootstrapCore" location="${build.dir}/artifacts/mpsBootstrapCore" />
  <property name="artifacts.IDEA" location="${idea_home}" />
  <property file="${artifacts.mpsBootstrapCore}/build.properties" prefix="import.mpsBootstrapCore" />
  <property name="mpsBootstrapCore.version" value="${import.mpsBootstrapCore.mpsBootstrapCore.version}" />
  <property name="environment" value="env" />
  <property name="env.JAVA_HOME" value="${java.home}/.." />
  <property name="jdk.home" value="${env.JAVA_HOME}" />
  
  <path id="path.javac2.classpath">
    <fileset dir="${idea_home}/lib">
      <include name="javac2.jar" />
      <include name="jdom.jar" />
      <include name="asm4-all.jar" />
      <include name="asm-all.jar" />
      <include name="jgoodies-forms.jar" />
    </fileset>
  </path>
  
  <path id="path.jdk.classpath">
    <pathelement path="${jdk.home}/Classes/classes.jar" />
    <pathelement path="${jdk.home}/lib/tools.jar" />
    <fileset dir="${jdk.home}">
      <include name="jre/lib/*.jar" />
    </fileset>
  </path>
  
  <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="path.javac2.classpath" />
  
  <target name="assemble" depends="classes">
    <mkdir dir="${build.layout}" />
    <jar destfile="${build.layout}/mps-common.jar" duplicate="preserve">
      <fileset dir="${build.tmp}/java/out/mps-common" />
    </jar>
    <echo file="${build.layout}/build.properties">mpsPluginCommon.plugin.version=${plugin.version}${line.separator}mpsPluginCommon.date=${date}${line.separator}mpsBootstrapCore.version=${mpsBootstrapCore.version}</echo>
  </target>
  
  <target name="buildDependents">
    <ant antfile="build/mpsBootstrapCore.xml" inheritAll="false" useNativeBasedir="true" />
  </target>
  
  <target name="fetchDependencies" />
  
  <target name="build" depends="assemble" />
  
  <target name="clean">
    <delete dir="${build.tmp}" />
    <delete dir="${build.layout}" />
  </target>
  
  <target name="compileJava" depends="java.compile.mps-common" />
  
  <target name="processResources" />
  
  <target name="classes" depends="compileJava, processResources" />
  
  <target name="test" depends="classes" />
  
  <target name="check" depends="test" />
  
  <target name="java.compile.mps-common" depends="fetchDependencies">
    <mkdir dir="${mps_home}/IdeaPlugin/mps-core/common/src" />
    <mkdir dir="${mps_home}/IdeaPlugin/mps-core/common/resources" />
    <mkdir dir="${build.tmp}/java/out/mps-common" />
    <javac2 destdir="${build.tmp}/java/out/mps-common" fork="false" encoding="utf8" includeantruntime="false" debug="true">
      <compilerarg value="-Xlint:none" />
      <src>
        <path location="${mps_home}/IdeaPlugin/mps-core/common/src" />
        <path location="${mps_home}/IdeaPlugin/mps-core/common/resources" />
      </src>
      <classpath>
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-annotations.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-openapi.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-core.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-logging.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-closures.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-collections.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-tuples.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-behavior-api.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-behavior-runtime.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-messaging.jar" />
        <fileset file="${artifacts.mpsBootstrapCore}/lib/mps-boot-util.jar" />
        <fileset dir="${artifacts.IDEA}/lib" includes="*.jar" />
        <fileset file="${artifacts.IDEA}/lib/annotations.jar" />
        <fileset file="${artifacts.IDEA}/lib/log4j.jar" />
        <fileset file="${artifacts.IDEA}/lib/jdom.jar" />
        <fileset file="${artifacts.IDEA}/lib/trove4j.jar" />
        <path refid="path.jdk.classpath" />
      </classpath>
    </javac2>
    <copy todir="${build.tmp}/java/out/mps-common">
      <fileset dir="${mps_home}/IdeaPlugin/mps-core/common/src" includes="**/*.properties, **/*.xml, **/*.html, **/*.png, **/*.txt, **/*.ico, **/*.zip, **/*.info" />
      <fileset dir="${mps_home}/IdeaPlugin/mps-core/common/resources" includes="**/*.properties, **/*.xml, **/*.html, **/*.png, **/*.txt, **/*.ico, **/*.zip, **/*.info" />
    </copy>
  </target>
</project>