Skip to content

Switched to appbundler for building distribution files for MacOSX #2102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ build/windows/WinAVR-*.zip
build/macosx/arduino-*.zip
build/macosx/dist/gcc-*.tar.gz
build/macosx/libastylej*
build/macosx/appbundler*.jar
build/linux/work/
build/linux/dist/*.tar.gz
build/linux/*.tgz
Expand Down
5 changes: 5 additions & 0 deletions app/src/processing/app/macosx/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public void setLookAndFeel() throws Exception {
UIManager.put("Component.visualMargin", new Insets(1, 1, 1, 1));
}

public Platform() {
// For more information see:
// http://mail.openjdk.java.net/pipermail/macosx-port-dev/2013-January/005261.html
Toolkit.getDefaultToolkit();
}

public void init(Base base) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
Expand Down
108 changes: 66 additions & 42 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<condition property="staging_folder" value="linux"><equals arg1="${platform}" arg2="linux32" /></condition>
<condition property="staging_folder" value="linux"><equals arg1="${platform}" arg2="linux64" /></condition>

<condition property="staging_hardware_folder" value="Arduino.app/Contents/Resources/Java/hardware"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="staging_hardware_folder" value="Arduino.app/Contents/Java/hardware"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="windows" /></condition>
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux32" /></condition>
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux64" /></condition>
Expand Down Expand Up @@ -155,7 +155,7 @@
<tokenfilter>
<linetokenizer includeDelims="false" />
<!-- grab the thing from the first line that's 4 digits -->
<containsregex pattern="ARDUINO (.*) " />
<containsregex pattern="ARDUINO ([^ ]*)" />
<replaceregex pattern="ARDUINO ([^ ]*).*" replace="\1" />
</tokenfilter>
<tokenfilter>
Expand Down Expand Up @@ -207,23 +207,48 @@
<target name="macosx-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
<mkdir dir="macosx/work" />

<!-- assemble the pde -->
<copy todir="macosx/work/Arduino.app">
<fileset dir="macosx/template.app" includes="**"/>
</copy>

<!-- <rename src="macosx/work/template.app"
dest="macosx/work/Arduino.app" />
<move file="macosx/work/template.app"
tofile="macosx/work/Arduino.app" />-->

<chmod file="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" perm="755" />

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java" flatten="true">
<fileset refid="runtime.jars"/>
</copy>

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java">
<get src="http://downloads.arduino.cc/appbundler-1.0-arduino.jar" dest="macosx" usetimestamp="true" skipexisting="true" />

<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="macosx/appbundler-1.0-arduino.jar" />

<bundleapp outputdirectory="macosx/work"
name="Arduino"
displayname="Arduino"
shortversion="${version}"
icon="macosx/template.app/Contents/Resources/processing.icns"
identifier="cc.arduino.Arduino"
mainclassname="processing.app.Base">

<documentType name="Arduino Source File"
icon="macosx/template.app/Contents/Resources/pde.icns"
role="Editor">
<extension>ino</extension>
<extension>c</extension>
<extension>cpp</extension>
<extension>h</extension>
<mimeType>text/plain</mimeType>
<osType>TEXT</osType>
</documentType>

<classpath file="../app/pde.jar" />
<classpath file="../core/core.jar" />
<classpath dir="../app/lib" includes="*.jar"/>

<option value="-Djavaroot=$APP_ROOT/Contents/Java"/>
<option value="-Xms128M"/>
<option value="-Xmx256M"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dapple.awt.showGrowBox=false"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dapple.awt.Antialiasing=false"/>
<option value="-Dapple.awt.TextAntialiasing=true"/>
<option value="-Dcom.apple.hwaccel=true"/>
<option value="-Dapple.awt.use-file-dialog-packages=false"/>
<option value="-Dapple.awt.graphics.UseQuartz=true"/>
<option value="-Dapple.awt.application.name=Arduino"/>
</bundleapp>

<copy todir="macosx/work/Arduino.app/Contents/Java">
<fileset dir="shared" includes="lib/**" />
<fileset file="shared/revisions.txt" />
</copy>
Expand All @@ -235,22 +260,22 @@
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="macosx/work/Arduino.app/Contents/Resources/Java/hardware" />
<arg value="macosx/work/${staging_hardware_folder}" />
<arg value="macosx/dist/tools-universal.zip" />
</exec>

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/">
<copy todir="macosx/work/${staging_hardware_folder}/tools/">
<fileset file="macosx/dist/bossac" />
</copy>

<chmod file="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/bossac" perm="+x" />
<chmod file="macosx/work/${staging_hardware_folder}/tools/bossac" perm="+x" />

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr">
<copy todir="macosx/work/${staging_hardware_folder}/tools/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>

<antcall target="assemble">
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
<param name="target.path" value="macosx/work/Arduino.app/Contents/Java" />
</antcall>

<antcall target="unzip-arm-toolchain">
Expand All @@ -260,24 +285,28 @@
</antcall>

<delete includeEmptyDirs="true" quiet="true">
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools" includes="**/3.4.6/**/*"/>
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools" includes="**/3.4.6"/>
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools" includes="**/man/**/*"/>
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools" includes="**/man"/>
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/3.4.6/**/*"/>
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/3.4.6"/>
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/man/**/*"/>
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/man"/>
</delete>

<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="macosx" usetimestamp="true" skipexisting="true"/>
<unzip src="macosx/libastylej-2.03.zip" dest="macosx" overwrite="true"/>
<copy file="macosx/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Resources/Java/lib/" />
<chmod perm="755" file="macosx/work/Arduino.app/Contents/Resources/Java/lib/libastylej.jnilib" />
<copy file="macosx/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Java/lib/" />
<chmod perm="755" file="macosx/work/Arduino.app/Contents/Java/lib/libastylej.jnilib" />
</target>

<target name="macosx-run" depends="macosx-build" description="Run Mac OS X version">
<exec executable="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" spawn="true"/>
<exec executable="open" dir="macosx/work">
<arg value="Arduino.app"/>
</exec>
</target>

<target name="macosx-debug" depends="macosx-build" description="Run Mac OS X version">
<exec executable="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" spawn="false"/>
<exec executable="open" dir="macosx/work" spawn="false">
<arg value="Arduino.app"/>
</exec>
</target>

<!-- - - - - - - - - - - - - - - - -->
Expand Down Expand Up @@ -339,18 +368,13 @@
<!-- The ant copy command does not preserve permissions. -->
<chmod file="macosx/work/Arduino.app/Contents/MacOS/JavaApplicationStub" perm="+x" />
<chmod perm="+x">
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-3/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-4/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/libexec/gcc/avr/4.3.2/" includes="**/cc1*" />
<fileset dir="macosx/work/${staging_hardware_folder}/tools/avr/bin" includes="**/*" />
<fileset dir="macosx/work/${staging_hardware_folder}/tools/avr/avr/bin" includes="**/*" />
<fileset dir="macosx/work/${staging_hardware_folder}/tools/avr/avr-3/bin" includes="**/*" />
<fileset dir="macosx/work/${staging_hardware_folder}/tools/avr/avr-4/bin" includes="**/*" />
<fileset dir="macosx/work/${staging_hardware_folder}/tools/avr/libexec/gcc/avr/4.3.2/" includes="**/cc1*" />
</chmod>

<replace file="macosx/work/Arduino.app/Contents/Info.plist"
token="VERSION" value="${version}" />
<replace file="macosx/work/Arduino.app/Contents/Info.plist"
token="REVISION" value="${revision}" />

<exec executable="zip" dir="macosx/work">
<arg line="-q -r ../arduino-${version}-${platform}.zip ." />
</exec>
Expand Down