-
Notifications
You must be signed in to change notification settings - Fork 6
[design]Separate applications from MayLoon framework
This page describes how to separate applications from MayLoon framework (MayLoon Plugin), including its usage and development.
MayLoon SDK generally includes three components: MayLoon Interface Package, MayLoon Javascript Runtime and MayLoon SDK Eclipse Plug-in(MDT).
1. MayLoon Interface Package is a jar package that includes Android SDK API supported by MayLoon, which is much the same as android.jar file in Android. To reduce the size of the package, the package only includes the interface without detail implementations.
2.MayLoon Javascript Runtime is a javascript package for running the target application. It includes the j2s runtime files and the MayLoon javascript files.
3. MayLoon SDK Eclipse Plug-in (MDT) is a tool which can help android application developer to easily convert their android projects to MayLoon projects, and launch / debug MayLoon applications in Eclipse IDE in a simple way.
Based on above assumptions, the MDT usage model is as follows: user has to build a APK file with the original Android projects before using MDT to convert. User should create a java project with j2s compiler enabled and import the Android application source codes and then use the MDT the build the MayLoon target application.
MDT would be a component in MayLoon SDK release package. MDT does its job as follows: invoke j2s compiler to compile the Java source code into javascript file and package the output javascript files and its resources into the MayLoon Runtime workspace.
To build the MayLoon Plugin, you should followthis instruction to build the j2s plugin. But a little different: you should replace the net.sf.j2s.ui project with com.intel.jsdroid.ui project. After adding the plugin into eclipse, you can now use it like j2s plugin.
To use the MayLoon Plugin, please follow this instruction:
1. As with any Java application, the first thing is to create an Eclipse project. To do so, go to menu File -> New... -> Other... and in the dialog select Java2Script Project or Java Project. The following steps for finishing creating the MayLoon project are equal to Java project's. Just enter a valid project name and click next/finnish.
2. After creating the project, right click your project, select Properties->MayLoon Builder. In the J2S Configure tab, click the toggle button "Enable Java2Script Compiler" and in the MayLoon Configure tab, click "Select Folder..." and select the com.intel.jsdroid workspace folder, like "C:\Users\wenhaoli\.ssh\newkona2\kona2\com.intel.jsdroid". Then click OK to close the configuration dialog.
3. In addition, you should add the MayLoon SDK Jar into your build path(If you haven't got a MayLoon SDK Jar, you can open the com.intel.jsdroid project and export the project with a jar file and then add it to your project's build path).
4. The last thing to do is to copy your app's resources to the com.intel.jsdroid workspace(like "C:\Users\wenhaoli\.ssh\newkona2\kona2\com.intel.jsdroid\apps").
Now all work is ready, you can now build your MayLoon project( select run as MayLoon Project).
1. Automatically pack the application's resources to MayLoon workspace.
2. Shrink the size of the MayLoon SDK Jar. We can follow what Android is done(only method included in jar, no implementation). Android achieves this by using a separated project named "droiddoc" (Kona-MP\build\tools\droiddoc).
3. Incompatibility Check.