joshtynjala commented on issue #240:
URL: 
https://github.com/apache/royale-compiler/issues/240#issuecomment-2583331541

   The word "relatively" is probably doing a lot of work in that sentence. 😆 
   
   `MXMLJSC` is the main entry point of the app compiler:
   
   
https://github.com/apache/royale-compiler/blob/develop/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
   
   In the `_mainNoExit` method, it loops through the `targets` compiler option 
and runs a separate implementation of the `JSCompilerEntryPoint` interface for 
each target.
   
   It also defines an enum called `JSTargetType` which includes all of the 
supported targets. That name is probably not ideal, because it also includes 
`SWF`, and presumably, any other new non-JS target that you'd wish to add. 
Regardless, if you want a new output format, you'd need a new entry in that 
enum for it.
   
   (There's also `COMPJSC` for building SWC libraries, which is set up 
similarly: 
https://github.com/apache/royale-compiler/blob/develop/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java)
   
   `MXMLJSCRoyale` is the implementation of the `JSCompilerEntryPoint` for the 
"JSRoyale" target.
   
   
https://github.com/apache/royale-compiler/blob/develop/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
   
   In the constructor, it creates a "backend". In this case 
`MXMLRoyaleBackend`, which extends from `MXMLBackend` and `JSBackend`.
   
   
https://github.com/apache/royale-compiler/blob/develop/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/mxml/royale/MXMLRoyaleBackend.java
   
   The backend is a kind of factory for a number of things involved in the 
compilation. The most relevant ones are:
   
   - Emitters: Generates the code for the new target. For a native target, 
these might generate the contents of .c or .cpp files.
   - Writers: Takes the code generated by the emitters, and writes them to 
output streams (generally, to the file system, but I recall that creating SWCs 
involves different types of streams because it eventually all gets zipped up in 
the SWC).
   - Publisher: Everything else that might need to be done after the target's 
code has been generated. For JS targets, this includes bundling the separate 
.js files into a single file for release builds, generating HTML files, and 
copying assets. For a native target, this could potentially involve running a C 
compiler to produce an executable.
   
   There are also "Targets", "Walkers", and some other things. I don't have 
time to explain more right now, but this might be enough to give you a starting 
point for diving into the codebase.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@royale.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to