BowlerHatLLC / asconfigc

Command line utility that builds ActionScript projects configured with an asconfig.json file.
https://www.npmjs.com/package/asconfigc
Apache License 2.0
18 stars 5 forks source link

"type": "lib" is not working #16

Closed Harbs closed 6 years ago

Harbs commented 6 years ago

I have a asconfig.json file which looks like this:

{
    "config": "royale",
    "type": "lib",
    "compilerOptions": {
        "debug": true,
        "js-output-type": "royale",
        "define": [
            {
                "name": "COMPILE::SWF",
                "value": false
            },
            {
                "name": "COMPILE::JS",
                "value": true
            }
        ]
    },
    "files":
    [
        "src/main/royale/TestingClasses.as"
    ]
}

I'm getting an error when trying to compile it:

Error: Invalid asconfig.json file. /Users/harbs/Documents/ApacheRoyale/royale-asjs/frameworks/projects/Testing/asconfig.json
[ { path: '', keyword: 'oneOf' } ]

Removing the "lib" option or changing it to "app", makes the error go away.

joshtynjala commented 6 years ago

Instead of files, give include-classes or include-sources in compilerOptions a try. You may also need source-path.

By the way, you definitely should use targets instead of js-output-type now. I plan to drop support for it in the future.

Harbs commented 6 years ago

Thanks that works, but I have another issue:

{
    "config": "royale",
    "type": "lib",
    "compilerOptions": {
        "debug": true,
        "targets": [
            "JSRoyale"
        ],
        "include-classes": [
            "TestingClasses"
        ],
        "include-sources": [
            "src/main/royale"
        ],
        "output": "target/Testing.swc",
        "define": [
            {
                "name": "COMPILE::SWF",
                "value": false
            },
            {
                "name": "COMPILE::JS",
                "value": true
            }
        ]
    }
}

This works to output the files, but only if the SWC file already exists. Typically, using ant, there is a two step process where the SWC is created and then the js files are added to that. I don't know how/if there's an easy way to do this using asconfigc.

Also, I'm struggling with defining different compile configs for different targets. This might be a more general compiler problem, but I'm not sure if there's a way to compile to two different targets using different compile configs using a single asconfigc file.

Harbs commented 6 years ago

Got it! :sunglasses: I should not have been using define. The compiler takes care of that automatically.

{
    "config": "royale",
    "type": "lib",
    "compilerOptions": {
        "debug": true,
        "targets": [
            "SWF",
            "JSRoyale"
        ],
        "include-classes": [
            "TestingClasses"
        ],
        "include-sources": [
            "src/main/royale"
        ],
        "library-path": [
            "../../../../flex-flexunit/FlexUnit4/target/flexunit-4.3.0-20140410-as3_4.12.0.swc"
        ],
        "output": "target/Testing.swc"
    }
}