Re: [Tde-development] CVS works
Status: Beta
Brought to you by:
dcorbin
|
From: Carsten B. <car...@gm...> - 2004-03-05 02:18:23
|
> >
> > which is called from the eclipse build system ones for EACH project to
> > build, the tests of ALL projects are run.
> > That means if I have 3 projects(with auto test nature) open and I do
> > "rebuild all" the method runs all the tests 3 times. So a "rebuild all"
> > results in 9 test runs (instead of 3).
> > Would it not be easier to run always the tests of the current project
> > only ?
>
> Easier, maybe, but flawed (not that the current implementation isn't).
> It's a common practice (in eclipse plugins anyway) to have all the tests in
> one project, and all the production code in another. If I understand your
> suggestion correctly, changes to the production code would no cause tests
> tor run.
>
> What I would like to do is find a way to run the tests once, after all the
> necessary builds are done, but I'm not sure how to do it.
>
> > This solves as well the next two issues.
> >
> >
> > In the same class I found two problems:
> > Because the tests are started for all projects, there are two problems:
> > -it fails, if a project is closed
>
> I don't understand. If a project is closed, how is it relevant?
For all FULL_BUILD, all the tests for all projects of the workspace are run
(even the closed ones..). The code gets all projects from the root workspace
and then runs the tests on all projects (even the closed ones). This gives an
CoreException. (if its closed)
>
> > -Its checked even for a project without the TDE nature, if the builder is
> > in the last position. This results to the fact that all projects which do
> > not have the TDE nature, become marked with an error.
>
> Marked with what error? I don't understand this.
In the case of FULL_BUILD:
All projects, even the ones without autoTest enabled, gets checked if the TDE
builder is in the last place, even if there is no TDE builder...
For a full build it
1. gets ALL projects of the workspace (as well closed or ones without TDE
nature)
2. It validates the nature (this throws CoreException if the project is
closed).
3. It marks any project with the error marker if they do not have the TDE
builder in last position, even if they do not have a TDE builder at all.
Ceck the code in AutoTestEngine:
public void build(int kind) throws CoreException
{
doProjectBuild(info.getProject());
Set projects = null;
if (kind == IncrementalProjectBuilder.FULL_BUILD)
{
projects = fullBuild(); // **************** Gets all projects
}
....
for (Iterator i=projects.iterator(); i.hasNext(); )
{
IProject project = (IProject) i.next();
doProjectBuild(project);
}
}
private Set fullBuild()
{
final Set projects = new HashSet();
IProject[] px = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i=0; i<px.length; i++)
projects.add(px[i]);
return projects;
}
private void doProjectBuild(IProject project)
throws CoreException
{
adapter.setProject(project);
if (!validateBuilderPosition(adapter)) //****** throws exception if
******* project is closed or marks
******* projects with TDE nature with a problem marker
return;
adapter.runTests();
}
Try it your self. If you create several projects, close some of them and run
"Rebuild all". This throws CoreExceptions
Or you have severall projects, one with TDE nature and the rest without.
On running "Rebuild all", they get marked with the error for "builder not in
last position"
|