Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Change IResourceClusteringPolicy
Change IResourceClusteringPolicy [message #1123426] Wed, 02 October 2013 14:53 Go to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
Hi

I'm dealing with a very large grammar with complex scope rules and thousands of files to compile.

I'm able to work with a 8Gb Heap, but not all developers have this memory, so it would be nice to be able to compile with 2-4Gb, even if the same file has to be parsed several times because of dependencies.

I think that this can be done changing "IResourceClusteringPolicy clusteringPolicy" in "ClusteringBuilderState".

The default implementation is defined in the interface: "@ImplementedBy(DisabledClusteringPolicy.class)" and i want to try "DynamicResourceClusteringPolicy" or maybe a custom one.

I'm trying to change it in the language plugin project, in XXXRuntimeModule, where i have succesfully changed other guice dependencies like "IDefaultResourceDescriptionStrategy" and "IValueConverterService", but in this case it doesn't work.

Debugging i can see that only "DisabledClusteringPolicy" is used.

public class XXXRuntimeModule extends com.costaisa.dsl.AbstractXXXRuntimeModule {

	
	@Override
    public Class<? extends IValueConverterService> bindIValueConverterService() {
        return XXXValueConverter.class;
    }
	
	public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
		return XXXResourceDescriptionStrategy.class;
	}	
	
	public Class<? extends IResourceClusteringPolicy> bindIResourceClusteringPolicy() {
		return DynamicResourceClusteringPolicy.class;
	}	
	
}


Eclipse complains that "Discourage access: is not accesible due to restriction on required library", but debugging i can see that the class is instantiated.

Is there a solution apart from modifying the source code of xtext?

Thanks
Re: Change IResourceClusteringPolicy [message #1123442 is a reply to message #1123426] Wed, 02 October 2013 15:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi afaik you have to Register a special guice module to the extension
point org.eclipse.xtext.ui. shared.overridingGuiceModule

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Change IResourceClusteringPolicy [message #1124087 is a reply to message #1123442] Thu, 03 October 2013 07:02 Go to previous messageGo to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
It works. Thanks !!
Re: Change IResourceClusteringPolicy [message #1124363 is a reply to message #1124087] Thu, 03 October 2013 13:07 Go to previous message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
I've managed to build all the project with a heap of 1Gb in 10 minutes using some tricks Razz

The first 2 phases of compilation ("Creating new resource description" and "Updating new resource description" both use IResourceClusteringPolicy.
This interface has the method "continueProcessing". If it returns false, all the ResourceSet is cleaned and the compilation continues.

I've created a new instance that always returns true (continue processing) but it cleans in the ResourceSet all the resources that cannot be referenced.
In my case, only 15% of the files can be referenced and i don't want to repeat the parsing of those files.

The last phase, generating to java, does not use this class and i haven't seen an equivalent extension point.

In order to avoid downloading and changing Xtext source code, i've done the same cleaning in the ResourceSet inside the function XXXGenerator.doGenerate

Previous Topic:[Solved] Xtext fails to parse my text file
Next Topic:Storing an existing xls file in ProjectExplorer view of dsl editor
Goto Forum:
  


Current Time: Thu Apr 25 19:39:13 GMT 2024

Powered by FUDForum. Page generated in 0.03614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top