Ceylon on Android news

瀏覽次數:91 次
跳到第一則未讀訊息

Stephane Epardaud

未讀,
2016年3月2日 中午12:30:492016/3/2
收件者:ceylon...@googlegroups.com、ceylon-dev
Hi,

I have been working on getting Ceylon applications to run on Android, and while it's very early and rough, it's at a point where I can start accepting testers and contributions. I have been able to create a working APK written entirely in Ceylon, with Maven interop, using Gradle for building it.

How can you test this?
===

Checkout the `android` branch of the Ceylon distribution (https://github.com/ceylon/ceylon) and build your distribution with `ant clean dist`. It's a bit behind `master`, but not by much. Warning: this branch will be forcibly rewritten as its commit history is crap and temporary. It's also only been tested for Android and it will likely just break if you try to use it outside of Android building. Naturally all that will be fixed in due time. This is bleeding edge, remember?

Get the Ceylon/Android Gradle plugin at https://github.com/ceylon/ceylon-gradle-android and try it out. 

You will need to edit the `com.redhat.ceylon.gradle.android.MyCeylonCompileTask` class to change `/home/stephane/src/java-eclipse/ceylon/dist/dist/bin/ceylon`to point to your distribution (of course it will be configurable later).

Because it has a `sample-app` that depends on the Gradle plugin being built, you will need to comment out the `include 'sample-app'`line in `settings.gradle` until you've built the plugin first with:

`$ ANDROID_HOME=.../Android/Sdk/ ./gradlew  :android:build`

Now you can uncomment that line back in `settings.gradle` and build your sample app with:

`$ ANDROID_HOME=.../Android/Sdk/ ./gradlew  assembleDebug`

And stuff it onto your emulator with:

`$ .../Android/Sdk/tools/android avd &`
`$ .../Android/Sdk/platform-tools/adb install -r sample-app/build/outputs/apk/sample-app-debug.apk`

What I did so far
===
- added a `--jdk-provider` flag to the compiler which takes a module that contains the Jdk, and treats it as the source for the Jdk you target. You point it to your android module and it will figure out which Jdk modules it contains from there, allowing you to resolve `java.base/7` from it instead of from the running Jdk.
- started fixing `import-jar` to deal with transitive dependencies, so we can import the android jar and whatever dependencies are declared in the Gradle build (which come from the Android Sdk Maven repo)
- hacked `jigsaw create-mlib` to generate a `ceylon.metamodel` file which describes the metamodel statically, so that at run-time the metamodel gets initialised with this. This will move to a more appropriate command
- got the Gradle plugin to:
 a/ import the Maven (aar file types mostly, which the Android Gradle plugin unpacks for us) modules into a Ceylon repo
 b/ compile our Ceylon module with that repo configured, and the generated source paths (containing `R.java`) configured too
 c/ generate a list of jars required by our Ceylon modules (as in, the Ceylon runtime) and static metamodel file
 d/ pass on that list (minus those already found by Gradle) to the Android Gradle build so it can dex them and include them in the Apk

What remains to be done
===

- clean up and polish
- support variants and flavours in the Gradle plugin
- properly set up input/output and incremental build in the Gradle plugin
- make the Gradle plugin configurable
- very likely make the Gradle plugin use the Gradle Ceylon plugin Renato wrote, not sure how
- deal with `java.lang::CharSequence` because Android seems to use this a lot
- add `--exclude` to `jigsaw create-mlib`
- trim module dependencies in dist to reduce runtime footprint

What feedback/help you can give
===

If you know Gradle, please help improve my plugin, it's currently working but not well written at all, and not complete or configurable.

If you know Android: try out the same app, try adding more Android typical features to it, see where we need to improve support for both Ceylon and the Gradle plugin.
--
Stéphane Épardaud

Gavin King

未讀,
2016年3月2日 下午6:24:442016/3/2
收件者:ceylon...@googlegroups.com、ceylon-dev
Progress! :-)
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/CAKU9E9uBVyh8QsiL76G-SjXsANg%3DyPb4D_xmGB9L-LQKzRmv8g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Stephane Epardaud

未讀,
2016年3月3日 中午12:08:482016/3/3
收件者:ceylon-dev、ceylon...@googlegroups.com
For info, I've just cleaned up my commits considerably in the android branch. You need to refetch it though, as a result. I may even be able to merge this soon.

You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAP7PoCf08d%3DTQW-5cvSgGRoNwSy-Cm_jQHCLkP01-oVPBhjRkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Stephane Epardaud

未讀,
2016年3月16日 上午10:30:532016/3/16
收件者:ceylon...@googlegroups.com、ceylon-dev
Just merged this to `master` for `ceylon`, `ceylon-ide-common` and `ceylon-ide-eclipse`. Perhaps `ceylon-ide-intellij` needs a fix too? If yes it's pretty simple, just replace the package from which you import `TypeKind` to our model/mirror package.

It's still WIP, but it works so far. I'll work on reducing the module graph now.

Cheers.

On 7 March 2016 at 10:43, Philippe Lhoste <philh...@gmail.com> wrote:
Great!
Alas, I still haven't learned to code for Android (yet), but if I need to write an app someday, I would prefer to do it in Ceylon rather than in Java... :-)
And that's one domain where Kotlin has some advance, so it is nice to see Ceylon to catch up there.

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud
回覆所有人
回覆作者
轉寄
0 則新訊息