You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Michael Schmalle <te...@gmail.com> on 2015/05/13 12:21:57 UTC

[FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Well I have absolutely NO experience with Cordova, I think years ago I set
it up once but that is the extent of my dealings. From what I gather it's
an HTML view with hooks down to native correct?

> mobile/desktop plugin workflow for FlexJS

Can you elaborate on this? I don't understand what context a plugin is.

ASDoc

So when you say another form of asdoc tool, what do you actually mean? I am
confused about the AIR application, what would it's purpose be?

Can you point to specific instances of differences you refer to when
talking about app verses component dev APIs?

Just understand I am getting back into this and really haven't even got
FlexJS to compile yet. I haven't had the ability to muck around the as/js
code yet either.

I have watched some stuff from Om about the strands and beads(read the
scant docs), I get the whole composition thing but don't get what you are
saying about an asdoc AIR and it's difference from a command lin tool.

Mike



>It would have been icing on the cake if I wasn't using native extensions
>for dll on Windows and Java on Android for these apps, then I could really
>test FlexJS. That is also why one thing I might work on is a Web Audio
>extensions lib with FlexJS, that is my dream.

Besides working on the compiler, I would love it if you created some sort
of mobile/desktop plugin workflow for FlexJS.  Just like FlexJS currently
generates a SWF for testing and potential deployment then cross-compiles
to HTML/JS/CSS, mobile applications for FlexJS should be able to use AIR
to run the SWF for testing and cross-compile and generate apps via the
Cordova/PhoneGap process.  We have already proven that the Cordova process
works for FlexJS for mobile apps that don’t have native extensions.  There
is a cordova-build.xml file in the flex-asjs root that will crank the
FalconJX output into a Cordova app.  I’ve used it on DataBindingTest, I
think Peter has also used it on GoogleMaps.

FWIW, another thing I’ve been thinking about is a different sort of ASDoc
tool.  Now that the classes in FlexJS are made up of small composited
pieces, the public API seems like it needs sub-division: public APIs that
application developers are likely to use, and public APIs that the
developers of the small pieces are likely to use.  In my mind it would be
an AIR app and we’d add more asdoc annotations to APIs to help
differentiate them, but I could be totally wrong about that.

Food for thought,
-Alex

Re: [FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Posted by Alex Harui <ah...@adobe.com>.

On 5/13/15, 8:16 AM, "Michael Schmalle" <te...@gmail.com> wrote:

>Well I have spent the last hour reading over their docs, I love seeing
>high
>traffic projects. I would feel confident in exploring this avenue since
>the
>project seems huge now. I remember 2 years ago it wasn't so large.
>
>I am pretty sure I can do what I need to once I figure out the tool chain.
>
>Seems to me, the hardest part is that middle layer where I have the AS API
>for the native extension and the Cordova plugin. From a distance it looks
>like I could use the same AS.
>
>So it really looks like the project I would have is figuring out actually
>how to write a Cordova app, then figure out how to write a plugin that
>calls my audio engine in a Cordova app. Once I get that working as an
>Android plugin, I will know how I have to translate a FlexJS code base to
>the Cordova plugin spec.
>
>I think I already looked at that code you wrote, need to check it again.
>
>So am I think correct here, eventually it looks like I will need to write
>a
>custom cross compiler emitter for a Cordova plugin correct? Then this
>would
>get hooked and run during the cross compile if the compiler args include
>it.

Maybe.

Here’s how I think about it:

FalconJX handles SWC-based classes (actually, compilation units)
differently from AS and MXML classes.  The compiler cross-compiles all AS
and MXML, but assumes it can find a .js file for every SWC-based class.
That’s how we abstract the differences between Flash and HTML/JS/CSS.  We
hand wrote both a Button.as and a Button.js.  Button.as wraps the Flash
button, Button.js wraps an HTMLElement Button.  The Button.as is compiled
into a SWC and Button.js is included in the same SWC.  FalconJX finds the
Button.js in the SWC and adds that to the JS output by the emitter for the
AS and MXML the app developer wrote.

AIUI, an ANE is included in a project in SWC form.  There is an AS class
compiled into the SWC that represents the AS API surface the rest of the
app uses.  Somehow, this AS wrapper calls the native code.

The Cordova doc seems to imply that you write a JS file in a similar way.
In theory, if you hand wrote this JS file and inserted it in the SWC, the
right thing would just happen.

Once you get to that point, we can see where else the tool chain needs
enhancing to automate various parts of the workflow.  If there is a
different emitter that can auto-generate the JS from the AS then yes, you
will be right.  And maybe something that auto-inserts the JS into a SWC.
But I’d settle for hand-writing and hand-inserting the wrappers as a first
step.

FlexJS should be able to generate a working Cordova app for you.  Try
using the cordova-build.xml file.
Compile an example like DataBindingTest.  Then run "ant -f
cordova-build.xml”  It should ask you about other settings you’ll need.
The final command-line will look something like:

 ant -f cordova-build.xml -DPROJECT_NAME=DataBindingTest
-DTARGET_DIR=<Some output folder> -DPROJECT_DIR=<path to DataBindingTest
folder>

You will need to install Cordova first and the Cordova platform libraries
you want to target.

You are correct that Cordova currently has more traffic.  Last I checked a
year ago, some big players were paying developers to work on it (IBM, MS,
Google, RedHat).  I demoed the FlexJS/Cordova workflow to their former PMC
Chair last year and got a positive response.  It wouldn’t be a bad future
if FlexJS became a popular way to create Cordova apps.  Then we might get
more paid developers helping move FlexJS along.

Good luck and thanks for looking into it,
-Alex


Re: [FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Posted by Michael Schmalle <te...@gmail.com>.
Well I have spent the last hour reading over their docs, I love seeing high
traffic projects. I would feel confident in exploring this avenue since the
project seems huge now. I remember 2 years ago it wasn't so large.

I am pretty sure I can do what I need to once I figure out the tool chain.

Seems to me, the hardest part is that middle layer where I have the AS API
for the native extension and the Cordova plugin. From a distance it looks
like I could use the same AS.

So it really looks like the project I would have is figuring out actually
how to write a Cordova app, then figure out how to write a plugin that
calls my audio engine in a Cordova app. Once I get that working as an
Android plugin, I will know how I have to translate a FlexJS code base to
the Cordova plugin spec.

I think I already looked at that code you wrote, need to check it again.

So am I think correct here, eventually it looks like I will need to write a
custom cross compiler emitter for a Cordova plugin correct? Then this would
get hooked and run during the cross compile if the compiler args include it.

Mike


On Wed, May 13, 2015 at 11:01 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 5/13/15, 6:59 AM, "Michael Schmalle" <te...@gmail.com> wrote:
>
> >Alex,
> >
> >When I said Windows I meant Windows 7. I use it for rapid prototyping.
> >Imagine having an audio DSP core written in C++, I can call C apis from
> >the
> >AIR windows native extensions that I wrapped with C, then I can call those
> >same C apis in Android using Java JNI.
> >
> >So I use Windows for rapid prototyping and testing of the Android mobile
> >app that using the audio DSP core.
> >
> >My question since I am ignorant and really trying to find a real excuse to
> >put some time into FlexJS, do you think it's possible somehow to do the
> >same thing I am doing with testing the AIR app with say FlexJS(SWF) UI
> >calling that surface API for the audio, then have the same API using
> >Cordova for Android, plugging into it's Android plugin system, which the
> >calls the native layer.
> >
> >This is what I am trying to figure out.
>
> So far, from the little I’ve read about Cordova, it makes me think this is
> possible and it would be awesome if you could explore it.
>
> >
> >If I could get this to work, then I would have a complete use case where I
> >can use FlexJS to create the UI that is eventually translated to HTML/CSS
> >for the Android cordova side.
>
> Exactly.  And the upside is that your app could eventually work in a lot
> more places than AIR currently does if you were to write similar platform
> extensions for Windows Phone, etc.
>
> -Alex
>
>

Re: [FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Posted by Alex Harui <ah...@adobe.com>.

On 5/13/15, 6:59 AM, "Michael Schmalle" <te...@gmail.com> wrote:

>Alex,
>
>When I said Windows I meant Windows 7. I use it for rapid prototyping.
>Imagine having an audio DSP core written in C++, I can call C apis from
>the
>AIR windows native extensions that I wrapped with C, then I can call those
>same C apis in Android using Java JNI.
>
>So I use Windows for rapid prototyping and testing of the Android mobile
>app that using the audio DSP core.
>
>My question since I am ignorant and really trying to find a real excuse to
>put some time into FlexJS, do you think it's possible somehow to do the
>same thing I am doing with testing the AIR app with say FlexJS(SWF) UI
>calling that surface API for the audio, then have the same API using
>Cordova for Android, plugging into it's Android plugin system, which the
>calls the native layer.
>
>This is what I am trying to figure out.

So far, from the little I’ve read about Cordova, it makes me think this is
possible and it would be awesome if you could explore it.

>
>If I could get this to work, then I would have a complete use case where I
>can use FlexJS to create the UI that is eventually translated to HTML/CSS
>for the Android cordova side.

Exactly.  And the upside is that your app could eventually work in a lot
more places than AIR currently does if you were to write similar platform
extensions for Windows Phone, etc.

-Alex


Re: [FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Posted by Michael Schmalle <te...@gmail.com>.
Alex,

When I said Windows I meant Windows 7. I use it for rapid prototyping.
Imagine having an audio DSP core written in C++, I can call C apis from the
AIR windows native extensions that I wrapped with C, then I can call those
same C apis in Android using Java JNI.

So I use Windows for rapid prototyping and testing of the Android mobile
app that using the audio DSP core.

My question since I am ignorant and really trying to find a real excuse to
put some time into FlexJS, do you think it's possible somehow to do the
same thing I am doing with testing the AIR app with say FlexJS(SWF) UI
calling that surface API for the audio, then have the same API using
Cordova for Android, plugging into it's Android plugin system, which the
calls the native layer.

This is what I am trying to figure out.

If I could get this to work, then I would have a complete use case where I
can use FlexJS to create the UI that is eventually translated to HTML/CSS
for the Android cordova side.

If this doesn't make sense, let me know.

Mike

On Wed, May 13, 2015 at 9:04 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 5/13/15, 3:21 AM, "Michael Schmalle" <te...@gmail.com> wrote:
>
> >Well I have absolutely NO experience with Cordova, I think years ago I set
> >it up once but that is the extent of my dealings. From what I gather it's
> >an HTML view with hooks down to native correct?
>
> Pretty much, just like AIR is a FP view with hooks down into native.
>
> Both claim you can call OS APIs and Windows DLLs.  Here is a link to
> Cordova’s info:
> http://cordova.apache.org/docs/en/edge/guide_platforms_win8_plugin.md.html
> http://cordova.apache.org/docs/en/3.3.0/guide_platforms_android_plugin.md.h
> tml
>
> Now, I’ve never dealt with AIR Native Extensions directly myself, but IMO,
> the challenge is: for some ANE, can you call same the native code from a
> Cordova Plugin with the “same" API surface for both the ANE and Cordova
> PlugIn, just as we create the same API surfaces for some other FlexJS
> components by writing an AS version and a JS version.
>
> >
> >ASDoc
> >
> >So when you say another form of asdoc tool, what do you actually mean? I
> >am
> >confused about the AIR application, what would it's purpose be?
>
> First, I think a Falcon-based tool to cull the ASDoc annotations into a
> data file still needs finishing.
> I think the current MXMLC-based tool generates XML files that are XSLT’d
> into HTML.  I’m not convinced that the current HTML format is going to be
> sufficient for FlexJS because the current format only knows about public
> vs protected APIs.
>
> In FlexJS there are some components and APIs that you are unlikely to ever
> use in building an application.  The SingleLineBorderBead draws a
> single-line border, but is composited into Container.  If you are building
> a new low-level component, you may need to know about
> SingleLineBorderBead, but most folks are going to use Container.  So my
> temptation is to further annotate SingleLineBorderBead with a @advanced or
> @lowlevel API so it can be filtered out by the doc viewer.
>
> Then, some other beads like the PromptTextBead have a public API for the
> prompt text you’d put in your TextInput, but must also have a public API
> like the strand setter so it can be used as a plug-in/bead on any
> component.  IMO, no need for most folks to view these low-level public
> APIs either.
>
> In the current Flex SDK, APIs like these tend to be protected because we
> use inheritance from base classes, but that isn’t the case in a
> composition pattern.  Other APIs might get excluded from the doc, but I
> don’t think we should be hiding APIs either.  Remember all the complaints
> about private APIs in the current SDK?
>
> So, I’m thinking that XSLT is too hard for most folks to learn in order to
> modify our doc viewer and an AIR app that serves as the doc viewer is
> easier for most folks to work with and also serves as a nice example app.
> I think it might also change the XML format output from the tool that
> scans the source.
>
> Anyway, hope that’s more clear, those are my current thoughts.
>
> Thanks,
> -Alex
>
> >
> >
> >
> >>It would have been icing on the cake if I wasn't using native extensions
> >>for dll on Windows and Java on Android for these apps, then I could
> >>really
> >>test FlexJS. That is also why one thing I might work on is a Web Audio
> >>extensions lib with FlexJS, that is my dream.
> >
> >Besides working on the compiler, I would love it if you created some sort
> >of mobile/desktop plugin workflow for FlexJS.  Just like FlexJS currently
> >generates a SWF for testing and potential deployment then cross-compiles
> >to HTML/JS/CSS, mobile applications for FlexJS should be able to use AIR
> >to run the SWF for testing and cross-compile and generate apps via the
> >Cordova/PhoneGap process.  We have already proven that the Cordova process
> >works for FlexJS for mobile apps that don’t have native extensions.  There
> >is a cordova-build.xml file in the flex-asjs root that will crank the
> >FalconJX output into a Cordova app.  I’ve used it on DataBindingTest, I
> >think Peter has also used it on GoogleMaps.
> >
> >FWIW, another thing I’ve been thinking about is a different sort of ASDoc
> >tool.  Now that the classes in FlexJS are made up of small composited
> >pieces, the public API seems like it needs sub-division: public APIs that
> >application developers are likely to use, and public APIs that the
> >developers of the small pieces are likely to use.  In my mind it would be
> >an AIR app and we’d add more asdoc annotations to APIs to help
> >differentiate them, but I could be totally wrong about that.
> >
> >Food for thought,
> >-Alex
>
>

Re: [FlexJS] Cordova. ASDoc (continuing from [FlexMojo] build)

Posted by Alex Harui <ah...@adobe.com>.

On 5/13/15, 3:21 AM, "Michael Schmalle" <te...@gmail.com> wrote:

>Well I have absolutely NO experience with Cordova, I think years ago I set
>it up once but that is the extent of my dealings. From what I gather it's
>an HTML view with hooks down to native correct?

Pretty much, just like AIR is a FP view with hooks down into native.

Both claim you can call OS APIs and Windows DLLs.  Here is a link to
Cordova’s info:
http://cordova.apache.org/docs/en/edge/guide_platforms_win8_plugin.md.html
http://cordova.apache.org/docs/en/3.3.0/guide_platforms_android_plugin.md.h
tml

Now, I’ve never dealt with AIR Native Extensions directly myself, but IMO,
the challenge is: for some ANE, can you call same the native code from a
Cordova Plugin with the “same" API surface for both the ANE and Cordova
PlugIn, just as we create the same API surfaces for some other FlexJS
components by writing an AS version and a JS version.

>
>ASDoc
>
>So when you say another form of asdoc tool, what do you actually mean? I
>am
>confused about the AIR application, what would it's purpose be?

First, I think a Falcon-based tool to cull the ASDoc annotations into a
data file still needs finishing.
I think the current MXMLC-based tool generates XML files that are XSLT’d
into HTML.  I’m not convinced that the current HTML format is going to be
sufficient for FlexJS because the current format only knows about public
vs protected APIs.

In FlexJS there are some components and APIs that you are unlikely to ever
use in building an application.  The SingleLineBorderBead draws a
single-line border, but is composited into Container.  If you are building
a new low-level component, you may need to know about
SingleLineBorderBead, but most folks are going to use Container.  So my
temptation is to further annotate SingleLineBorderBead with a @advanced or
@lowlevel API so it can be filtered out by the doc viewer.

Then, some other beads like the PromptTextBead have a public API for the
prompt text you’d put in your TextInput, but must also have a public API
like the strand setter so it can be used as a plug-in/bead on any
component.  IMO, no need for most folks to view these low-level public
APIs either.

In the current Flex SDK, APIs like these tend to be protected because we
use inheritance from base classes, but that isn’t the case in a
composition pattern.  Other APIs might get excluded from the doc, but I
don’t think we should be hiding APIs either.  Remember all the complaints
about private APIs in the current SDK?

So, I’m thinking that XSLT is too hard for most folks to learn in order to
modify our doc viewer and an AIR app that serves as the doc viewer is
easier for most folks to work with and also serves as a nice example app.
I think it might also change the XML format output from the tool that
scans the source.

Anyway, hope that’s more clear, those are my current thoughts.

Thanks,
-Alex

>
>
>
>>It would have been icing on the cake if I wasn't using native extensions
>>for dll on Windows and Java on Android for these apps, then I could
>>really
>>test FlexJS. That is also why one thing I might work on is a Web Audio
>>extensions lib with FlexJS, that is my dream.
>
>Besides working on the compiler, I would love it if you created some sort
>of mobile/desktop plugin workflow for FlexJS.  Just like FlexJS currently
>generates a SWF for testing and potential deployment then cross-compiles
>to HTML/JS/CSS, mobile applications for FlexJS should be able to use AIR
>to run the SWF for testing and cross-compile and generate apps via the
>Cordova/PhoneGap process.  We have already proven that the Cordova process
>works for FlexJS for mobile apps that don’t have native extensions.  There
>is a cordova-build.xml file in the flex-asjs root that will crank the
>FalconJX output into a Cordova app.  I’ve used it on DataBindingTest, I
>think Peter has also used it on GoogleMaps.
>
>FWIW, another thing I’ve been thinking about is a different sort of ASDoc
>tool.  Now that the classes in FlexJS are made up of small composited
>pieces, the public API seems like it needs sub-division: public APIs that
>application developers are likely to use, and public APIs that the
>developers of the small pieces are likely to use.  In my mind it would be
>an AIR app and we’d add more asdoc annotations to APIs to help
>differentiate them, but I could be totally wrong about that.
>
>Food for thought,
>-Alex