BowlerHatLLC / vscode-as3mxml

ActionScript & MXML language extension for Visual Studio Code. Develop apps for Adobe AIR, Adobe Flash Player, or Apache Royale.
https://as3mxml.com/
Apache License 2.0
257 stars 39 forks source link

Version 1.20.0 fails to compile if path to main class contains spaces (Windows) #726

Closed esidegallery closed 8 months ago

esidegallery commented 9 months ago

In version 1.19.0, the mxmlc build command referenced the main class relatively e.g. -- src\App.mxml.

However, version 1.20.0 references it absolutely e.g. -- C:\My Project\src\App.mxml

The above example would result in the following error:

Error: unable to open 'Project\src\App.mxml'

joshtynjala commented 9 months ago

Thanks! I'll try to get it fixed soon.

joshtynjala commented 9 months ago

It appears that you are using the npm version of asconfigc instead of the bundled version. I just published a new update for the npm asconfigc that fixes this issue, so please update it with npm install -g asconfigc.

esidegallery commented 9 months ago

Thanks Josh - I do have node installed, but as far as I know, I've never installed the npm version of asconfigc. Where would I need to look to find out and how can I set it to use the bundled version?

EDIT: In the extension settings, Use Bundled is checked

joshtynjala commented 9 months ago

I was unable to reproduce with the bundled version, but I could with the npm version, so I assumed that you were using the npm version.

I was testing on macOS, so maybe it is Windows only.

esidegallery commented 9 months ago

That certainly wouldn't surprise me 🙄

mrfrasier commented 9 months ago

I guess my vscode automatically updated and I'm now hitting his error as well. I'm not using npm (don't even have node installed). Is there a workaround aside from relocating the project?

edit forgot VS Code gives you a convenient way to downgrade extensions. Jumping back to 1.19 fixed it for me.

joshtynjala commented 9 months ago

I just checked on Windows, and I can't reproduce there either. My project directory has a space in the name, and I can see that the full path with the space is being passed to mxmlc.

Which version of the Java JDK are you using? Perhaps, it might be worth trying to get a more recent update. Maybe an older build had a bug in Java's ProcessBuilder.

mrfrasier commented 9 months ago

I just checked on Windows, and I can't reproduce there either. My project directory has a space in the name, and I can see that the full path with the space is being passed to mxmlc.

Which version of the Java JDK are you using? Perhaps, it might be worth trying to get a more recent update. Maybe an older build had a bug in Java's ProcessBuilder.

Is this what you were looking for?

java --version
java 11.0.3 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
joshtynjala commented 9 months ago

Is this what you were looking for?

Yes. I see you're using an update that is nearly five years old. You might try a newer Java 11 update to see if it makes a difference.

mrfrasier commented 9 months ago

Haha that's fair but given all the SDK juggling that goes on I tend to stick with what works until it doesn't. I'd hate to update and break something else somewhere!

esidegallery commented 8 months ago

I'm using JDK 15.0.2 due to issue #687. I'll see what happens with a newer version today. Which version did you test with, Josh?

EDIT: Didn't realise that issue is now closed! Will upgrade JDK and report back.

UPDATE: Tried with JDK 17 and 21 but issue persists 😞

esidegallery commented 8 months ago

Found a workaround: In asconfig.json, if I change "mainClass": "App" to "files": ["src/App.mxml"] the problem is resolved.

mrfrasier commented 8 months ago

I'm using JDK 15.0.2 due to issue #687. I'll see what happens with a newer version today. Which version did you test with, Josh?

Haha, these are the types of reasons that keep me on a single working release unless I absolutely have to.

Found a workaround: In asconfig.json, if I change "mainClass": "App" to "files": ["src/App.mxml"] the problem is resolved.

When I tried that I was still getting the relative path issue since my main class file was in the same folder. Ah well, downgrading for now fixes it.

esidegallery commented 8 months ago

Strange - did you completely remove the mainClass entry? In my case both resolved files are in the same folder (indeed they are the same file) but the generated mxmlc command is different.

mrfrasier commented 8 months ago

Strange - did you completely remove the mainClass entry? In my case both resolved files are in the same folder (indeed they are the same file) but the generated mxmlc command is different.

Hmm, will try it again if I have to upgrade. Playing it safe for now haha

joshtynjala commented 8 months ago

I'm using JDK 15.0.2 due to issue https://github.com/BowlerHatLLC/vscode-as3mxml/issues/687. I'll see what happens with a newer version today.

As I recall, issue #687 was fixed in vscode-as3mxml v1.18.0. I have not encountered the duplicate function definition error in some time.

Which version did you test with, Josh?

I have the following JDK versions on my Windows machine. I tested them all successfully.

jdk-8.0.392.8-hotspot jdk-11.0.21.9-hotspot jdk-17.0.8.101-hotspot jdk-21.0.0.35-hotspot

joshtynjala commented 8 months ago

Strange - did you completely remove the mainClass entry? In my case both resolved files are in the same folder (indeed they are the same file) but the generated mxmlc command is different.

I'll just confirm that if you switch to files as a workaround, you should completely remove mainClass. It doesn't report an error because there may be legitimate reasons to have both, but generally, that's rare.

joshtynjala commented 8 months ago

UPDATE: Tried with JDK 17 and 21 but issue persists 😞

This issue or #687?

joshtynjala commented 8 months ago

Can one of you try to create a simple new project that reproduces the issue and attach it here? It is very strange that I cannot reproduce what appears to be pretty straightforward. It makes me think that there might be something else common to your projects (maybe something else in your asconfig.json files) that I might be missing.

esidegallery commented 8 months ago

UPDATE: Tried with JDK 17 and 21 but issue persists 😞

This issue or #687?

No, this issue - not getting any duplicate function definition errors since updating 👍

Can one of you try to create a simple new project that reproduces the issue and attach it here? It is very strange that I cannot reproduce what appears to be pretty straightforward. It makes me think that there might be something else common to your projects (maybe something else in your asconfig.json files) that I might be missing.

I'll try and get a project that reproduces tomorrow.

esidegallery commented 8 months ago

I created this project using the ActionScript: Create New Project command. The project folder was in the root of the C: drive. Using "mainClass" didn't build. Changing to "files" did. The issue occurs on 2 separate PCs - one with Win 10 and one with Win 11.

Test Project.zip

p.s. The create new project command is very handy! It would be even better if it automatically set renderMode in the app.xml for new Feathers projects.

joshtynjala commented 8 months ago

Even with your example project, I still cannot reproduce the issue. I extracted the contents of the .zip file to C:\Test Project. I copied a Feathers SDK to c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116, just to ensure that that would have spaces in the path too, just in case that was related. I confirmed that asconfig.json is using mainClass and not files. However, it is correctly handling all of the spaces.

I'm on Windows 11 Pro 22H2.

Below is the output when I run the ActionScript: compile debug - asconfig.json task (I have the as3mxml.asconfigc.verboseOutput setting enabled):

* Executing task: C:\Program Files\Eclipse Adoptium\jdk-11.0.21.9-hotspot\bin\java.exe -jar c:\Users\josht.vscode\extensions\bowlerhatllc.vscode-as3mxml-1.20.0\bin\asconfigc.jar --sdk c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116 --debug=true --project c:\Test Project\asconfig.json --unpackage-anes=true --verbose=true

Configuration file: c:\Test Project\asconfig.json Reading configuration file... Validating configuration file... Parsing configuration file... SDK: c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116 Processing Adobe AIR application descriptor(s)... Initial window content: TestProject.swf Descriptor: c:\Test Project\src\TestProject-app.xml Compiling application... C:\Program Files\Eclipse Adoptium\jdk-11.0.21.9-hotspot\bin\java -Dflexcompiler=c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116 -Dflexlib=c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116\frameworks -jar c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116\lib\mxmlc.jar +flexlib=c:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116\frameworks --debug=true +configname=air --source-path+=src --library-path+=libs --output=bin/TestProject.swf -- c:\Test Project\src\TestProject.mxml Loading configuration file C:\Software\ActionScript & MXML SDKs\Feathers 4.1.1 + AIR 32.0.0.116\frameworks\air-config.xml C:\Test Project\bin\TestProject.swf (326759 bytes) * Terminal will be reused by tasks, press any key to close it.

Can you also set as3mxml.asconfigc.verboseOutput to true, try to build, and then copy and paste the output here. Maybe I'll see a clue.

esidegallery commented 8 months ago

Hmm, OK. I was still getting the issue, but noticed that I wasn't getting the output you were. That's when I realised the problem only occurs with Quick Compile. I hadn't gone as far as testing a proper compile, but it worked when I just tried it now. Are you able to Quick Compile, Josh?

joshtynjala commented 8 months ago

There's the difference. I can reproduce with the Quick Compile commands.

esidegallery commented 8 months ago

🤦‍♂️ Sorry I wasn't more thorough, Josh!

mrfrasier commented 8 months ago

🤦‍♂️ Sorry I wasn't more thorough, Josh!

Once it didn't work with quick compile, I didn't even think to try a deeper compile either.

joshtynjala commented 8 months ago

Hmmm... interesting. The Flex Compiler SHell doesn't seem to support arguments with spaces. Quotes around them don't seem to work, and I can't find an escape character either. That's going to make this more complicated.

joshtynjala commented 8 months ago

v1.20.1 has been released with a fix for this issue.