It would be extremely useful if ant support was more closely integrated into the PHP extension.
I say more closely, because Ant can be used by adding a build.xml to the project.
This is primarily to allow complex deployment scenarios, where some static site content needs pulling from external sources, or is an artefact from a different project type, or generated from SCM history.
The current deployment mechanisms (FTP and local-copy) can easily be implemented as ant tasks, so it's worth making this change too, so that ant can run the same deployments without duplicating config.
I'm starting to look into this now (waiting for my clone to finish), please ping me if anyone else is looking at this too.
Making deployment a separate feature, dependant on this one, as hooking run/debug behaviour shouldn't wait for an ant-based implementation of org.netbeans.modules.php.project.connections.spi.RemoteClient
Created attachment 106265 [details]
I've created an initial patch to release6.9_m1, which does the following:
- Enables build/rebuild is a build.xml is present in the project root
- Calls the ant 'build' and 'rebuild' targets.
Still to do:
- Hook into run/debug to run build first (not checked if the IDE does this by default)
- Probe build.xml to check if run/debug targets actually exist
- Add a context menu to the project view to create skeleton build.xml
- Lots of testing(!)
Created attachment 106356 [details]
This is my (probably) final version of the patch, until feedback is received.
A 'Add Ant Support' option now appears on right-click on the project root, but only if build.xml isn't already present. This will create a default build.xml for customisation.
The ant targets build and rebuild are now probed for, rather than just checking that the build.xml exists.
The build target is called before build/run, as I've added a wrapper around the factory method in ConfigAction.
I've removed obsolete copyright notices from my files, as they are now IDE generated (originally I copied existing actions, but the currently reported Oracle vs Google FUD makes me nervous about implementing sub-classes this way).
Raised version number, as the current patch applies against the current codebase too (with a manual fix to the reject on import lines).
*** Bug 195708 has been marked as a duplicate of this bug. ***
Wow, thanks for the patch, really! However, I would strongly prefer to have such support _optional_. Why? Because Ant is for Java projects and is not well-known in PHP community; Phing is the Ant alternative for PHP.
So, maybe we could try to provide this functionality in a separate module - would you like to look at it?
I'd love to hear news about this one!
@Tomas Mysik, I do agree with you on the option part, but not really on phing part :-) Ant can be easily there, so why not use it?
Thanks to follow
I would really like to see this either built in or be an optional module. It would be nice the to have my Build/Clean buttons functional. (Right now I'm doing it directly on my build.xml file)
I'm planning on having another look at this; I don't recall seeing a way to do this as a standalone plugin, but that may just be lack of imagination on my part :)
The reason for choosing ant over phing was pretty simple; netbeans already includes support for ant (and installs it), so the required work was minimal.
Although Phing support could be added, this would complicate the dependancies - it's quite possible at the moment to use netbeans on a machine without PHP install, and deploy projects remotely.
That said, Phing is just a PHP implementation of Ant (flame me now), so it should be possible to create a Phing wrapper that is compatible. I probably won't be the one to do it.
And how about HTML5 projects? Does every project type have to be that much different? Why can't there be a HTML5-like project that uses Ant and allows you to add support for PHP or any other script language supported by the IDE? Adding Ant to PHP projects would be the first step towards simplification by unification.