-
Notifications
You must be signed in to change notification settings - Fork 3
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
Git integration #4
Comments
OK got there with a slight modification of (BTW AFAIU there was a bug because the private void diff(Path v1, Path v2, Path report) throws Exception {
CompletableFuture<API> futureV1 = CompletableFuture.supplyAsync(() -> buildAPI(v1));
CompletableFuture<API> futureV2 = CompletableFuture.supplyAsync(() -> buildAPI(v2));
CompletableFuture.allOf(futureV1, futureV2).join();
API apiV1 = futureV1.get();
API apiV2 = futureV2.get();
// API diff
Stopwatch sw = Stopwatch.createStarted();
APIDiff diff = new APIDiff(apiV1, apiV2);
List<BreakingChange> bcs = diff.diff();
System.out.println("API diff: " + sw.elapsed().toMillis());
if (report != null)
diff.breakingChangesReport(report);
else {
for (BreakingChange bc : bcs)
System.out.println(bc);
}
} Got the logger to shut-up by adding this to <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency> And finally got my output!
Funny thing, the parameter I added to breakingChangesReport induces a METHOD_REMOVED BC so I guess this is working 😄 Side note, it would be awesome to get rid of the debug information about parsing time and such, maybe using a logger or maybe using a verbose option? |
It's a super cool use case; thanks for the idea! Roseau now only outputs the breaking changes on the standard output, by default, debug information is now hidden behind the Got your use case to work with the following configuration:
Output:
Don't expect too much accuracy in Roseau's results yet, but that's a neat use case. Will keep support in the future ;) |
That's really nice! Well done. I was thinking of using it in a blocking way to return an error code when the diff contains breaking change (for libs with 0 BC policies). Apparently, there is a trustExitCode option in Git but I am not able to get it working. I will already try to create a PR with the fail mode. |
When running
That's a pity, because |
For reference, here's a simple illustration of the issue with a repository containing two interfaces:
interface IA {
}
public interface IB extends IA {} The patch is: interface IA {
-
+ void foo();
} This is breaking, because the public interface
So |
A somewhat convoluted workaround is to create an alias that takes two revisions as inputs and uses
This works well when you can provide the two revisions but:
|
I guess that if you want to diff with the current version then you just need to use |
That could work, but the alias would be quite convoluted and would deviate from the standard |
I agree that your alias is IMHO not in the scope of what an alias should be. For instance, it is not portable to Windows, etc... Another possibility is to use something like JGit and implement the integration on Roseau's side. WDYT? |
Hi there! I am trying to integrate roseau with Git and I have this so far:
I have modified
roseau.sh
as such:And amazingly I can run a
git rs
to see the diff between the current code and HEAD. However the output is not that interesting for instance:(Note it should be nice to set SLF4J to no-op. to avoid this noisy output at the beginning)
Maybe I am not using the CLI correctly and there is a way to have more info into the console? Or maybe it would require to introduce a plain text formatter?
Anyway I think that would be awesome to be able to use roseau this way!
The text was updated successfully, but these errors were encountered: