Have tried that on openjdk version "17.0.1" 2021-10-19.
No warning using JavaScript on my machine.
But you also could other implementation languages for your mapper - Groovy, ...
even Java ;-)
Adding some examples.
Jan
<project default="all">
<property name="src" value="src"/>
<property name="dest" value="dest"/>
<target name="clean">
<delete dir="${dest}"/>
</target>
<target name="prepare">
<mkdir dir="${src}"/>
<touch file="${src}/file1"/>
<touch file="${src}/File2"/>
<touch file="${src}/FILE3"/>
<touch file="${src}/filE4"/>
<touch file="${src}/file5.TXT"/>
<touch file="${src}/file6.txt"/>
</target>
<target name="copy-javascript">
<mkdir dir="${dest}"/>
<copy todir="${dest}">
<fileset dir="${src}"/>
<scriptmapper language="javascript">
self.addMappedName(source.toLowerCase());
</scriptmapper>
</copy>
</target>
<target name="copy-beanshell">
<mkdir dir="${dest}"/>
<copy todir="${dest}">
<fileset dir="${src}"/>
<scriptmapper language="beanshell">
self.addMappedName(source.toLowerCase());
</scriptmapper>
</copy>
</target>
<target name="create-custom-mapper">
<property name="dir.custommapper" value="custom-mapper"/>
<mkdir dir="${dir.custommapper}/foo"/>
<echo file="${dir.custommapper}/foo/LowerCaseMapper.java">
package foo;
public class LowerCaseMapper implements
org.apache.tools.ant.util.FileNameMapper {
public void setFrom(String from){}
public void setTo(String to){}
public String[] mapFileName(String sourceFileName) {
return new String[]{sourceFileName.toLowerCase()};
}
}
</echo>
<javac srcdir="${dir.custommapper}" destdir="${dir.custommapper}"/>
</target>
<target name="copy-custommapper" depends="create-custom-mapper">
<mkdir dir="${dest}"/>
<copy todir="${dest}">
<fileset dir="${src}"/>
<mapper classname="foo.LowerCaseMapper"
classpath="${dir.custommapper}"/>
</copy>
</target>
<target name="all" depends="clean,prepare,copy-javascript"/>
</project>
-----Ursprüngliche Nachricht-----
Von: Deepak Lalchandani <[email protected]>
Gesendet: Freitag, 3. Februar 2023 13:51
An: Ant Users List <[email protected]>
Betreff: Re: How to lowercase all files with a mapper?
Can you share the script mapper with me. I would like to understand its details
On Fri, 3 Feb 2023, 6:17 pm BCT Roel de Wildt,
<[email protected]> wrote:
> Hello,
>
> I have a build script in Apache Ant that is using the following
> definition to move all files from one directory to another directory
> while everything must be lowercase. But the scriptmapper gives a
> warning in openjdk 11 during the move of every file.
>
> Warning:
> [move] Warning: Nashorn engine is planned to be removed from a future
> JDK release
>
> Build.xml:
>
> <target name="compose.default.lower">
> <mkdir
> dir="output/rcode/${platform}/${project}" />
>
> <move todir="output/rcode/${platform}/${project}">
> <fileset
> dir="preproces/rcode/${platform}/${project}">
> <include name="**" />
> </fileset>
> <scriptmapper language="javascript">
> self.clear();
>
> self.addMappedName(source.toLowerCase());
> </scriptmapper>
> </move>
> </target>
>
> Is there a alternative mapper that does not give a warning and could
> lower case everything in the string?
>
> Kind regards,
>
> Roel de Wildt
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]