Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Flex Home Dependency for Java Ant #938

Closed
JoelProminic opened this issue Nov 23, 2021 · 10 comments
Closed

Remove Flex Home Dependency for Java Ant #938

JoelProminic opened this issue Nov 23, 2021 · 10 comments

Comments

@JoelProminic
Copy link
Contributor

Currently, when I try to run an Ant script in Moonshine (i.e. for #668), I am prompted to set Flex Home. However, this setting does not make sense for Java projects, and in the case that a user only wants to use Moonshine for JAVA, this would be frustrating.

I think this prompt is generally unnecessarily now - instead, we should rely on the script that sets the environment to match the Moonshine settings.

Unfortunately, this error triggers very inconsistently for me. I have seen it the first time when running an Ant file after updating, but it didn't trigger after restarting Moonshine.

I assigned this to 3.3.0, but it could easily be moved to a later release if it is not an easy fix.

@rat-moonshine
Copy link
Collaborator

rat-moonshine commented Nov 24, 2021

As I have expressed my thought to @JoelProminic earlier that this popup/tab was a very old implementation. Probably in earlier days of Moonshine this tab/popup being created to support Flex (mainly) project build with Ant in a pre-conditioned state. I don't think this popup/tab is valid anymore since many changes on handling underlying SDKs in Moonshine.

However, this also triggered for me recently 2/3 times during my tests with #932 , else I forgot about this popup.

Looking into the codes for AntBuildPlugin it turns out that it was still checking for default-SDK if blank and Ant is not available - and triggers the popup. As @JoelProminic expressed that asking Flex SDK to run arbitrary Ant script doesn't make sense anymore and when we manages SDKs during a build/run differently now, this popup is obsolete and I agreed with him.

I made sure that this popup will not trigger anymore. If default-SDK is missing and running Ant script requires any particular SDK - the Ant script itself needs to be responsible to notify accordingly. In case of Ant path is missing then Moonshine will open its Settings page in a fashioned manner.

Please, check.

(On a side note, I felt this plugin class is way too complicated to understand, it's possible because of many conditional state it's checking. But still I think this class requires a thorough cleanup. Currently this not scope of this issue, so I leave it alone.)

@rat-moonshine rat-moonshine added the test ready Feature/bug ready for testing label Nov 24, 2021
@JoelProminic
Copy link
Contributor Author

When I tried running an Ant script with Right-click > Run Ant File today, I got this error:

: Error #1009
: TypeError: Error #1009
: 	at actionScripts.plugins.ant::AntBuildPlugin/startAntProcess()
: 	at actionScripts.plugins.ant::AntBuildPlugin/antBuildSelected()
: 	at actionScripts.plugins.ant::AntBuildPlugin/antBuildHandler()
: 	at actionScripts.plugins.ant::AntBuildPlugin/runAntScriptHandler()
: 	at flash.events::EventDispatcher/dispatchEvent()
: 	at components.views.project::TreeView/handleNativeMenuItemClick()
: 	at flash.events::EventDispatcher/dispatchEvent()
: 	at mx.core::UIComponent/dispatchEvent()
: 	at actionScripts.ui.renderers::FTETreeItemRenderer/redispatch()
: 	at flash.display::NativeMenu/display()
: 	at flash.ui::ContextMenu/display()
: 	at flash.display::InteractiveObject/onContextMenuEvent()
:
: Click here to Report a Bug

When I then tried Others > Build Apache Ant File, it did not prompt me to select the script, but instead ran the above script.

When I tried Right-click > Run Ant File again for the same file, the script ran properly.

Could this error have triggered because the Ant dialog was removed?

@JoelProminic
Copy link
Contributor Author

Testing with a Flex project from the Moonshine template, I see that the main build actions fail in the compileAIR step. I can't see the original error because of #932

Right-click > Run Ant File
Project > Build with Apache Ant:

: Ant build Running
: /Users/-user/Downloads/MoonshineSDKs/Ant/apache-ant-1.10.1/bin/ant -file /Users/-user/Documents/Flex/temp_workspace/TestFlex_1118/build/build.xml
: Done
: BUILD FAILED
: /Users/-user/Documents/Flex/temp_workspace/TestFlex_1118/build/build.xml:78: The following error occurred while executing this line:
: /Users/-user/Documents/Flex/temp_workspace/TestFlex_1118/build/build.xml:162: Java returned: 10
: Total time: 5 seconds

However, Others > Build Apache Ant File reports an error for FLEX_HOME:

: Ant build Running
: /Users/-user/Downloads/MoonshineSDKs/Ant/apache-ant-1.10.1/bin/ant -file /Users/-user/Documents/Flex/temp_workspace/TestFlex_1118/build/build.xml -DIS_FLEXJS_AFTER_7=true -DIS_APACHE_ROYALE=true
: BUILD FAILED
: /Users/-user/Documents/Flex/temp_workspace/TestFlex_1118/build/build.xml:21: Property 'env.FLEX_HOME' is not defined.
: Total time: 0 seconds

Do you run the environment script before this last case? The first two cases get past this line, so I think they are working properly

@rat-moonshine
Copy link
Collaborator

We discussed on how environment-variable sets in Moonshine and why env.FLEX_HOME generates error in Ant script. Currently, Moonshine set env-variables based on base Moonshine settings and not by individual project's settings. Respecting individual projects' settings could make the logic more complicate and path-priority situation may introduce between global settings and projects'. If we want to discuss more on this, we can create an issue separately.

I'll recheck the procedures in AntBuildPlugin that could generate an error as this #938 (comment) reported, as I was saying the class file seems to difficult for an easy read..might require us to some cleanup at some time.

@rat-moonshine
Copy link
Collaborator

rat-moonshine commented Nov 29, 2021

@JoelProminic In case of Ant build run, Moonshine does respect a project's custom-set-SDK, opposing my earlier thought on this.

  1. Set Moonshine default-SDK to Royale (non-Flex SDK)
  2. Create a new Flex Desktop Project
  3. Set the custom-SDK to the project to any Flex SDK
  4. Try running the Ant build that supplied within the project
  5. Console output the usage of the custom-set SDK to the project

In case no custom SDK set, Moonshine tries to look into the default-SDK.

@rat-moonshine
Copy link
Collaborator

I able to produce this error when running an Ant build script inside a Java project. It appears that the process was trying to determine the targeted-project is an AS3 project instead any other, causing certain field a null.

I have adjusted the codes to determine properties based on base ProjectVO classification instead of any particular project type. I don't see the error in my initial tests now.

Please, check.

@JoelProminic
Copy link
Contributor Author

I confirmed that the project-specific SDK setting is respective.

I haven't been able to reproduce the 1009 error on the first script run, but this triggered inconsistently before. I'll watch for it to trigger again.

@JoelProminic
Copy link
Contributor Author

How specialized is the environment logic for Ant scripts currently? If we aren't doing it already, could we reuse the environment variable script we use for other commands? This should be more robust when working with other SDKs (though DYLD_LIBRARY_PATH won't work - see #930)

@rat-moonshine
Copy link
Collaborator

rat-moonshine commented Nov 30, 2021

How specialized is the environment logic for Ant scripts currently?

The environment set logic runs before running any compilation/build mostly, this includes Ant run. The logic is a central API and sets a set of variables every time (with special variations where applicable).

Talking on special variations, in case of Ant build we run the environment logic with some variations. We sets FLEX_HOME and JAVA_HOME between default and (project)custom.

Currently, DYLD_LIBRARY_PATH is only another entry of the setting variables, so I don't expect it'll act differently between different run. It is suppose to be set along with other variables if a valid Notes path is present. In my tests, having a Notes path /Applications/HCL Notes.app does identified as a valid path and sets the variable (debug-test):

image

@JoelProminic
Copy link
Contributor Author

We will work on standardizing the environment for this in #949

@piotrzarzycki21 piotrzarzycki21 removed the test ready Feature/bug ready for testing label Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Moonshine-IDE - Bug Fixing
  
Awaiting triage
Development

No branches or pull requests

3 participants