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.

Bug 67207 - Need a way how to determine the Freeform project's build script file
Summary: Need a way how to determine the Freeform project's build script file
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Freeform (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 60086
  Show dependency tree
 
Reported: 2005-10-20 14:33 UTC by iformanek
Modified: 2005-11-07 15:35 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed change. (12.36 KB, patch)
2005-11-01 10:14 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description iformanek 2005-10-20 14:33:01 UTC
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.
Comment 1 Jesse Glick 2005-10-20 17:15:19 UTC
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.
Comment 2 iformanek 2005-10-20 17:46:26 UTC
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).
Comment 3 Jan Lahoda 2005-11-01 10:13:20 UTC
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.
Comment 4 Jan Lahoda 2005-11-01 10:14:27 UTC
Created attachment 26516 [details]
Proposed change.
Comment 5 Jesse Glick 2005-11-01 18:15:30 UTC
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.
Comment 6 Jan Lahoda 2005-11-07 14:47:57 UTC
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).
Comment 7 Jan Lahoda 2005-11-07 15:35:43 UTC
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