index is incomplete during auto build after cleaning more than one project [message #1739356] |
Sat, 30 July 2016 09:43  |
Eclipse User |
|
|
|
Hi,
I'm implementing validation of duplicate names of elements between projects.
It is something similar to:
IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider.getResourceDescriptions(validatedObj.eResource());
IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(validatedObj.eResource().getURI());
IEObjectDescription objectDescription = getIEObjectDescription(validatedObj, resourceDescription);
for (IContainer container : containerManager.getVisibleContainers(resourceDescription, resourceDescriptions)) {
Iterable<IEObjectDescription> iterable = container.getExportedObjects(eClass, objectDescription.getQualifiedName(), true);
Iterator<IEObjectDescription> iter = iterable.iterator();
while (iter.hasNext()) {
IEObjectDescription duplicate = iter.next();
if (duplicate.equals(objectDescription)) {
continue;
}
error(Messages.Validation_UniqueName, validatedObj, eAttribute);
return;
}
}
It works fine when I'm saving a file and when I'm cleaning one project. But when I'm cleaning more than one project it doesn't work correctly.
I think it is because Clean removes IResourceDescription of every file from every cleaned project and they are added during build for current project. (I debugged that they are removed from ClusteringBuilderState used by CurrentDescriptions).
When auto build is validating files from first project the IContainer(s) that should have IResourceDescription(s) from second project are empty so I see no duplicates. Index is not yet rebuild.
What can I do to make it works ?
Only idea I have now is to stop using IResourceDescriptions and load models myself inside validation but original approach seams faster and doesn't require duplicating code that checks visible containers.
|
|
|
Re: index is incomplete during auto build after cleaning more than one project [message #1739524 is a reply to message #1739356] |
Tue, 02 August 2016 12:31   |
Eclipse User |
|
|
|
Hi,
when a depending project is build the dependent project should have
been and its index entries should be there.
can you elaborate on your usecase?
~Christian
On 2016-08-02 13:12:08 +0000, Krzysztof Kot said:
> Hi,
>
> I'm implementing validation of duplicate names of elements between projects.
>
> It is something similar to:
>
> IResourceDescriptions resourceDescriptions =
> resourceDescriptionsProvider.getResourceDescriptions(validatedObj.eResource());
>
> IResourceDescription resourceDescription =
> resourceDescriptions.getResourceDescription(validatedObj.eResource().getURI());
>
> IEObjectDescription objectDescription =
> getIEObjectDescription(validatedObj, resourceDescription);
>
> for (IContainer container :
> containerManager.getVisibleContainers(resourceDescription,
> resourceDescriptions)) {
> Iterable<IEObjectDescription> iterable =
> container.getExportedObjects(eClass,
> objectDescription.getQualifiedName(), true);
> Iterator<IEObjectDescription> iter = iterable.iterator();
> while (iter.hasNext()) {
> IEObjectDescription duplicate = iter.next();
> if (duplicate.equals(objectDescription)) {
> continue;
> }
> error(Messages.Validation_UniqueName, validatedObj, eAttribute);
> return;
> }
> }
>
> It works fine when I'm saving a file and when I'm cleaning one project.
> But when I'm cleaning more than one project it doesn't work correctly.
>
> I think it is because Clean removes IResourceDescription of every file
> from every cleaned project and they are added during build for current
> project. (I debugged that they are removed from ClusteringBuilderState
> used by CurrentDescriptions).
>
> When auto build is validating files from first project the
> IContainer(s) that should have IResourceDescription(s) from second
> project are empty so I see no duplicates. Index is not yet rebuild.
>
> What can I do to make it works ?
>
> Only idea I have now is to stop using IResourceDescriptions and load
> models myself inside validation but original approach seams faster and
> doesn't require duplicating code that checks visible containers.
|
|
|
|
|
Re: index is incomplete during auto build after cleaning more than one project [message #1740078 is a reply to message #1739532] |
Tue, 09 August 2016 01:41  |
Eclipse User |
|
|
|
Christian Dietrich wrote on Tue, 02 August 2016 17:21well cyclic dependencies are not a thing eclipse is well at.
it builds project by project
Hi, I still have problem with this. You are right problem is cyclic dependency between projects. Is it maybe possible to change something that ResourceDescriptions are not taken from index so that it doesn't depend on build order.
I know it would be slower but I have only few files so even loading them to ResourceSet while resolving cross references would be ok for me I think.
Edit:
I fixed problem by extending ProjectAwareResourceDescriptionsProvider and loading dependent resources to ResourceSet and changing from ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE to ResourceDescriptionsProvider.LIVE_SCOPE in LoadOptions so that ResourceDescription from ResourceSet are created.
For now it seams to work.
[Updated on: Thu, 11 August 2016 03:11] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02952 seconds