I'm trying now to compile the AS files in conditional compilation with COMPILE::AS3, because the first phase of the compilation is COMPILE::JS, I have JS.swc in my library-path.
I was aware that some conflicts could occur for example the Event class, so I had the idea to introduce a new configuration variable "exclude-native-js-libraries" that the compiler client set to true when is in phase to COMPILE::AS3, the idea behind was to allow me, after the configuration merge, at configuration validation time, to remove the Native JS libraries (externs) from the list of library-path and external-library-path, at the moment, I check the path contains "js/libs" only, it is to be improved. The code bellow shows how I do and when I inspect the ConfigurationBuffer at the end of the method, the JS.swc is removed as expected, the problem is that I still had some AmbiguousDefinition, after a bit of debug, checking at the scope file, I've seen one of them was in the JS.swc, it was included despite I removed it from the merged ConfigurationBuffer. What did I miss ? /** * Validate configuration options values. * * @param configurationBuffer Configuration buffer. * @throws ConfigurationException Error. */ public void validate(ConfigurationBuffer configurationBuffer) throws ConfigurationException { // process the merged configuration buffer. right, can't just process the args. processDeprecatedAndRemovedOptions(configurationBuffer); removeNativeJSLibrariesIfNeeded(configurationBuffer, "compiler.library-path"); removeNativeJSLibrariesIfNeeded(configurationBuffer, "compiler.external-library-path"); validateDumpConfig(configurationBuffer); } private void removeNativeJSLibrariesIfNeeded(ConfigurationBuffer buffer, String libraryPathVariable) throws ConfigurationException { boolean excludeNativeJS = false; try { final String configurationVar = buffer.peekSimpleConfigurationVar("exclude-native-js-libraries"); if (configurationVar != null) { excludeNativeJS = configurationVar.equals(Boolean.TRUE.toString()); } } catch (ConfigurationException ignored) { } if (excludeNativeJS) { List<ConfigurationValue> libPaths = null; try { libPaths = buffer.peekConfigurationVar(libraryPathVariable); } catch (ConfigurationException ignored) { } if (libPaths != null) { final ConfigurationValue configurationValue = libPaths.get(0); final List<String> paths = configurationValue.getArgs(); Iterator<String> pathIterator = paths.iterator(); while (pathIterator.hasNext()) { final String path = pathIterator.next(); final boolean isNativeJS = path.contains("js/libs"); if (isNativeJS) { pathIterator.remove(); } } buffer.setVar(libraryPathVariable, paths, configurationValue.getSource() + ".updated", configurationValue.getLine()); } } } Frédéric THOMAS ---------------------------------------- > From: webdoubl...@hotmail.com > To: dev@flex.apache.org > Subject: RE: Re : Re: [FlexJS] Framework using externs (was: Setup Error) > Date: Mon, 10 Aug 2015 19:05:54 +0100 > > I even removed the entire <library-path> section and I've have no compilation > errors and the core tests passes, is that enough to ensure it can be safely > removed ? > > Another thing, I see that in BrowserEvent.js > > /** > * @type {?goog.events.BrowserEvent} > */ > org.apache.flex.events.BrowserEvent.prototype.wrappedEvent = null; > > There is no extern definition for the GCL, I type those as Object, is it fine > ? > > Except of that, after some tweaking, BrowserEvent.as cross compiles and I > have the @exports back, it was probably due to some config problem when > trying to compile both AS3 / JS. > > I added some missing potentially other properties and functions to this > class, one of them required an enum, instead, I did like that: > > package org.apache.flex.core.BrowserEvent { > > COMPILE::AS3 > internal class MouseButton {} > > COMPILE::JS > public class MouseButton { > public static const LEFT:MouseButton = new MouseButton(0, "LEFT"); > public static const MIDDLE:MouseButton = new MouseButton(1, "MIDDLE"); > public static const RIGHT:MouseButton = new MouseButton(2, "RIGHT"); > > private var _index:uint; > private var _name:String; > > public function MouseButton(index:uint, name:String):void { > _index = index; > _name = name; > > } > > public function get index():uint { > return _index; > } > > public function get name():String { > return _name; > } > } > } > > > Is it ok or it is overkilling ? > > As you can noticed, I had to create an empty AS3 internal class otherwise the > sources are not found for the COMPILE::JS only classes. > > Frédéric THOMAS > > > ---------------------------------------- >> From: aha...@adobe.com >> To: dev@flex.apache.org >> Subject: Re: Re : Re: [FlexJS] Framework using externs (was: Setup Error) >> Date: Mon, 10 Aug 2015 13:07:35 +0000 >> >> Hmm, might be a copy/paste error. Try removing HTML and Charts and see if >> you get an error. >> >> -Alex >> >> On 8/10/15, 5:57 AM, "Frédéric THOMAS" <webdoubl...@hotmail.com> wrote: >> >>>Hi Alex, >>> >>>I don't understand why we have that in >>>frameworks\projects\Core\compile-asjs-config.xml >>> >>><library-path> >>> >>> <path-element>../../libs/Core.swc</path-element> >>> <path-element>../../libs/Graphics.swc</path-element> >>> <path-element>../../libs/HTML.swc</path-element> >>> <path-element>../../libs/Charts.swc</path-element> >>></library-path> >>> >>>It looks like circular dependency, could you explain ? >>> >>>Thanks, >>>Frédéric THOMAS >>> >>> >>>---------------------------------------- >>>> From: webdoubl...@hotmail.com >>>> To: dev@flex.apache.org >>>> Subject: RE: Re : Re: [FlexJS] Framework using externs (was: Setup >>>>Error) >>>> Date: Sun, 9 Aug 2015 16:42:19 +0100 >>>> >>>>> If that's the core swc then that's a mistake. Svg manifest should be >>>>>in html project >>>> >>>> Ok, thanks, will start migrating JS to AS in my next session. >>>> >>>> Frédéric THOMAS >>>> >>>> >>>> ---------------------------------------- >>>>> From: aha...@adobe.com >>>>> To: webdoubl...@hotmail.com; dev@flex.apache.org >>>>> Subject: Re: Re : Re: [FlexJS] Framework using externs (was: Setup >>>>>Error) >>>>> Date: Sun, 9 Aug 2015 15:32:41 +0000 >>>>> >>>>> If that's the core swc then that's a mistake. Svg manifest should be >>>>>in html project >>>>> >>>>> >>>>> Sent from my LG G3, an AT&T 4G LTE smartphone >>>>> >>>>> >>>>> ------ Original message------ >>>>> >>>>> From: Frédéric THOMAS >>>>> >>>>> Date: Sun, Aug 9, 2015 8:16 AM >>>>> >>>>> To: dev@flex.apache.org; >>>>> >>>>> Subject:RE: Re : Re: [FlexJS] Framework using externs (was: Setup >>>>>Error) >>>>> >>>>> >>>>> @Alex, >>>>> >>>>> Except of the @export, I've got an issue with: >>>>> >>>>> <include-namespaces> >>>>> <uri>library://ns.apache.org/flexjs/basic</uri> >>>>> <uri>library://ns.apache.org/flexjs/svg</uri> >>>>> </include-namespaces> >>>>> >>>>> >>>>> TextButton is not found in library://ns.apache.org/flexjs/svg, where >>>>>is the manifest ? I'm a bit confuse here. >>>>> >>>>> If I remove it from include-namespace, I can now compile Core in >>>>>IntelliJ with only one build configuration, it generates all the JS and >>>>>the SWC in a once, not sure it is a valid SWC yet given I had to remove >>>>>this namespace, in more I didn't migrate the JS to AS yet, I copy them >>>>>into the SWC at the moment but my other test project tells me that I'm >>>>>on the right way because it uses conditional compilation and I can >>>>>generate the JS and SWC in a once too and it works. >>>>> >>>>> Frédéric THOMAS >>>>> >>>>> >>>>> ---------------------------------------- >>>>>> Date: Sun, 9 Aug 2015 12:28:51 +0100 >>>>>> Subject: Re : Re: [FlexJS] Framework using externs (was: Setup Error) >>>>>> From: webdoubl...@hotmail.com >>>>>> To: dev@flex.apache.org >>>>>> >>>>>> That's that Mike. >>>>>> I don't use the externc. >>>>>> >>>>>> --- Message initial --- >>>>>> >>>>>> De : "Michael Schmalle" <teotigraphix...@gmail.com> >>>>>> Envoyé : 9 août 2015 11:59 >>>>>> A : dev@flex.apache.org >>>>>> Objet : Re: [FlexJS] Framework using externs (was: Setup Error) >>>>>> >>>>>> On Sun, Aug 9, 2015 at 1:06 AM, Alex Harui <aha...@adobe.com> wrote: >>>>>> >>>>>>> >>>>>>> >>>>>>> On 8/8/15, 12:38 PM, "Michael Schmalle" <teotigraphix...@gmail.com> >>>>>>>wrote: >>>>>>> >>>>>>>>On Sat, Aug 8, 2015 at 1:39 PM, Frédéric THOMAS >>>>>>>><webdoubl...@hotmail.com> >>>>>>>>wrote: >>>>>>>> >>>>>>>>> Also, What to do to keep as doc, I've been trying -keep-asdoc but >>>>>>>>> >>>>>>>>> >>>>>>>>Fred, I looked at the code quickly, this should work right now and >>>>>>>>-keep-asdoc is ONLY for the @param description etc. >>>>>>> >>>>>>> It is supposed to grab all of the asdoc from the AS and append to the >>>>>>> JSDoc. It sounds like the JSDoc emitter isn’t wired up correctly, >>>>>>>and it >>>>>>> is possible that the asdoc delegate is no longer configured >>>>>>>correctly for >>>>>>> externs. >>>>>>> >>>>>>> -Alex >>>>>>> >>>>>>> >>>>>> What is this thread actually about, I was aware of what was being >>>>>>copied >>>>>> but I thought this was about porting FlexJS .js code to AS classes. >>>>>> >>>>>> Is Fred making extern files for FlexJS code? If he is porting, then >>>>>>he is >>>>>> using the FlexJS emitter, I didn't do anything weird, is he using the >>>>>>JSC >>>>>> compiler? >>>>>> >>>>>> Mike >>>>> >>>> >>> >> >