|
Re: Xtext Resource Storage [message #1841178 is a reply to message #1841177] |
Wed, 05 May 2021 17:07 |
|
Hi, can you give more details about your exact usecase
i am not sure if the storage aware feature solves anything for you
besides that binding
StorageAwareResourceDescriptionManager as IResourceDescriptionManager
and StorageAwareResource as XtextResource
bindings for IResourceStorageFacade to ResourceStorageFacade
and AbstractFileSystemAccess2 to EclipseResourceFileSystemAccess2 should do the trick
(maybe some more needed)
for reading you can steer with the SourceLevelURIsAdapter if resources should be loaded via storage or not (happens automatically during build)
public class MyDslUiModule extends AbstractMyDslUiModule {
public MyDslUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
//.....
public Class<? extends IResourceDescription.Manager> bindIResourceDescription$Manager() {
return StorageAwareResourceDescriptionManager.class;
}
public Class<? extends XtextResource> bindXtextResource() {
return StorageAwareResource.class;
}
public Class<? extends IResourceStorageFacade> bindIResourceStorageFacade() {
return ResourceStorageFacade.class;
}
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
return EclipseResourceFileSystemAccess2.class;
}
}
you may also have to do some corrective customization like org.eclipse.xtext.xbase.resource.BatchLinkableResourceStorageFacade.getSourceContainerURI(StorageAwareResource) / org.eclipse.xtext.resource.persistence.ResourceStorageFacade.computeOutputPath(StorageAwareResource) so that the storages land in a folder
e.g.
@Override
protected String computeOutputPath(StorageAwareResource resource) {
URI u = resource.getURI();
if (u.isPlatformResource()) {
URI base = u.trimFileExtension().trimSegments(u.segmentCount()-3);
URI binaryStorageURI = getBinaryStorageURI(resource.getURI());
String result = binaryStorageURI.deresolve(base)
.path();
return result;
}
return super.computeOutputPath(resource);
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Thu, 06 May 2021 14:52] Report message to a moderator
|
|
|
|
|
|
Re: Xtext Resource Storage [message #1841183 is a reply to message #1841182] |
Wed, 05 May 2021 20:30 |
|
The storages won't speed up clean builds but incremental ones and open editors with many transitive dependencies only.
So you would have to give it a try
If you change 90% of the files by a switch branch profit will be likely zero
Same if you just have a hand full of deps for the files that change
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: Xtext Resource Storage [message #1841207 is a reply to message #1841184] |
Thu, 06 May 2021 13:54 |
Juewei Jin Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Thanks Christian and Ed for your helpful suggestions.
1. switch git branch break the models
I tried today again to find out the reason, why after switching git branch, the model need to be cleaned. I think I find out something.
Because we are using git command or the git client application (GitExtensions) to work with git. Every time when we switch the git branch. The changed files are not synchronized in Eclipse Model Explorer. Only when I refresh the folder in eclipse model explorer, the changed files are synchronized.
I tried with the git inside eclipse (EGit), with it after switching git branch, the files in Model Explorer are updated and the automatically build run successfully.
So it seems that it's a problem of Eclipse working together with third party git application
2. why the clean build takes 20 minutes
it was my type error. most time the clean build can be finished around 10 minutes. We have some time consuming validations with the models, and totally there are around 5000 models. These models have also many transitive dependencies with each other. So I think the clean build with 10 minutes is still acceptable.
But I will try to use the storaged resource to accelerate the incremental build.
One more question is, does Xtext persistent the parse result somewhere in the disk. I ask this, because even the computer restarted and when I reopen the models, the cross reference and other things still works. If the parsing result were saved in the memory, this should not happen. Please correct me if I am wrong.
|
|
|
Re: Xtext Resource Storage [message #1841210 is a reply to message #1841207] |
Thu, 06 May 2021 14:26 |
|
you may check auto refresh or refresh on access in your workspace preferences.
xtext will just store the Xtext in index in a file called builder.state in a subfolder of .metadata in the workspace.
this index data then will be used when you continue with the workspace.
with the storage face you will get a for a src-gen/.somefile.mydslbin somefile.mydsl for a somefile.mydsl (path is calculated by org.eclipse.xtext.resource.persistence.ResourceStorageFacade.computeOutputPath(StorageAwareResource))
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
Re: Xtext Resource Storage [message #1841249 is a reply to message #1841244] |
Fri, 07 May 2021 19:19 |
|
The builder state is just "the index"
It says there are these objects if that types with these names in these files
The mydsl bin are a binary version of the ast and nodemodel
The mydsl build are use automatically if you don't opt out using SourceLevelURIsAdapter
You can observe it debugging the storageawareresource class
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.05619 seconds