This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The profiler needs to determine the Ant build script file for a freeform project. It seems that if the build script is not named build.xml and/or is not located in the project's main folder, its location is stored in the project properties in the ant.script value. The problem is that this value is relative to other properties, and we would need access to the FreeformPropertyEvaluator to resolve properly. But since the freeform project has no public api, we have no way how to do this.
Note that there is nothing preventing a freeform project from having more than one (or no) build scripts In fact, when we autogenerate selected targets (Compile Single etc.), we put them into one of two separate scripts in the nbproject folder. Similarly, there is no requirement that ${ant.script} be used to point to an external script; currently we create such a property from the standard freeform project wizard if there is an external project dir, but that could change, and other wizards could do it differently. So you need to be more precise about what information you really need to have and why.
Sorry for not being specific - I filed this after a discussion with Tomas Zezula and Honza Lahoda, where I explained what we need to do. So here we go: The profiler currently asks the user to manually create a target in the project's build script (or something it imports) based on the instructions for doing this that could be found in the profiler docs. The profiler then asks the user which of the currently existing targets is the one for profiling, and then runs this target. To do this, we are asking for the "main" ant script (assume this is the one the user selects when he creates the project), and then get a list of its targets and ask the user to select. We then invoke via the ActionUtils.runTarget action, parametrised with profiler settings as properties (same way we do it for all other project types).
I propose to add method org.netbeans.modules.ant.freeform.spi.support.Util.getDefaultAntScript that would for a given project return the "default" ant script or null if there is none. The proposed patch is attached. Notes to the patch: 1. the test data required for the test are not attached, I will attach them on demand. 2. the apichanges.xml and manifest.mf in the patch contain also changes required for issue #67860.
Created attachment 26516 [details] Proposed change.
fgrep CHANGEME apichanges.xml Avoid adding the Project itself to its lookup. If you need some access from a static method, make some special interface (not exposed outside the module) with methods to get the helper, evaluator, etc.
fgrep CHANGEME apichanges.xml: done Avoid adding the Project itself to its lookup: will do it. I plan to do this change today (with the two above changes).
Implemented: Checking in manifest.mf; /cvs/ant/freeform/manifest.mf,v <-- manifest.mf new revision: 1.11; previous revision: 1.10 done Checking in apichanges.xml; /cvs/ant/freeform/apichanges.xml,v <-- apichanges.xml new revision: 1.2; previous revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/extbuildscript/nbproject/project.xml,v done Checking in test/unit/data/example-projects/extbuildscript/nbproject/project.xml; /cvs/ant/freeform/test/unit/data/example-projects/extbuildscript/nbproject/project.xml,v <-- project.xml initial revision: 1.1 done Checking in test/unit/src/org/netbeans/modules/ant/freeform/TestBase.java; /cvs/ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/TestBase.java,v <-- TestBase.java new revision: 1.13; previous revision: 1.12 done Checking in test/unit/src/org/netbeans/modules/ant/freeform/spi/support/UtilTest.java; /cvs/ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/spi/support/UtilTest.java,v <-- UtilTest.java new revision: 1.5; previous revision: 1.4 done Checking in src/org/netbeans/modules/ant/freeform/FreeformProject.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java,v <-- FreeformProject.java new revision: 1.38; previous revision: 1.37 done RCS file: /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/ProjectAccessor.java,v done Checking in src/org/netbeans/modules/ant/freeform/ProjectAccessor.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/ProjectAccessor.java,v <-- ProjectAccessor.java initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/extbuildscript/scripts/build.xml,v done Checking in test/unit/data/example-projects/extbuildscript/scripts/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/extbuildscript/scripts/build.xml,v <-- build.xml initial revision: 1.1 done Checking in src/org/netbeans/modules/ant/freeform/spi/support/Util.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/spi/support/Util.java,v <-- Util.java new revision: 1.4; previous revision: 1.3 done