XFlexWrapper
Download It
Status: Pre-Alpha. (Universal Binary). but not tested in a PPC MacRequirements: OS X 10.4, XCode, FlexCompilerShellTool, Flex2 SDK
XFlexWrapper.zip
Installation and Instructions
- You will need the Flex2 SDK and the Flex Compiler Shell Tool installed in the /bin folder of the SDK. More informations at Adobe Labs
- if you do not have the As3 language specifications for XCode, you can go here to get them.
-
Download the zip file.
Decompress it using your favorite decompression tool.
install the Application template in /Library/Application Support/Apple/Developer Tools/Project Templates/Application/
-
Go to /Library/Application Support/Apple/Developer Tools/Project Templates/Application.
Open the 'Flex2 FCSH AS3 Application' xcodeproj file. Open the 'Targets' Tab.
Open the 'Launch Server' target.
Select 'Run Script', Click 'Info' and select the 'General' Tab.
Now you should see the internal shell script that launch the server app.
Replace "/Developper/SDKs/Flex2.sdk/bin/fcsh" with the absolute path of your FCSH Application.
example: "/path/to/my/flex2sdk/bin/fcsh"
Save the template.
You're done. The installation is complete ! (as you see it is not so hard)... -
Now, let's Create a Project :
In order to let it run correctly the FCSH, it needs to know where it is.
Launch XCode->File->New Project->Application->Flex2 FCSH AS3 Application
It Will Create By Default a 800x600 SWF When done, Select the 'Launch Server' Target. Press Command-B (or BUILD).
The server daemon should now run. (you can begin normally to code/compile/code/compile////ect)
If you expand the 'Source' group you will notice 3 files: index.html, Logger.as (provided for test), and YourProjectName.as
Click on "YourProjectName.as". Select the 'Compile' Target.
Press Command-B (or BUILD) to compile.
Every errors should be reported as a normal XCode build...
To Terminate, Select the 'Quit Server' Target. Command-B... Ciao, you're done.
So this is the End.
FAQ
- When i create a new project, the "my_project_file_name.as" does not appear in the source group !
- I've seen that the XFlexWrapper applications (Daemonizer, FCSHServerTool, FCSHClient) are stored inside the '.xcodeproj'. Those are copied every time i create a project. What if i want to store them in another place as a persistent reference.
- Do i have to quit the server and relaunch it each time i work on a project ?
- Is the Server App reentrant ?
- Does it use Sockets ? Can we use it in a networked environment ?
- How can i know the server is running correctly ?
-
When i create a new project, the "my_project_file_name.as" does not appear in the source group !
When you edit the project template, it can happen that you break it. Like not having a file like "your main project file".as. To fix that,
Go to /Library/Application Support/Apple/Developer Tools/Project Templates/Application.
Open the 'Flex2 FCSH AS3 Application' folder then launch xcodeproj file.
Do File->New File->Empty File. name it "dummy" for example... (be sure to save it in the same folder)
Put it in the 'source' group (optional).
Select this newly created file
Do Format->File Encoding->Western (Mac OS Roman)
Rename the File and give the name «PROJECTNAME».as, note the use of the quotes (UTF8 code \u00AB and \u00BB). Those are very important if you want the xcode macro to expand it correctly.
Close the project. Delete the created file. Yes ! Delete it.
Now, when you create a new project. You should see your main AS3 file in the source tab. -
I've seen that the XFlexWrapper applications (Daemonizer, FCSHServerTool, FCSHClient) are stored inside the '.xcodeproj'. Those are copied every time i create a project. What if i want to store them in another place as a persistent reference.
The FCSHServerTool + FCSHClient + daemonizer takes 160Ko approximately... Due the large space we have today, i though it was easier to store them directly in th xcodeproj resources and not deal with an extra installation step. This was a convenient thing for people who does not know shell scripts and do want to mess too much with that. (A mistake is easily made).
But if you want to have those apps in a specific folder and not deal with the local copies, you can edit each shell script and change the paths in order to make it work.
I leave this for you experienced user to do it and save the template. -
Do i have to quit the server and relaunch it each time i work on a project ?
No, normally once you launch the daemon, you can leave it live his life until you do not need it, so you open one of your project (does not matter wich one) and build the 'Quit Server Target'.
Each Project when compiling create a hash key depending on the Name of the project and the username. So each project is managed independently in the server, you can switch and compile different project nornally. You should not have any problem. The server is not multithreaded. I do not know if the FlexCompilerShellTool is ? But XFlexWrapper is currently reentrant, for safety... What about FlexCompilerShellTool ? I guess not but anyway, i didn't look so further. -
Is the Server App reentrant ?
Yes, but it was made like that just for some safety issues. Only one instance of the server can run so i guess it was better to use locks... -
Does it use Sockets ? Can we use it in a networked environment ?
No, it does not use Sockets and No, You cannot use it in a networked environment. It uses a named fifo.
-
How can i know the server is running ?
Go to the /tmp folder. if you see a file named com.lych.fcsh_com.fifo.server then you know the server is on. If not then the server is down or you did not set a good path to your FCSH Applications or there is a bug...
Advanced Things
As you could have seen there is another target called "Run Safari". Wich, as its name, supposed to launch Safari if and only if no error
where encountered during the compilation process. I Encourage you to build using this target instead of the simple 'Compile'. It is
much more simpler...
And customize it to use FireFox instead or whatever borwser you like.
Known Bugs and Issues
-
FCSH skip the compilation process of files that have been already compiled. What does this mean, practically ?
It means that compiling twice in a row will always give a no-error compilation. Compile, fix your errors and continue. If you press twice Command-B, the first one will report errors from FCSH, but the second will report success, because FCSH will simply skip the file... wich won't be interpreted as an error by the wrapper. Of course, modifying the file puts you gain in the trip. so...
It is not really bug... But you should know to not complain about that. - Most Warnings are treated like Errors. This is may be an issue for you but it should not. You should always fix warnings.
-
Mac OS X.4.11 Issue : The 'Launch Server' script returns but it is not possible to compile anything. In fact the server is stuck and you cannot communicate with it.
- Stop the compile task if it is running
- Launch the Terminal (Applications/Utilities/Terminal.app)
- tape "top"
- Look for the process called 'FCSHServer' and get the pid associated with it (number on the left of it in the PID column)
- tape "q" to exit top
- tape "kill " and the process pid number we just look from top
- in the finder menu Go->Go To Folder->/tmp (or tape "cd /tmp" in the Terminal)
- delete all the com.lych.fcsh_com files (or tape "rm -r com.lych.fcsh_com*" in the Terminal)
That's it. Now relaunch the Server using the 'Launch Server Script' and work. The process won't get stuck anymore. Don't ask me why... I think the daemonizer app does not fit well for Mac os X. I will find a workaround soon. But since X.4.11, it gets always stuck as soon as you 'log in' or reboot...
License
XFlexWrapper is Free Software. It is released under the LGPL License. See the COPYING.txt file and the COPYING.LESSER.txt file for more informations.Disclaimer
This software is provided as is. I won't and cannot be help responsible if your computer burn or has a severe problem while running this software...Anyway... Do not forget this is an alpha version. It is not perfect. And this is not a full time project. So be responsible when you use it. And if you are really not happy with it don't leave an angry message, just do it yourself, you are may be much more involved in Flash/Flex development than i am.
For those who are happy with it and have suggestions, drop a message. I'll be happy to know it has helped someone there.