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

Add how explanation of how to work with JPSG projects in IDE #1

Open
leventov opened this issue May 10, 2019 · 4 comments
Open

Add how explanation of how to work with JPSG projects in IDE #1

leventov opened this issue May 10, 2019 · 4 comments

Comments

@leventov
Copy link
Member

On the other hand, IDE will think that there are duplicate classes in the project (because a template file's name (class name) and package are the same as in one of the generated specializations), so you will lose the ability to build the project from IDE (you will need to use Maven or Gradle every time to build the project).

In tutorial is false, because, at least in IntelliJ, there are "Delegate IDE build/run actions to Gradle (maven)".

This issue is about adding that information to the tutorial.

@jdimeo
Copy link

jdimeo commented Mar 27, 2020

@leventov Really cool idea you have here. Regarding this issue, I do really want to use my template as the "real" class, so I've put the JPSG folder on the main classpath. To avoid creating duplicate classes I've done the following workaround:

/* with double|int type */
package com.x.y.z;
/* if int type */
...
/* endif */

That generates a blank file, except the package declaration, for the double type which is already covered by the template. This compiles, only puts one class in the .jar, and works with IDEs, but is a bit sloppy having two files with the same name.

What if there was a syntax like:

/* with double|int type except double */

which would allow you to find and use the double template, but essentially skip it in the matrix of things to generate.

Maybe this "skip" ability already exists and I'm missing it in the docs?

@leventov
Copy link
Member Author

Did you try:

/* with double|int type */
/* if !(double type) */
package com.x.y.z;

It's described in the end of this section: https://github.com/TimeAndSpaceIO/java-primitive-specializations-generator#-if--blocks, just before the "define" section

@jdimeo
Copy link

jdimeo commented Mar 27, 2020

@leventov that did it! thank you!
So, isn't this the primary use case? that you want to use your template as one of the real classes and generally want to skip it in the matrix of dimensions? If it was the default behavior to skip the template, and you had to force it to re-generate (instead of forcing it to skip with an if) wouldn't that avoid the IDE/compiler issues?

@leventov
Copy link
Member Author

It was not like my original use-cases, because my templates are not quite 100% functional Java code, so I made the full generation behaviour as default.

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

No branches or pull requests

2 participants