Skip to content

Conversation

@PhilippeNoel
Copy link
Contributor

Currently override of implementation classes if Java code. I would like to add the choice to generate Xtend classes instead.

This means modifying the Generate Developer Structure dialog and all related generate dev structure files.

@opcoach
Copy link
Owner

opcoach commented Dec 20, 2022

Hi Philippe !

Nice to see your contribution ! Could you add in this review the screenshot of the new dialog ? And what you get as result ?

@PhilippeNoel
Copy link
Contributor Author

PhilippeNoel commented Dec 20, 2022 via email

@PhilippeNoel
Copy link
Contributor Author

PhilippeNoel commented Dec 20, 2022

image

@PhilippeNoel
Copy link
Contributor Author

The result is that the Implementation files for overridden classes are either generated in Java (by default) or in Xtend if this setting is applied on the Developer structure dialog

@opcoach
Copy link
Owner

opcoach commented Dec 20, 2022

This is pretty cool ! I like it !

Have you added unit test to check the Xtend code result ?

@opcoach
Copy link
Owner

opcoach commented Dec 20, 2022

The .log file in core.test should be removed... right ?

I will check the code later.

If we don't have unit test for Xtend generation, I can accept the review but I would like you to put in the dialog for the Gen Class Type : Java. XTend (beta)

@PhilippeNoel
Copy link
Contributor Author

Ok I'm checking how to add some unit tests then
I'll keep you informed here

@opcoach
Copy link
Owner

opcoach commented Dec 20, 2022

To add tests, it is easy... you must extend the GenModelAddonTestCase which will generate a template project. Then you should focus on the test cases that test the code generation ... like TestGenerics or TestInterfaceGeneration or TestExtensionGeneration. I think you should copy this classes for xtend (may be in another package)...

The important issue to test is to be sure of the right names and code structure in the generated code.

When you launch the tests you can launch them using a RAM disk (in memory), this will increase the speed for testing.

You will also see the result in the junitruntime workspace.

Another tip, you should probably have a way to test with an XTend generator and java generator. See the WorkspaceConfigurator that will populate the runtime workspace with the generated sample projects. Probably you will have to generate one of them especially with your new XTend generation.

@PhilippeNoel
Copy link
Contributor Author

I've added some tests to check that overriden implementation classes are generated as xtend and not java.
I've taken model/model.ecore as example

Copy link
Owner

@opcoach opcoach left a comment

Choose a reason for hiding this comment

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

Version should be increased. I will check that.


@Test
public void testXtendClassNames() {
assertFileExists("src/com//opcoach/xtend/project/impl/CompanyImpl.xtend");
Copy link
Owner

Choose a reason for hiding this comment

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

I guess only 1 slash is enough (everywhere in this test)

@opcoach opcoach merged commit 12c34ea into opcoach:master Dec 21, 2022
@opcoach
Copy link
Owner

opcoach commented Dec 21, 2022

This is ok for me. I will make another commit to increase the version number.

@opcoach
Copy link
Owner

opcoach commented Dec 21, 2022

Thank you for your contribution. This is now the 2.6.0 release of GMA.

I will provide it on the opcoach web site for the next 2022-12 delivery. https://opcoach.com/repository/

@PhilippeNoel PhilippeNoel deleted the issue92 branch December 22, 2022 13:22
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.

2 participants