Skip to content

New macosx build #2590

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
Feb 3, 2015
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ build/macosx/dist/*.tar.gz
build/macosx/dist/*.tar.bz2
build/macosx/libastylej*
build/macosx/appbundler*.jar
build/macosx/appbundler*.zip
build/macosx/appbundler
build/linux/work/
build/linux/dist/*.tar.gz
build/linux/dist/*.tar.bz2
Expand Down
2 changes: 2 additions & 0 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,8 @@ protected boolean checkModified() {
// As of Processing 1.0.10, this always happens immediately.
// http://dev.processing.org/bugs/show_bug.cgi?id=1456

toFront();

String prompt = I18n.format(_("Save changes to \"{0}\"? "), sketch.getName());

if (!OSUtils.isMacOS()) {
Expand Down
25 changes: 9 additions & 16 deletions arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.net.URISyntaxException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -170,19 +165,17 @@ static public PreferencesMap getBoardPreferences() {
}

static public File getContentFile(String name) {
String path = System.getProperty("user.dir");
File path = new File(System.getProperty("user.dir"));

// Get a path to somewhere inside the .app folder
if (OSUtils.isMacOS()) {
// <key>javaroot</key>
// <string>$JAVAROOT</string>
String javaroot = System.getProperty("javaroot");
if (javaroot != null) {
path = javaroot;
try {
path = new File(BaseNoGui.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
File working = new File(path);
return new File(working, name);

return new File(path, name);
}

static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
Expand Down
167 changes: 134 additions & 33 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,33 @@
<!--echo message="os.version = ${os.version}" /-->

<!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="platform" value="macosx"><os family="mac" /></condition>
<condition property="platform" value="macosxnew"><os family="mac" /></condition>
<condition property="platform" value="macosx">
<and>
<os family="mac" />
<matches string="${os.version}" pattern="^10.[56]." />
</and>
</condition>
<condition property="platform" value="windows"><os family="windows" /></condition>
<condition property="platform" value="linux32"><os family="unix" arch="i386" /></condition>
<condition property="platform" value="linux64"><os family="unix" arch="amd64" /></condition>

<condition property="macosx"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="macosx"><equals arg1="${platform}" arg2="macosxnew" /></condition>
<condition property="macosxnew"><equals arg1="${platform}" arg2="macosxnew" /></condition>
<condition property="windows"><equals arg1="${platform}" arg2="windows" /></condition>
<condition property="linux32"><equals arg1="${platform}" arg2="linux32" /></condition>
<condition property="linux64"><equals arg1="${platform}" arg2="linux64" /></condition>
<condition property="linux"><equals arg1="${platform}" arg2="linux32" /></condition>
<condition property="linux"><equals arg1="${platform}" arg2="linux64" /></condition>

<condition property="staging_folder" value="macosx"><equals arg1="${platform}" arg2="macosxnew" /></condition>
<condition property="staging_folder" value="macosx"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="staging_folder" value="windows"><equals arg1="${platform}" arg2="windows" /></condition>
<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/Java/hardware"><equals arg1="${platform}" arg2="macosxnew" /></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="hardware"><equals arg1="${platform}" arg2="windows" /></condition>
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux32" /></condition>
Expand Down Expand Up @@ -180,6 +190,8 @@
<!-- Mac OS X -->
<!-- - - - - - - - -->

<target name="macosxnew-clean" depends="macosx-clean" description="Clean Mac OS X build"/>

<target name="macosx-clean" depends="subprojects-clean" description="Clean Mac OS X build">
<delete dir="macosx/work" />
<delete dir="macosx/working_dir" />
Expand Down Expand Up @@ -220,6 +232,92 @@
<fileset file="shared/revisions.txt" />
</copy>

<antcall target="macosx-build-common"/>

<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}" />

</target>

<target name="macosxnew-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/appbundler-1.0ea.jar.zip" />
<param name="archive_url" value="http://arduino.cc/download.php?f=/appbundler-1.0ea.jar.zip" />
<param name="final_folder" value="${staging_folder}/appbundler" />
<param name="dest_folder" value="${staging_folder}/appbundler" />
</antcall>

<mkdir dir="${staging_folder}/work" />

<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${staging_folder}/appbundler/appbundler-1.0ea.jar"/>

<bundleapp outputDirectory="${staging_folder}/work"
name="Arduino"
displayName="Arduino"
executableName="Arduino"
identifier="cc.arduino.Arduino"
signature="Pde1"
icon="macosx/template.app/Contents/Resources/processing.icns"
copyright="Arduino LLC"
getInfo="${version}"
shortVersion="${version}"
version="${revision}"
mainClassName="processing.app.Base"
minimumsystem="10.7"
highresolutioncapable="true">

<arch name="x86_64"/>
<arch name="i386"/>

<classpath refid="runtime.jars"/>
<classpath file="./macosx/template.app/Contents/Resources/Java/quaqua.jar"/>

<option value="-Dapple.awt.application.name=Arduino" />
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.smallTabs=true"/>

<!--
<option value="-Dapple.awt.showGrowBox=false"/>
<option value="-Dapple.awt.Antialiasing=false"/>
<option value="-Dapple.awt.TextAntialiasing=true"/>
<option value="-Dcom.apple.hwaccel=true"/>
<option value="-Dapple.awt.graphics.UseQuartz=true"/>
-->

<!--<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>-->

<!-- Workaround since the icon parameter for bundleapp doesn't work -->
<option value="-Xdock:icon=Contents/Resources/processing.icns"/>
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=Arduino"/>
<option value="-Dfile.encoding=UTF-8"/>

<option value="-Xms128M"/>
<option value="-Xmx256M"/>

<bundledocument extensions="ino,c,cpp,h"
icon="macosx/template.app/Contents/Resources/pde.icns"
name="Arduino Source File"
role="Editor">
</bundledocument>

</bundleapp>

<copy todir="${staging_folder}/work/${staging_hardware_folder}/../">
<fileset dir="shared" includes="lib/**" />
<fileset file="shared/revisions.txt" />
<file file="macosx/template.app/Contents/Resources/Java/quaqua.jar"/>
<fileset file="macosx/template.app/Contents/Resources/Java/libquaqua*" />
</copy>

<antcall target="macosx-build-common"/>

</target>

<target name="macosx-build-common">

<!-- Unzip AVR tools -->
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/avr-toolchain-mac32-gcc-4.8.1.zip" />
Expand All @@ -228,28 +326,14 @@
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
</antcall>

<!--
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<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/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>
-->

<copy todir="macosx/work/${staging_hardware_folder}/tools/">
<fileset file="macosx/dist/bossac" />
</copy>

<chmod file="macosx/work/${staging_hardware_folder}/tools/bossac" perm="+x" />

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

<antcall target="untar">
Expand All @@ -272,17 +356,42 @@
<param name="final_folder" value="${staging_folder}/libastylej" />
<param name="dest_folder" value="${staging_folder}" />
</antcall>
<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/${staging_hardware_folder}/../lib/" />
<chmod perm="755" file="macosx/work/${staging_hardware_folder}/../lib/libastylej.jnilib" />
<copy file="macosx/libastylej/libastylej.jnilib" tofile="macosx/work/${staging_hardware_folder}/../lib/libastylej.dylib" />
<chmod perm="755" file="macosx/work/${staging_hardware_folder}/../lib/libastylej.dylib" />

<chmod perm="+x">
<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/libexec/gcc/avr/4.8.1/" includes="*" />
</chmod>

</target>

<target name="macosx-run" depends="macosx-build" description="Run Mac OS X version">
<antcall target="macosx-run-common"/>
</target>

<target name="macosxnew-run" depends="macosxnew-build" description="Run Mac OS X version">
<antcall target="macosx-run-common"/>
</target>

<target name="macosx-debug" depends="macosx-build" description="Run Mac OS X version">
<antcall target="macosx-debug-common"/>
</target>

<target name="macosxnew-debug" depends="macosxnew-build" description="Run Mac OS X version">
<antcall target="macosx-debug-common"/>
</target>

<target name="macosx-run-common">
<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">
<target name="macosx-debug-common">
<exec executable="open" dir="macosx/work" spawn="false">
<arg value="Arduino.app"/>
</exec>
Expand Down Expand Up @@ -344,25 +453,17 @@
<!-- Build distribution file for MacOSX. -->
<!-- - - - - - - - - - - - - - - - - - - -->
<target name="macosx-dist" if="macosx" depends="macosx-build" description="Create a downloadable .zip for the Mac OS X version">
<!-- 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/${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/libexec/gcc/avr/4.8.1/" includes="*" />
</chmod>
<antcall target="macosx-dist-common"/>
</target>

<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}" />
<target name="macosxnew-dist" if="macosx" depends="macosxnew-build" description="Create a downloadable .zip for the Mac OS X version">
<antcall target="macosx-dist-common"/>
</target>

<target name="macosx-dist-common">
<exec executable="zip" dir="macosx/work">
<arg line="-q -r ../arduino-${version}-${platform}.zip ." />
</exec>
<!-- <exec executable="ditto" dir="macosx/work">
<arg line="-c -k -rsrc . ../arduino-${version}-macosx.zip" />
</exec> -->

<echo>
=======================================================
Expand Down
3 changes: 3 additions & 0 deletions build/build_pull_request.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ mv windows/arduino-*$VERSION*.zip ../
ant -Djava.net.preferIPv4Stack=true -Dplatform=macosx -Dversion="${VERSION}" clean dist
mv macosx/arduino-*$VERSION*.zip ../

ant -Djava.net.preferIPv4Stack=true -Dplatform=macosxnew -Dversion="${VERSION}" clean dist
mv macosx/arduino-*$VERSION*.zip ../

1 change: 1 addition & 0 deletions build/macosx/appbundler-1.0ea.jar.zip.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
28b3ccde1631791575a11f73e5fd0097df566fe2