Problem with XtextLinkingDiagnostic [message #882975] |
Thu, 07 June 2012 11:09  |
Eclipse User |
|
|
|
Hey,
I would like to perform the generation process without need of starting an Eclipse instance. It just takes to much time and I'm currently working only on the generation process. The process works fine if I just use one Resource for generation.
If I have two Resources that contain references to each other, the validation results in the following error :
XtextLinkingDiagnostic: null:51 Couldn't resolve reference to SubProduct 'productNameXYZ'.
Here is the extracted part of my GenerationClass:
@Inject
private Provider<ResourceSet> resourceSetProvider;
@Inject
private IResourceValidator validator;
@Inject
private IGenerator generator;
@Inject
private JavaIoFileSystemAccess fileAccess;
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Aborting: no path to EMF resource provided!");
return;
}
Injector injector = new org.product.ProductStandaloneSetupGenerated()
.createInjectorAndDoEMFRegistration();
ProductGeneratorRunner main = injector
.getInstance(ProductGeneratorRunner.class);
main.setOutputPath(ProductBuilder.PFODUCT_GEN_DIRECTORY);
main.runGenerator(args);
}
public List<Issue> runGenerator(String[] paths) {
// load the resource
ResourceSet set = resourceSetProvider.get();
List<Resource> resources = new ArrayList<Resource>();
for (String path : paths) {
Resource resource = set.getResource(URI.createURI(path), true);
resources.add(resource);
}
for (Resource resource : resources) {
List<Issue> issues = validator.validate(resource, CheckMode.ALL,
CancelIndicator.NullImpl);
if (!issues.isEmpty()) {
for (Issue issue : issues) {
System.err.println(issue);
}
return issues;
}
fileAccess.setOutputPath(outputPath);
generator.doGenerate(resource, fileAccess);
}
System.out.println("Code generation finished.");
return null;
}
Somehow is Xtext aware of the referenced file if I execute the generation process with an Eclipse instance. How can I resolve this issue? Thank you.
Kon
|
|
|
|
Powered by
FUDForum. Page generated in 0.03452 seconds