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

feat: support test source dirs in the plugin #68

Merged
merged 32 commits into from
May 7, 2020

Conversation

MartinWitt
Copy link
Member

@MartinWitt MartinWitt commented Apr 17, 2020

Fixes INRIA/spoon#3327

should do the trick, with adding a new parameter for test src. Sadly I need to fix maven issues before i can test it, because a dependency cant be resolved. If somebody wants to test it, it could be faster.

For the record the following fails:

<dependency>
      <groupId>fr.inria.gforge.spoon</groupId>
      <artifactId>processors</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>test</scope>
  </dependency>

@MartinWitt
Copy link
Member Author

should be working now.

@MartinWitt MartinWitt marked this pull request as ready for review April 17, 2020 12:27
assertThat(contentSource).doesNotExist();

final File resultFileProcessor = new File(basedir, "target/spoon-maven-plugin/spoon-nb-statement.txt");
assertThat(resultFileProcessor).exists();
Copy link

Choose a reason for hiding this comment

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

I think this test will always pass. Because you have an App.java class and thus the resultFileProcessor will always exist. Am I wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

from my understanding the test will always fail, because we need the processors from the "/resources/processors/"

Copy link

Choose a reason for hiding this comment

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

Note: on my side I didn't try the test I wrote because the maven build was failing.

The processor is at

public class CountStatementProcessor extends AbstractProcessor<CtStatement> {
, ,no? So it should be there in the CP.

What I meant is that you're testing that the check worked by verifying that the output file exists. But this file will be created by the processor running on the main source, no?

Side note: this is why I didn't have any App.java class in my test.

Copy link

Choose a reason for hiding this comment

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

All this is speculation since I didn't run the maven build :)

Copy link
Member Author

Choose a reason for hiding this comment

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

having only test classes is a way better test, good point. Changed it.

@MartinWitt
Copy link
Member Author

MartinWitt commented Apr 17, 2020

now it should only test with the test source file.
You can fix the build with change your directory to /test/projects/processors and running mvn clean install -"Dmaven.compiler.source"=1.8 -"Dmaven.compiler.target"=1.8. Doing that you can already use the plugin and dont have to wait for merge, or try the prebuild from me.
spoon-maven-plugin-3.4-SNAPSHOT.zip

@MartinWitt
Copy link
Member Author

Can i remove the edit in the original issue and see this as solved/ready for review/merge?

@vmassol
Copy link

vmassol commented Apr 17, 2020

Can i remove the edit in the original issue and see this as solved/ready for review/merge?

Is that a question for me? :) If so, not sure what you mean.

@MartinWitt
Copy link
Member Author

Yes was a question for you because i added

Edit: nvm vmassol found something that needs to be fixed sry

Afterwards, because you found some open problem

@vmassol
Copy link

vmassol commented Apr 17, 2020

@MartinWitt I've closed #68 if that's what you meant. Thanks!

Copy link
Contributor

@monperrus monperrus left a comment

Choose a reason for hiding this comment

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

Thanks a lot @MartinWitt you first contribution to spoon-maven-plugin will be very useful.

See comments, esp to improve the test of thee new feature.

<plugin>
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-maven-plugin</artifactId>
<configuration>
Copy link
Contributor

Choose a reason for hiding this comment

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

the processor should be configured in full classpath

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 dont understand what you mean sry. Could you explain it?

Copy link

Choose a reason for hiding this comment

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

the processor should be configured in full classpath

@monperrus BTW could you explain why you've removed fullclasspath by default? It seemed like it would have better chance to work by default than having to force a configuration parameter, no? What am I missing? And yes I'm sure there are good reasons I don't know, I haven't followed this discussion/decision. I'm just curious to know the reasons. Thx!

Copy link

Choose a reason for hiding this comment

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

I dont understand what you mean sry. Could you explain it?

I think @monperrus means using <noclasspath>false</noclasspath> or something like this but I'm not sure either.

Copy link
Contributor

Choose a reason for hiding this comment

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

@monperrus BTW could you explain why you've removed fullclasspath by default?

It was removed from spoon-core by default, we did not make any explicit decision for spoon-maven-plugin, it inherits the default of spoon-core.

Why we set the default to NOCLASSPATH in spoon-core? Because it mawimizes the chance that a newcomer gets something interesting out of spoon without reading the doc and without setting a correct full classpath.

@monperrus
Copy link
Contributor

Now, we need to expand .travis.xml to check that spoon-maven-plugin works on hello-world-with-test/pom.xml` from the command-line. Thanks!

@MartinWitt
Copy link
Member Author

MartinWitt commented Apr 21, 2020

Still need to lookup, how to specify classpath entries, for using <noClasspath>false</noClasspath>. Rest of review should be resolved

@monperrus
Copy link
Contributor

Many many thanks @MartinWitt for the progress here.

Still need to lookup, how to specify classpath entries, for using false.

See #69

@vmassol Does this meet your use case?

@MartinWitt MartinWitt changed the title add test dir to the plugin feat: add test dir to the plugin Apr 22, 2020
README.md Outdated
@@ -160,6 +160,7 @@ Maps and objects are created like this:
## How to change source and output folder?

You can specify at spoon its input and output directories with, respectively, `srcFolder` and `outFolder` tags.
Copy link
Member Author

Choose a reason for hiding this comment

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

still needs rewrite.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@MartinWitt
Copy link
Member Author

MartinWitt commented May 1, 2020

The testConfigurationOfTheCustomInputFolder shows, that removing option removes the ability to check only some custom folder. Readd the sourceFolder setting or lose the ability?
Edit: @monperrus wrote above, the feature is rarely used.

@monperrus
Copy link
Contributor

OK for me to remove this feature.

@MartinWitt
Copy link
Member Author

All todos are resolved now.

@MartinWitt MartinWitt requested a review from monperrus May 7, 2020 10:21
@monperrus monperrus changed the title feat: add test dir to the plugin feat: support test source dirs in the plugin May 7, 2020
@monperrus monperrus merged commit 4b14e59 into SpoonLabs:master May 7, 2020
@monperrus
Copy link
Contributor

Thanks a lot @MartinWitt , that was long but very important work to be done.

@monperrus
Copy link
Contributor

Thanks @vmassol for all your inputs.

@vmassol
Copy link

vmassol commented May 7, 2020

Yippee; thanks a lot guys, you're great :) Big up to @MartinWitt

@vmassol
Copy link

vmassol commented May 13, 2020

@monperrus @MartinWitt Any idea when a spoon version containing this will be available? :) Thanks!

@MartinWitt
Copy link
Member Author

Sadly releases are out of my scope, you have to wait for a maintainer(?) for a release.
But i see no reason to not release a new version 3.4 after this breaking change.

@monperrus
Copy link
Contributor

monperrus commented May 14, 2020 via email

@vmassol
Copy link

vmassol commented May 14, 2020

bq. @vmassol do you confirm that everything works as expected on your setup?

I was actually waiting for the release to test :) Problem is that I probably won't have the time today to test it (I'm in meeting all day). Now the issue represents my need for sure and you have tests for it I guess so it should be fine. If you prefer me to test it, then I could do that Friday.

Thx

@monperrus
Copy link
Contributor

monperrus commented May 14, 2020 via email

@vmassol
Copy link

vmassol commented May 14, 2020

Yes, that would be better. We're not in a rush anyway.

Actually I won't have the time because of the release. Maybe next week, but not sure yet.

The "rush" was because I wanted to have this before the 12.4RC1 release of XWiki but from what I see it's going to be too late (I don't like to have an issue with commits and not closed for a release). But it's ok, it'll go in the next release in one month. It just means the spoon check is not active on xwiki FTM so more violations can be added any day. Definitely not critical but nice to have ASAP.

My point is that you should not wait for me. You need to have your own tests so that you're sure that it works.

But I'll be happy to help if I can, but will take some time.

Thx

@monperrus
Copy link
Contributor

No worries, we move forward.

Release 3.4 done!

@MartinWitt would you prepare a changelog to be added to https://github.com/SpoonLabs/spoon-maven-plugin/releases/tag/spoon-maven-plugin-3.4?

Thanks!

@vmassol
Copy link

vmassol commented May 15, 2020

Thanks @monperrus!

@vmassol
Copy link

vmassol commented May 15, 2020

@MartinWitt I think this comment needs to be modified since you've removed the testFolder config properties:

// Use the TEST scope so that both compile and test dependency artifacts are put in the Spoon classloader

Thanks

@vmassol
Copy link

vmassol commented May 15, 2020

@MartinWitt @monperrus I think I've found a regression in v3.4, see INRIA/spoon#3366

EDIT: Confirmed that it's a regression. I've re-run our build with v3.3 and it passed.

@MartinWitt
Copy link
Member Author

@monperrus changelog comes after fixing the regression if that is okay for you?
@vmassol looking into the comment, after fixing the new bug, if that is okay for you?

@vmassol
Copy link

vmassol commented May 15, 2020

Sure, perfectly fine. Thx a lot.

@monperrus
Copy link
Contributor

@monperrus changelog comes after fixing the regression if that is okay for you?

yes! we will release 3.4.1 and changelog it directly

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.

feat(spoon-maven-plugin): offer ability to use compile test source roots
3 participants