Mercurial > cgi-bin > hgweb.cgi > ImagePrep
diff build.xml @ 29:e90d290a9a8d
Remove dependence on Nashorn.
author | David Barts <n5jrn@me.com> |
---|---|
date | Mon, 13 Jun 2022 09:21:24 -0700 |
parents | c310ec097194 |
children |
line wrap: on
line diff
--- a/build.xml Fri Dec 25 19:07:47 2020 -0800 +++ b/build.xml Mon Jun 13 09:21:24 2022 -0700 @@ -18,49 +18,30 @@ <env-require name="KOTLIN_HOME"/> <env-require name="OSDEP_HOME"/> - <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> - <scriptdef language="javascript" name="toLowerCase"> - <attribute name="value" /> - <attribute name="target" /> - <![CDATA[ - "use strict"; - project.setProperty( attributes.get( "target" ), - attributes.get( "value" ).toLowerCase() ); - ]]> - </scriptdef> + <!-- du and toLowerCase need this --> + <property name="antlib.jar" value="${basedir}/antlib/antlib.jar"/> - <!-- estimate disk usage --> - <scriptdef language="javascript" name="du"> - <attribute name="path" /> - <attribute name="target" /> - <![CDATA[ - "use strict"; - var File = Java.type('java.io.File'); - function du(fp) { - if (fp.isDirectory()) { - var files = fp.listFiles(); - if (!files) return 0; - var total = 0; - for (var i=0; i<files.length; i++) - total += du(files[i]); - return total; - } else { - return fp.length(); - } - } - var path = new File(attributes.get("path")); - project.setProperty(attributes.get("target"), - Math.round(du(path) / 1024) + ""); - ]]> - </scriptdef> + <!-- turn a string to lower case --> + <taskdef name="toLowerCase" classname="ToLowerCase"> + <classpath> + <pathelement location="${antlib.jar}"/> + </classpath> + </taskdef> + + <!-- calculate disk usage in kbytes --> + <taskdef name="du" classname="Du"> + <classpath> + <pathelement location="${antlib.jar}"/> + </classpath> + </taskdef> <!-- Define the properties used by the build --> <property name="app.name" value="${ant.project.name}"/> - <toLowerCase target="lc.app.name" value="${app.name}"/> - <property name="app.version" value="1.01"/> + <toLowerCase output="lc.app.name" value="${app.name}"/> + <property name="app.version" value="1.02"/> <property name="app.domain" value="name.blackcap.${lc.app.name}"/> <property name="app.entry" value="${app.domain}.MainKt"/> - <property name="app.copyright" value="Copyright © 2020, David W. Barts."/> + <property name="app.copyright" value="Copyright © 2020–2022, David W. Barts."/> <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> <property name="work.jar" value="${basedir}/work.jar"/> <property name="lib.home" value="${basedir}/lib"/> @@ -74,9 +55,14 @@ <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/> + <target name="testIt"> + <jshellTest message="This is a test." /> + </target> + <!-- help message --> <target name="help"> <echo>You can use the following targets:</echo> + <echo>lc.app.name is ${lc.app.name}</echo> <echo> </echo> <echo> help : (default) Prints this message </echo> <echo> all : Cleans, compiles, and stages application</echo> @@ -107,6 +93,8 @@ <target name="clean"> <delete includeEmptyDirs="true" failonerror="false"> <fileset dir="${dist.home}" includes="**/*"/> + <fileset file="${work.jar}"/> + <fileset file="${jar.name}"/> </delete> </target> @@ -127,6 +115,7 @@ <target name="compile" depends="mkdirs,osdep,classpath" description="Compile Java sources to ${work.home}"> <kotlinc src="${src.home}" output="${work.jar}" + noStdlib="false" includeRuntime="true" classpathref="compile.classpath"> <compilerarg line="-jvm-target ${jvm.version}"/> </kotlinc> @@ -254,7 +243,7 @@ </filterset> </copy> <chmod file="${dist.home}/data/usr/bin/imageprep" perm="755"/> - <du path="${dist.home}/data" target="deb.installed.size"/> + <du path="${dist.home}/data" output="deb.installed.size"/> <mkdir dir="${dist.home}/control"/> <copy todir="${dist.home}/control" encoding="UTF-8" overwrite="true"> <fileset file="${pf.home}/linux/deb/control"/>