You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Josh Tynjala <jo...@gmail.com> on 2017/01/11 19:51:27 UTC

[FalconJX] Output path

MXMLFlexJSPublisher contains the following code that is run when no output
path is specified in the compiler options:

//begin code
String mainClassFolder = configuration.getTargetFileDirectory();
if (mainClassFolder.endsWith("src"))
    outputParentFolder = new
File(configuration.getTargetFileDirectory()).getParentFile();
else if (mainClassFolder.endsWith("src/main/flex") ||
mainClassFolder.endsWith("src\\main\\flex"))
    outputParentFolder = new
File(configuration.getTargetFileDirectory()).getParentFile().getParentFile().getParentFile();
else
    outputParentFolder = new File(configuration.getTargetFileDirectory());
//end code

In plain English:

1. If the main class is in a src directory, bin will be created in the
parent directory of src.

2. If the main class is in a src/main/flex directory (in other words, if
it's a Maven project), bin will be created in ../../..

3. Otherwise, bin will be created in the same directory as the main class.

I often use "source" rather than "src", so I was getting source/bin as my
output directory, which was unexpected.

Rather than hardcoding a couple of special paths, maybe we should create
bin relative to the current working directory instead. I think that's a
common behavior for command line tools.

With this change, both of these commands should continue to work exactly
the same way:

mxmlc src/Main.mxml
mxmlc src/main/flex/Main.mxml

I assume that Maven sets the CWD to the correct location before it runs the
compiler too.

This would also allow other build tools with different project structures
to work without modifying the compiler.

Thoughts?

- Josh

Re: [FalconJX] Output path

Posted by Alex Harui <ah...@adobe.com>.
I don't think we have to keep things the way they are, but I know that
using current directory would definitely mess me up because I'm used to
the way MXMLC works.

In a brief check of compilers, javac, tsc and the regular MXMLC all
default to placing the compiled file next to the source file.  FalconJX
(MXMLJSC) could do the same, but it also generates a ton of other files,
copying in Google Closure Library and JS files from the SWCs, so having
all of that output in a folder is easier to clean up.

Thoughts?
-Alex

On 1/11/17, 11:51 AM, "Josh Tynjala" <jo...@gmail.com> wrote:

>MXMLFlexJSPublisher contains the following code that is run when no output
>path is specified in the compiler options:
>
>//begin code
>String mainClassFolder = configuration.getTargetFileDirectory();
>if (mainClassFolder.endsWith("src"))
>    outputParentFolder = new
>File(configuration.getTargetFileDirectory()).getParentFile();
>else if (mainClassFolder.endsWith("src/main/flex") ||
>mainClassFolder.endsWith("src\\main\\flex"))
>    outputParentFolder = new
>File(configuration.getTargetFileDirectory()).getParentFile().getParentFile
>().getParentFile();
>else
>    outputParentFolder = new File(configuration.getTargetFileDirectory());
>//end code
>
>In plain English:
>
>1. If the main class is in a src directory, bin will be created in the
>parent directory of src.
>
>2. If the main class is in a src/main/flex directory (in other words, if
>it's a Maven project), bin will be created in ../../..
>
>3. Otherwise, bin will be created in the same directory as the main class.
>
>I often use "source" rather than "src", so I was getting source/bin as my
>output directory, which was unexpected.
>
>Rather than hardcoding a couple of special paths, maybe we should create
>bin relative to the current working directory instead. I think that's a
>common behavior for command line tools.
>
>With this change, both of these commands should continue to work exactly
>the same way:
>
>mxmlc src/Main.mxml
>mxmlc src/main/flex/Main.mxml
>
>I assume that Maven sets the CWD to the correct location before it runs
>the
>compiler too.
>
>This would also allow other build tools with different project structures
>to work without modifying the compiler.
>
>Thoughts?
>
>- Josh


Re: [FalconJX] Output path

Posted by Christofer Dutz <ch...@c-ware.de>.
Well the Maven build shouldn’t care at all as the output path is always set in the build and it’s never built using the CWD as for a maven multi-module build is always the directory where the build was started (so in case of a multi-module build it could be some directory other than the current modules directory)

Chris

Am 11.01.17, 20:51 schrieb "Josh Tynjala" <jo...@gmail.com>:

    MXMLFlexJSPublisher contains the following code that is run when no output
    path is specified in the compiler options:
    
    //begin code
    String mainClassFolder = configuration.getTargetFileDirectory();
    if (mainClassFolder.endsWith("src"))
        outputParentFolder = new
    File(configuration.getTargetFileDirectory()).getParentFile();
    else if (mainClassFolder.endsWith("src/main/flex") ||
    mainClassFolder.endsWith("src\\main\\flex"))
        outputParentFolder = new
    File(configuration.getTargetFileDirectory()).getParentFile().getParentFile().getParentFile();
    else
        outputParentFolder = new File(configuration.getTargetFileDirectory());
    //end code
    
    In plain English:
    
    1. If the main class is in a src directory, bin will be created in the
    parent directory of src.
    
    2. If the main class is in a src/main/flex directory (in other words, if
    it's a Maven project), bin will be created in ../../..
    
    3. Otherwise, bin will be created in the same directory as the main class.
    
    I often use "source" rather than "src", so I was getting source/bin as my
    output directory, which was unexpected.
    
    Rather than hardcoding a couple of special paths, maybe we should create
    bin relative to the current working directory instead. I think that's a
    common behavior for command line tools.
    
    With this change, both of these commands should continue to work exactly
    the same way:
    
    mxmlc src/Main.mxml
    mxmlc src/main/flex/Main.mxml
    
    I assume that Maven sets the CWD to the correct location before it runs the
    compiler too.
    
    This would also allow other build tools with different project structures
    to work without modifying the compiler.
    
    Thoughts?
    
    - Josh