Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#10 Finalize the integration of Code Generation #36

Merged
merged 9 commits into from
Sep 18, 2020
Merged

Conversation

CamilleLetavernier
Copy link
Member

Fixes #10

sgraband and others added 7 commits September 8, 2020 11:50
- The Ecore Codegen application is
org.eclipse.emf.codegen.ecore.Generator; not
org.eclipse.emf.codegen.CodeGen

Signed-off-by: Camille Letavernier <[email protected]>
}

generateCode(genmodelPath: string, workspacePath: string): Promise<string> {
const jarPath = path.resolve(__dirname, "..", "..", "..", "..",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a single method for this. We should also be able to call directly the ecore_glsp_backend binary, which would simplify the command line a lot. Something like this:

ecore_glsp_backend -nosplash [app-args]

Rather than:

java -jar -cp <equinox launcher> <Main> [app-args]

@Override
public Object start(IApplicationContext context) throws Exception {
String[] args = getArgs(context);
createEcore(args[0], args[1], args[2], Paths.get(args[3], args[0]+".ecore"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to check the arguments before passing them like this, to get proper error reporting (Rather than "IndexOutOfBounds" exceptions)

URI uri = URI.createFileURI(ecoreFile.getAbsolutePath());
Resource ecorePackageResource = resourceSet.getResource(uri, true);
EPackage rootPackage = (EPackage) ecorePackageResource.getContents().get(0);
if(args[1].equals("") || args[2].equals("")){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is redundant with the inner-ifs

@Override
public Object start(IApplicationContext context) throws Exception {
Generator codegen = new Generator();
String[] args = getArgs(context);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract the args to individual variables, and stop using the string-array as early as possible. Manipulating arg[0] inside the code isn't really readable

@CamilleLetavernier
Copy link
Member Author

The introduction of a Tycho-based product caused some issues with the build, but they should be solved now (I'll squash the releng commits to clean up a bit).
However, there are two test failures. One seems directly related to these changes, as we changed the way the Ecore file is created (The corresponding test is failing). There is also one test failure in the Create Nodes test, but since it directly follows the Create Ecore File test, I assume it fails because of the previous test error. @simongraband can you check these 2 tests? (I was also able to reproduce the errors locally, so it's not related to the Jenkins/Container structure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finalize the integration of Code Generation
2 participants