Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3985252
Basic Maven plugin infrastructure
tdegueul Mar 21, 2025
4e24325
Simple draft version of the Maven plugin
tdegueul Mar 21, 2025
1355ce0
Merge branch 'main' into maven-plugin
tdegueul Sep 25, 2025
bfbc4a9
maven-plugin: 0.4.0-SNAPSHOT
tdegueul Sep 25, 2025
ddc936e
WIP
tdegueul Sep 25, 2025
d7928a9
Enhance Maven plugin to support `oldJar` parameter, update dependency…
tdegueul Sep 25, 2025
668d3a8
old.jar test file
tdegueul Sep 25, 2025
a8c65d1
WIP
tdegueul Sep 25, 2025
ea25472
Making sure we're wrapping internal exceptions in RoseauException
tdegueul Sep 25, 2025
7b134cd
Skip 'pom' projects
tdegueul Sep 25, 2025
8e1ba1c
Basic scaffolding for Maven integration tests
tdegueul Sep 25, 2025
91411f0
Merge branch 'main' into maven-plugin
tdegueul Nov 4, 2025
ba20475
WIP
tdegueul Nov 4, 2025
301ecb2
Merge branch 'main' into maven-plugin
tdegueul Jan 31, 2026
66ff52d
WIP
tdegueul Feb 2, 2026
b92a164
MavenFormatter to output processable data
tdegueul Feb 2, 2026
2d9ec35
WIP
tdegueul Feb 4, 2026
2b060b1
WIP
tdegueul Feb 4, 2026
40b4aa6
WIP
tdegueul Feb 6, 2026
929bb59
WIP plug-in tests
tdegueul Feb 10, 2026
7c01532
Less fixtures, more tests
tdegueul Feb 11, 2026
21e618d
WIP
tdegueul Feb 21, 2026
0691df9
WIP
tdegueul Feb 21, 2026
6a7ebe0
WIP
tdegueul Feb 21, 2026
c773bb4
WIP
tdegueul Feb 21, 2026
cbcf033
Finalize tests
tdegueul Feb 22, 2026
ea7f0e8
Finalized
tdegueul Feb 22, 2026
25982ed
Merge branch 'main' into maven-plugin
tdegueul Mar 8, 2026
986ba55
Prepare for merge
tdegueul Mar 8, 2026
b7e6710
Prepare for merge
tdegueul Mar 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 3 additions & 37 deletions cli/src/main/java/io/github/alien/roseau/cli/RoseauCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
import io.github.alien.roseau.Library;
import io.github.alien.roseau.Roseau;
import io.github.alien.roseau.RoseauException;
import io.github.alien.roseau.RoseauOptions;
import io.github.alien.roseau.api.model.API;
import io.github.alien.roseau.diff.RoseauReport;
import io.github.alien.roseau.diff.changes.BreakingChange;
import io.github.alien.roseau.diff.formatter.BreakingChangesFormatter;
import io.github.alien.roseau.diff.formatter.BreakingChangesFormatterFactory;
import io.github.alien.roseau.diff.formatter.CliFormatter;
import io.github.alien.roseau.options.RoseauOptions;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.config.Configurator;
Expand All @@ -19,7 +17,6 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -145,19 +142,6 @@ private static List<Path> buildClasspathFromString(String cp) {
.toList();
}

private void writeReport(RoseauReport report, BreakingChangesFormatterFactory format, Path path) {
try {
if (path.getParent() != null) {
Files.createDirectories(path.getParent());
}
BreakingChangesFormatter fmt = BreakingChangesFormatterFactory.newBreakingChangesFormatter(format);
Files.writeString(path, fmt.format(report), StandardCharsets.UTF_8);
console.printlnVerbose("Report has been written to %s".formatted(path));
} catch (IOException e) {
throw new RoseauException("Error writing report to %s".formatted(path), e);
}
}

private void writeApiReport(API api, Path apiPath) {
try {
if (apiPath.getParent() != null) {
Expand All @@ -170,24 +154,6 @@ private void writeApiReport(API api, Path apiPath) {
}
}

private RoseauReport filterReport(RoseauReport report, RoseauOptions.Diff diffOptions) {
List<BreakingChange> bcs = diffOptions.sourceOnly()
? report.getSourceBreakingChanges()
: diffOptions.binaryOnly()
? report.getBinaryBreakingChanges()
: report.getBreakingChanges();

Path ignorePath = diffOptions.ignore();
if (ignorePath != null && Files.isRegularFile(ignorePath)) {
IgnoredCsvFile ignoredFile = new IgnoredCsvFile(ignorePath);
bcs = bcs.stream()
.filter(bc -> !ignoredFile.isIgnored(bc))
.toList();
}

return new RoseauReport(report.v1(), report.v2(), bcs);
}

private void checkOptions(RoseauOptions options) {
Path v1Path = options.v1().location();

Expand Down Expand Up @@ -284,7 +250,7 @@ private void doApi(Library library, RoseauOptions.Library libraryOptions) {
private boolean doDiff(Library v1, Library v2, RoseauOptions options) {
buildClasspath(v1);
buildClasspath(v2);
RoseauReport report = filterReport(diff(v1, v2), options.diff());
RoseauReport report = diff(v1, v2).filterReport(options.diff());
console.println(new CliFormatter(plain ? CliFormatter.Mode.PLAIN : CliFormatter.Mode.ANSI).format(report));

if (options.v1().apiReport() != null) {
Expand All @@ -294,7 +260,7 @@ private boolean doDiff(Library v1, Library v2, RoseauOptions options) {
writeApiReport(report.v2(), options.v2().apiReport());
}
options.reports().forEach(reportOption ->
writeReport(report, reportOption.format(), reportOption.file())
report.writeReport(reportOption.format(), reportOption.file())
);

return !report.getBreakingChanges().isEmpty();
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/io/github/alien/roseau/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Suppliers;
import io.github.alien.roseau.extractors.ExtractorType;
import io.github.alien.roseau.options.RoseauOptions;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down
46 changes: 43 additions & 3 deletions core/src/main/java/io/github/alien/roseau/diff/RoseauReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import io.github.alien.roseau.RoseauException;
import io.github.alien.roseau.api.model.API;
import io.github.alien.roseau.api.model.TypeDecl;
import io.github.alien.roseau.api.model.TypeMemberDecl;
import io.github.alien.roseau.api.model.reference.TypeReference;
import io.github.alien.roseau.diff.changes.BreakingChange;
import io.github.alien.roseau.diff.changes.BreakingChangeDetails;
import io.github.alien.roseau.diff.changes.BreakingChangeKind;

import io.github.alien.roseau.diff.formatter.BreakingChangesFormatter;
import io.github.alien.roseau.diff.formatter.BreakingChangesFormatterFactory;
import io.github.alien.roseau.options.IgnoredCsvFile;
import io.github.alien.roseau.options.RoseauOptions;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
Expand Down Expand Up @@ -115,6 +124,37 @@ public Map<TypeMemberDecl, List<BreakingChange>> getBreakingChangesPerMember(Typ
));
}

public RoseauReport filterReport(RoseauOptions.Diff diffOptions) {
List<BreakingChange> bcs = diffOptions.sourceOnly()
? getSourceBreakingChanges()
: diffOptions.binaryOnly()
? getBinaryBreakingChanges()
: getBreakingChanges();

Path ignorePath = diffOptions.ignore();
if (ignorePath != null && Files.isRegularFile(ignorePath)) {
IgnoredCsvFile ignoredFile = new IgnoredCsvFile(ignorePath);
bcs = bcs.stream()
.filter(bc -> !ignoredFile.isIgnored(bc))
.toList();
}

return new RoseauReport(v1(), v2(), bcs);
}

public void writeReport(BreakingChangesFormatterFactory format, Path path) {
try {
if (path.getParent() != null) {
Files.createDirectories(path.getParent());
}

BreakingChangesFormatter fmt = BreakingChangesFormatterFactory.newBreakingChangesFormatter(format);
Files.writeString(path, fmt.format(this), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new RoseauException("Error writing report to %s".formatted(path), e);
}
}

public static Builder builder(API v1, API v2) {
return new Builder(v1, v2);
}
Expand Down Expand Up @@ -145,12 +185,12 @@ public void memberBC(BreakingChangeKind kind, TypeDecl impactedType, TypeMemberD
}

public void memberBC(BreakingChangeKind kind, TypeDecl impactedType, TypeMemberDecl impactedMember,
TypeMemberDecl newMember) {
TypeMemberDecl newMember) {
memberBC(kind, impactedType, impactedMember, newMember, new BreakingChangeDetails.None());
}

public void memberBC(BreakingChangeKind kind, TypeDecl impactedType, TypeMemberDecl impactedMember,
TypeMemberDecl newMember, BreakingChangeDetails details) {
TypeMemberDecl newMember, BreakingChangeDetails details) {
// java.lang.Object methods are an absolute pain to handle. Many rules
// do not apply to them as they're implicitly provided to any class.
if (impactedMember.getContainingType().equals(TypeReference.OBJECT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public String format(RoseauReport report) {

StringBuilder sb = new StringBuilder();

sb.append(bold("Breaking Changes Found: ")).append(changes.size());
sb.append(bold("Breaking Changes found: ")).append(changes.size());
sb.append(" (").append(binaryBreaking).append(" binary-breaking, ");
sb.append(sourceBreaking).append(" source-breaking)");
sb.append(System.lineSeparator());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.alien.roseau.cli;
package io.github.alien.roseau.options;

import io.github.alien.roseau.RoseauException;
import io.github.alien.roseau.diff.changes.BreakingChange;
Expand All @@ -10,13 +10,12 @@
import java.util.List;
import java.util.stream.Stream;

class IgnoredCsvFile {
public class IgnoredCsvFile {
private final List<Ignored> ignoredBCs;

private record Ignored(String type, String symbol, BreakingChangeKind kind) {
}
private record Ignored(String type, String symbol, BreakingChangeKind kind) {}

IgnoredCsvFile(Path csv) {
public IgnoredCsvFile(Path csv) {
try (Stream<String> lines = Files.lines(csv)) {
ignoredBCs = lines
.map(String::strip)
Expand All @@ -41,7 +40,7 @@ private record Ignored(String type, String symbol, BreakingChangeKind kind) {
}
}

boolean isIgnored(BreakingChange bc) {
public boolean isIgnored(BreakingChange bc) {
return ignoredBCs.stream().anyMatch(ign -> bc.impactedType().getQualifiedName().equals(ign.type()) &&
bc.impactedSymbol().getQualifiedName().equals(ign.symbol()) &&
bc.kind() == ign.kind());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.github.alien.roseau;
package io.github.alien.roseau.options;

import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import io.github.alien.roseau.RoseauException;
import io.github.alien.roseau.diff.formatter.BreakingChangesFormatterFactory;

import java.io.IOException;
Expand Down
1 change: 1 addition & 0 deletions core/src/test/java/io/github/alien/roseau/LibraryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.github.alien.roseau.api.model.MethodDecl;
import io.github.alien.roseau.api.model.TypeDecl;
import io.github.alien.roseau.extractors.ExtractorType;
import io.github.alien.roseau.options.RoseauOptions;
import io.github.alien.roseau.utils.TestUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.alien.roseau.diff;

import io.github.alien.roseau.Roseau;
import io.github.alien.roseau.RoseauOptions;
import io.github.alien.roseau.options.RoseauOptions;
import io.github.alien.roseau.utils.TestUtils;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.alien.roseau;
package io.github.alien.roseau.options;

import io.github.alien.roseau.diff.formatter.BreakingChangesFormatterFactory;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.common.io.RecursiveDeleteOption;
import io.github.alien.roseau.Library;
import io.github.alien.roseau.Roseau;
import io.github.alien.roseau.RoseauOptions.Exclude;
import io.github.alien.roseau.options.RoseauOptions.Exclude;
import io.github.alien.roseau.api.model.API;
import io.github.alien.roseau.api.model.AnnotationDecl;
import io.github.alien.roseau.api.model.AnnotationMethodDecl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<parent>
<groupId>io.github.alien</groupId>
<artifactId>api-extractor-tests</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>
</parent>

<artifactId>without-modules</artifactId>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<parent>
<groupId>io.github.alien</groupId>
<artifactId>api-extractor-tests</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>
</parent>

<artifactId>without-modules</artifactId>

</project>
</project>
Loading
Loading