view antlib/build.xml @ 29:e90d290a9a8d

Remove dependence on Nashorn.
author David Barts <n5jrn@me.com>
date Mon, 13 Jun 2022 09:21:24 -0700
parents
children
line wrap: on
line source

<?xml version="1.0" encoding="UTF-8"?>
<project name="ImagePrep" default="help" basedir=".">
  <!-- import all environment variables as env.* -->
  <property environment="env"/>

  <!-- ensure required environment variables are set -->
  <macrodef name="env-require">
    <attribute name="name"/>
    <sequential>
      <fail message="Environment variable @{name} not set!">
        <condition>
          <not><isset property="env.@{name}"/></not>
        </condition>
      </fail>
    </sequential>
  </macrodef>
  <env-require name="ANT_HOME"/>
  <env-require name="JRE_HOME"/>
  <env-require name="KOTLIN_HOME"/>

  <!-- define the kotlin task -->
  <property name="kotlin.lib" value="${env.KOTLIN_HOME}/lib"/>
  <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
           classpath="${kotlin.lib}/kotlin-ant.jar"/>

  <!-- help message -->
  <target name="help">
    <echo>You can use the following targets:</echo>
    <echo> </echo>
    <echo>  help    : (default) Prints this message </echo>
    <echo>  jar     : Make JAR file.</echo>
    <echo> </echo>
  </target>

  <!-- compile *.kt to *.class -->
  <property name="jar.name"      value="antlib.jar"/>
  <target name="jar"
          description="Compile sources to ${jar.name}.">
    <kotlinc src="." output="${jar.name}"
             noStdlib="false" includeRuntime="true">
      <compilerarg line="-jvm-target 1.8"/>
      <classpath>
        <fileset dir="${env.ANT_HOME}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
    </kotlinc>
  </target>


</project>