[Xcore] Standalone app generates EJavaObject types [message #1835598] |
Tue, 08 December 2020 07:23 |
Miguel Jimenez Messages: 40 Registered: July 2015 |
Member |
|
|
Last year I created a demo application using gradle to generate the .ecore and .genmodel files from an Xcore model. You can find that app here:
https://github.com/jachinte/xcore-gradle-example
To generate those files, run "gradle xcoreExport". It will run a custom task (ExportXcoreTask.java) and generate the files in "model-gen". Since .ecore and .genmodel files are not ignored, you can find the original <generated> files in the repository.
When I run the custom task now, the types are always EJavaObject, but it worked well before (See Example.ecore).
My two questions:
1. Since I'm using specific versions of the dependencies, why is the app not generating the correct types anymore?
2. How do I fix the custom task, so that it generates the correct types? I tried many many things but none worked.
Thank you,
Miguel
This is the base code in the task:
new StandaloneSetup().setPlatformUri("./");
final Injector injector = new XcoreStandaloneSetup()
.createInjectorAndDoEMFRegistration();
final XtextResourceSet set =
injector.getInstance(XtextResourceSet.class);
set.addLoadOption(
XtextResource.OPTION_RESOLVE_ALL,
Boolean.TRUE
);
final URI uri =
URI.createFileURI(this.xcoreInputFile.getAbsolutePath());
final ResourceSet rset = new ResourceSetImpl();
rset.getURIConverter()
.getURIMap()
.putAll(EcorePlugin.computePlatformURIMap(true));
final Resource input = rset.getResource(uri, true);
input.load(Collections.EMPTY_MAP);
EcoreUtil.resolveAll(input);
After the last line, the "input" resource has two errors:
XtextLinkingDiagnostic: null:1 Ecore cannot be resolved.
XtextLinkingDiagnostic: null:2 GenModel cannot be resolved.
[Updated on: Tue, 08 December 2020 07:36] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03108 seconds