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

fix(regression): add created source files to spoon input #70

Merged
merged 17 commits into from
May 22, 2020

Conversation

MartinWitt
Copy link
Member

@MartinWitt MartinWitt commented May 15, 2020

See (INRIA/spoon#3366) for details. Currently there is only a test project with a simple javacc case and a addition to the CI as starting point for the bug.
Edit: this should now fully showcase the bug, with a minimal working example

@MartinWitt
Copy link
Member Author

MartinWitt commented May 15, 2020

Looks fixed, but

  • Changelog still missing
  • Remove hardcoded version
  • Refactor the added source code
  • Try fix for the xwiki bug
  • Create a regression test from the xwiki snippet

Everything expect the last bulletpoint needs to be done before a merge.
@vmassol are there some deadlines you like to keep?

@vmassol
Copy link

vmassol commented May 15, 2020

@MartinWitt what I don't understand is that getCompileSourceRoots() should also return generated sources paths.

@vmassol are there some deadlines you like to keep?

No it's ok, no urgency, we'll release XWiki 12.4 without this and it'll go in 12.5 (next month release).

Thanks a lot.

@MartinWitt
Copy link
Member Author

MartinWitt commented May 15, 2020

My first thought was, that it should return it too. But looking https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html and https://stackoverflow.com/questions/30039613/maven-plugin-get-generated-sources-directory it seems like maven has no standard defined for this and cant resolve generated-source for you. And I found no method to get generated-sources.

@vmassol
Copy link

vmassol commented May 15, 2020

Normally when you code a plugin that generates sources you add the target source directory to the source roots. Maybe the javacc plugin is not compliant and doesn't do it?

@vmassol
Copy link

vmassol commented May 15, 2020

Maybe the javacc plugin is not compliant and doesn't do it?

ok I think that's the reason, the old codehaus javacc mojo is not respecting the rules from what I see: https://github.com/mojohaus/javacc-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/javacc/JavaCCMojo.java#L170

@vmassol
Copy link

vmassol commented May 15, 2020

@MartinWitt
Copy link
Member Author

Oh thank you for your research i have only searched the bug on our side. Now we change from a bug to supporting maven plugins that work "incorrectly", but we could fix this on our side. Javacc looks like a often used code generator, so dropping support is huge step.

@vmassol
Copy link

vmassol commented May 15, 2020

So I've upgraded to this new plugin and I have the same error on the spoon side.

@vmassol
Copy link

vmassol commented May 15, 2020

Issue opened on the javacc plugin side at tulipcc/tulipcc-maven-plugin#17

@MartinWitt
Copy link
Member Author

You are really fast, thank you for your effort. Lets see what javacc developers say to your issue.
But we should keep in mind, that we could fix things like this on our site, if more maven plugins are not "good Maven citizen".

@vmassol
Copy link

vmassol commented May 15, 2020

Yes I don't think we should wait on them.

@vmassol
Copy link

vmassol commented May 15, 2020

@MartinWitt they have answered and it seems they call the addCompileSourceRoot() so normally you should get it. See tulipcc/tulipcc-maven-plugin#17 (comment)

It's also called with the older codehaus javacc maven plugin, see https://github.com/mojohaus/javacc-maven-plugin/blob/739194d58700260c4b600cd1bbc40979dfd8f851/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L657

@MartinWitt
Copy link
Member Author

MartinWitt commented May 16, 2020

hmm looks like my bad. You are 100% correct, it works without adding the lines.
Edit: testing the "new" version on xwiki as soon, as the nexus.xwiki server seems working.

@MartinWitt MartinWitt changed the title add project to showcase the problem with javacc fix(regression): add created source files to spoon input May 16, 2020
@MartinWitt
Copy link
Member Author

I changed the pom xwiki-rendering-wikimodel to force spoon 3.5-SNAPSHOT (version with fix) and rann mvn install -DskipTests > spoon.log. As you see in the log it works now?

      <plugin>
        <groupId>fr.inria.gforge.spoon</groupId>
        <artifactId>spoon-maven-plugin</artifactId>
        <version>3.5-SNAPSHOT</version>
      <executions>
        <execution>
          <goals>
            <goal>check</goal>
          </goals>
        </execution>
        </executions>
        <configuration>
          <includeTest>true</includeTest>
          <includeSource>true</includeSource>
          <noClasspath>false</noClasspath>
        </configuration>
        </plugin>```

[spoon.log](https://github.com/SpoonLabs/spoon-maven-plugin/files/4645876/spoon.log)

@vmassol
Copy link

vmassol commented May 18, 2020

As you see in the log it works now?

It does! Cool, thanks a lot :)

@MartinWitt
Copy link
Member Author

The hardcoded versions can only be removed after release, because maven does not support use newest version like gradle. Only point left is create a real regression testcase for this. I hope I can get this done tomorrow/tonight.

@vmassol
Copy link

vmassol commented May 18, 2020

@MartinWitt what hardcoded versions?

@MartinWitt
Copy link
Member Author

MartinWitt commented May 18, 2020

https://github.com/SpoonLabs/spoon-maven-plugin/pull/70/files#diff-403631b4cad466f44faaca502d672427R38 like this.
It's unrelated to your issue and more something i need to fix after a release.

<plugin>
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-maven-plugin</artifactId>
<version>3.5-SNAPSHOT</version>
Copy link

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

because i normally use gradle and didn't knew it. Going to have a look thx.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about simply removing <version>3.5-SNAPSHOT</version> as you did above?

Copy link

Choose a reason for hiding this comment

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

If you remove the version the build won't be reproducible and maven will use the latest version available. You need a version (and you should actually use the maven enforcer to always make sure all versions are set).

@MartinWitt
Copy link
Member Author

MartinWitt commented May 20, 2020

To finish this bugfix/issue, the task were:

  1. Changelog still missing
  2. Remove hardcoded version
  3. Refactor the added source code
  4. Try fix for the xwiki bug
  5. Create a regression test from the xwiki snippet
  1. is added, see link
  2. happens after merge, when we have a new version number.( @vmassol solution requires a resource file or i understood something wrong ( i'm far away from maven expert))
  3. Done
  4. See logfile, it works now.
  5. I believe adding xwiki with generated files as a regression test only slows down the CI and creates a strange dependency if some errors occur. The current test should test the same in in smaller scale( use a generated java file in fullClassPath).

Looks like all is done and @monperrus time for a review?

INRIA/spoon#3345 is still open, but i believe a version like 3.4.1 shouldn't contain new features. This issue is part of patch 3.5?

@monperrus
Copy link
Contributor

Thanks a lot for the progress. LGTM, see last comment.

Do we already have a fix for INRIA/spoon#3345?

If yes, let's merge it now and release 3.5 directly and save one release.
If no, let's release directly 3.4.1, per this PR.

@MartinWitt
Copy link
Member Author

Looking here we use fullclasspathmode by default. The issue is only changing a parameter?

@monperrus
Copy link
Contributor

Looking here we use fullclasspathmode by default.

So INRIA/spoon#3345 is already fixed, and we can add it in the Changelog.

I think we can proceed, merge this PR and release 3.4.1. WDYT?

@MartinWitt
Copy link
Member Author

just did a small readme update and yes i believe you can merge it.
@vmassol maybe a unrelated question but could we link to the xwiki usage, when you integrated it into it? A real world example is always nice to have.

@vmassol
Copy link

vmassol commented May 22, 2020

@vmassol maybe a unrelated question but could we link to the xwiki usage, when you integrated it into it? A real world example is always nice to have.

Definitely, with pleasure :)

FYI, on the xwiki.org site we documented our spoon usages at https://dev.xwiki.org/xwiki/bin/view/Community/Building/#HAutomaticChecks

@monperrus monperrus merged commit f2bc42c into SpoonLabs:master May 22, 2020
@monperrus
Copy link
Contributor

Merged, thanks a lot @MartinWitt

Now releasing 3.4.1

@monperrus
Copy link
Contributor

FYI, 3.4.1 is in Maven Central

@vmassol
Copy link

vmassol commented May 22, 2020

Thanks @MartinWitt and @monperrus

I've now tested v3.4.1 and I've found a regression: INRIA/spoon#3376

I've rolled-back to v3.3 for now.

Thanks! (and sorry ;))

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.

3 participants