|
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 16:31 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
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.
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Re: index is incomplete during auto build after cleaning more than one project [message #1739528 is a reply to message #1739524] |
Tue, 02 August 2016 16:59 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Krzysztof Kot![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=krzysztof.kot%40hotmail.com) Messages: 3 Registered: July 2016 |
Junior Member |
|
|
We are virtually showing merged content of two project (parent and child) in our custom "Package Explorer". Files from each project can reference file from other project. Child project files override parent project files.
As workaround I extracted logic from our containerManager.getVisibleContainers and I'm reusing it in validator without using container.getExportedObjects.
In our case container is file. And visible containers are visible files. It is implemented using extended AbstractAllContainersState.
I think problem was that Clean removes index and Build rebuild it so it is why validation of first built project was not working (because files from second project where not indexed yet). Probably this behavior it is ok for most use cases.
[Updated on: Tue, 02 August 2016 17:09] Report message to a moderator
|
|
|
|
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 05:41 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Krzysztof Kot![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=krzysztof.kot%40hotmail.com) Messages: 3 Registered: July 2016 |
Junior Member |
|
|
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 07:11] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03832 seconds