Skip to content

Eclipse Setup

aharui edited this page Dec 27, 2018 · 10 revisions

Eclipse Setup

Eclipse is used by many of the compiler developers, although it is possible to make changes with text editors and Apache Ant or Apache Maven.

This is the setup for developers working with the source code in Eclipse. If you only want to build applications with the Royale Compiler, see the Royale User Guide.

Prerequisites

First you will need the following prerequisites:

A. Git
Git is a source code management application. Some computers come with Git installed. To find out if you have Git installed run

git --version

Git should print out its version if it is already installed. If not, install Git for your platform from here: http://git-scm.com/downloads. Many folks prefer GUI versions of Git, which is fine as long as there is a command-line version as well. Add Git to your PATH environment variable.

Downloading and Building the Source

Get the source code from Apache Git via

git clone https://git-wip-us.apache.org/repos/asf/royale-compiler royale-compiler cd royale-compiler git checkout develop

B. Java SE JDK 1.8
Some computers come with Java installed, but not only do you need a Java runtime (JRE) you need a Java Development Kit (JDK). To find out if you have a JDK installed run

javac -version

The Java Compiler (javac) should print out its version if its already installed. If not, download and install a JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Then: Add the "bin" folder from wherever you installed it to your environment's PATH variable. Create a new JAVA_HOME environment variable that points to the folder containing unzipped files.

C. Apache Ant
Get Apache Ant from https://ant.apache.org/bindownload.cgi. Unzip it somewhere. Add the "bin" folder from wherever you install it to your environment's PATH variable. Create a new ANT_HOME environment variable that points to the folder containing the unzipped files.

D. Google Closure Library
The Google Closure Library is required to actually make production versions and run debug or production applications. You can check this file: https://github.com/apache/royale-asjs/blob/develop/frameworks/downloads.xml and search for "gcl-download" to see which version is currently being used. You can use the "subset-goog" Ant target in the above downloads.xml file to remove files that aren't being used and speed up compile time a bit.

E. Adobe AIR SDK (Only required for SWF output)
Get a recent Adobe AIR SDK for Windows or Mac. Unzip it somewhere. Note that there are two types of AIR SDKs for each platform and the default type does not work well with Flex and Royale so use the links provided or make sure you select the Flex-compatible versions on the Adobe site. Create a new AIR_HOME environment variable that points to the folder containing the unzipped files.

F. Adobe Flash Player playerglobal.swc (Only required for SWF output)
Get a recent playerglobal.swc file from the Adobe Flash Player Downloads page: https://www.adobe.com/support/flashplayer/downloads.html. You will have to scroll down a bit to find the link. Here, for example, is a link to the playerglobal.swc for Adobe Flash Player 18.0. The filename will include the version number (e.g. playerglobal18_0.swc). Rename the file to playerglobal.swc and place it in a folder containing the version number (e.g. 18.0/playerglobal.swc on Mac and 18.0\playerglobal.swc on Windows). For example, many people create a /Users/myusername/adobe/flashplayer folder on Mac and c:\adobe\flashplayer folder on Windows, and store a playerglobal.swc in /Users/myusername/adobe/flashplayer/18.0/playerglobal.swc on Mac and/or c:\adobe\flashplayer\18.0\playerglobal.swc on Windows. Create a PLAYERGLOBAL_HOME environment variable that points to the folder containing the folder with the version number. In the example above, it would be /Users/myusername/adobe/flashplayer on Mac and/or c:\adobe\flashplayer on Windows.

G. Adobe Flash Player Projector Content Debugger (Only required for SWF output)
Get a recent Projector Content Debugger (aka Standalone Debug Player) for your platform from the Adobe Flash Player Downloads page: https://www.adobe.com/support/flashplayer/downloads.html. Create a FLASHPLAYER_DEBUGGER environment variable that points to the Debugger. For example, on Mac, if you store the Debugger in "/Users/myusername/adobe/flashplayer/18.0/Flash Player Debugger.app", you would set the environment variable to: "/Users/myusername/adobe/flashplayer/18.0/Flash Player Debugger.app/Contents/MacOS/Flash Player Debugger" (without quotes) and on Windows, if you store the Debugger in c:\adobe\flashplayer\18.0\flashplayer_18_sa_debug.exe, you would set the environment variable to c:\adobe\flashplayer\18.0\flashplayer_18_sa_debug.exe.

Setting up Eclipse

In the royale-compiler folder, run 'ant'. The Eclipse projects are not set up to generate some of the helper classes in some of the project folders but is looking for files generated by the Ant build.

There are 7 Eclipse projects which have dependencies on each other and they should all be imported into Eclipse:

  1. compiler
  2. compiler-common
  3. compiler-externc
  4. compiler-jx
  5. compiler-test-utils
  6. compiler-build-tools
  7. compiler-jburg-types

Additonally, there is a classpath variable used in the compiler project which references ANT_JAR. A classpath variable named ANT_JAR should be created in the Eclipse preferences which should reference the file named ant.jar located in the Apache Ant distribution on your computer. If you don't have Apache Ant, you will need to install it.

All of these projects should be at the top-level of the royale-compiler repo. There are other projects there as well and it should be ok to import all of them.

Using Eclipse

We are using Eclipse 20181210 for Java 1.8 compatibility. In theory, any version of Eclipse that supports Java 1.8 should work.

Run/Debug Configurations

The run/debug configuration for building a Royale application in Eclipse needs the following settings (Assuming the path to the royale-asjs repo is /Users/myusername/git/apache/royale/royale-asjs):

Project:

compiler-jx

Main Class:

org.apache.royale.compiler.clients.MXMLJSC

Program Arguments:

+royalelib="/Users/myusername/git/apache/royale/royale-asjs/frameworks" +configname=royale -debug -closure-lib=<path to Google Closure Library> /Users/myusername/git/apache/royale/royale-asjs/examples/royale/DataBindingExample/src/main/royale/DataBindingExample.mxml

VM Arguments:

-Xmx384m -Dsun.io.useCanonCaches=false -Droyalelib="/Users/myusername/git/apache/royale/royale-asjs/frameworks"

And the environment variables (Only required for SWF Output): PLAYERGLOBAL_HOME points to the folder containing versions of playerglobal.swc as specified above. Thus, if you followed the instructions above on a Mac, you would set the variable to: /Users/myusername/adobe/flashplayer.

Home

Developer Pages

RELEASE_NOTES Updates

Clone this wiki locally