Skip to content

Commit

Permalink
Merge pull request #26 from MarcoFalke/ant_exe
Browse files Browse the repository at this point in the history
 [launch4j] Let ant create a windows exe
  • Loading branch information
MarcoFalke committed Feb 13, 2016
2 parents 67c16cc + ee4a124 commit 5473f06
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/bin
/ant_build
/launch4j
globalreplace.jar
globalreplace.exe

# OS Generated files
.DS_Store
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ Replaces file usage globally in the Wikimedia Wikifarm.
This java program requires a minimum version of Java 8 installed. Consult [the wiki page](https://commons.wikimedia.org/wiki/Commons:GlobalReplace) for further instructions.

## Compile
### Jar
[Download the precompiled jar file](https://github.com/Commonists/GlobalReplace/releases) or build it yourself after downloading the source with a simple

```
ant
```

You need [Apache Ant](http://ant.apache.org) installed.

### Windows exe
To also build the windows exe:

```
ant dist
```

You need to download launch4j into the folder `./launch4j`.
26 changes: 26 additions & 0 deletions ant_dist/launch4jconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>globalreplace.jar</jar>
<outfile>globalreplace.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon></icon>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.8.0</minVersion>
<maxVersion>2.0.0</maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
</launch4jConfig>
24 changes: 17 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
<project default="global-replace_jar" name="Create Runnable Jar for Project GlobalReplace">
<property name="file.jar" value="globalreplace.jar" />
<property name="dir.src" value="src/globalreplace" />
<property name="dir.build" value="ant_build" />
<property name="dir.dist" value="ant_dist" />
<property name="dir.launch4j" value="launch4j" />

<target name="compile">
<delete dir="${dir.build}" />
<mkdir dir="${dir.build}" />
<javac srcdir="${dir.src}" destdir="${dir.build}" >
<classpath>
<pathelement path="lib/jwiki-v1.1.jar"/>
</classpath>
</javac>
<javac srcdir="${dir.src}" destdir="${dir.build}">
<classpath>
<pathelement path="lib/jwiki-v1.1.jar" />
</classpath>
</javac>
</target>

<target name="global-replace_jar" depends="compile">
<jar destfile="globalreplace.jar" filesetmanifest="mergewithoutmain">
<jar destfile="${file.jar}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="globalreplace.GlobalReplace" />
<attribute name="Class-Path" value="." />
</manifest>
<fileset dir="${dir.build}" />
<zipfileset excludes="META-INF/*.SF,*.md" src="lib/jwiki-v1.1.jar" />
</jar>
<echo message="Done!" />
<echo message="Created jar!" />
</target>

<target name="dist" depends="global-replace_jar">
<copy file="${file.jar}" tofile="${dir.dist}/${file.jar}" />
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${dir.launch4j}/launch4j.jar:${dir.launch4j}/lib/xstream.jar" />
<launch4j configFile="${dir.dist}/launch4jconfig.xml" />
<echo message="Windows executable created!" />
</target>
</project>

0 comments on commit 5473f06

Please sign in to comment.