Create files only once [message #1791127] |
Sun, 24 June 2018 09:14  |
Eclipse User |
|
|
|
Create files only once.
Hi guys.
I would like to create some files in a project only the first time. But if a skip the generation the second time on, xtext has been deleting the files created previously. I think it makes sence, but how I can solve this issue and keep these files?
Regards,
Márcio Koch.
|
|
|
|
Re: Create files only once [message #1791135 is a reply to message #1791128] |
Sun, 24 June 2018 17:38   |
Eclipse User |
|
|
|
It is not working for me, when I save my DSL file, the generated files which should be kept (OUTPUT_KEEPED configuration), are removed if exists and created otherwise.
class MklOutputConfigurationProvider extends OutputConfigurationProvider {
public static val DEFAULT_OUTPUT_DIRECTORY = "."
public static val APP_OUTPUT_DIRECTORY = DEFAULT_OUTPUT_DIRECTORY + "/modules/app/"
public static val OUTPUT_KEEPED = "OUTPUT_KEEPED"
override getOutputConfigurations() {
val defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT)
defaultOutput.description = "Default and base output."
defaultOutput.outputDirectory = DEFAULT_OUTPUT_DIRECTORY
defaultOutput.createOutputDirectory = true
val outputConfigKeepResources = new OutputConfiguration(OUTPUT_KEEPED)
outputConfigKeepResources.description = "Keep generated files"
outputConfigKeepResources.outputDirectory = APP_OUTPUT_DIRECTORY
outputConfigKeepResources.createOutputDirectory = true
outputConfigKeepResources.overrideExistingResources = false
outputConfigKeepResources.setDerivedProperty = false
outputConfigKeepResources.canClearOutputDirectory = false
outputConfigKeepResources.cleanUpDerivedResources = false
newHashSet(defaultOutput, outputConfigKeepResources)
}
}
Debugging, Eclipse falls in this code that always associates the files with the DSL and deletes them, they seem to be always derived files:
public boolean installMarker(IFile file, String generator, String source) throws CoreException {
if (!file.exists())
return false;
IMarker[] markers = file.findMarkers(MARKER_ID, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
if (generator.equals(marker.getAttribute(ATTR_GENERATOR))
&& source.equals(marker.getAttribute(ATTR_SOURCE)))
return true;
}
IMarker marker = file.createMarker(MARKER_ID);
marker.setAttribute(ATTR_GENERATOR, generator);
marker.setAttribute(ATTR_SOURCE, source);
return true;
}
I'm doing something wrong?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04020 seconds