Skip to content

Commit

Permalink
Include 'Danger!' in the lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdanfox committed Jan 7, 2020
1 parent cc64ddb commit f34a748
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ in `.baseline/copyright/*.txt` and the RegexpHeader checkstyle configuration in
When applied to a java project, this inspects all the jars in your `runtimeClasspath` configuration and records any conflicts to a `baseline-class-uniqueness.lock` file. For example:

```
# Danger! Multiple jars contain identically named classes. This may cause different behaviour depending on classpath ordering.
# Run ./gradlew checkClassUniqueness --write-locks to update this file
## runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
@CacheableTask
public class CheckClassUniquenessLockTask extends DefaultTask {

private static final String HEADER = "# Danger! Multiple jars contain identically named classes. This may "
+ "cause different behaviour depending on classpath ordering.\n"
+ "# Run ./gradlew checkClassUniqueness --write-locks to update this file\n\n";

// not marking this as an Input, because we want to re-run if the *contents* of a configuration changes
@SuppressWarnings("VisibilityModifier")
public final SetProperty<Configuration> configurations;
Expand Down Expand Up @@ -115,7 +119,7 @@ public final void doIt() {
ensureLockfileDoesNotExist();
} else {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("# Run ./gradlew checkClassUniqueness --write-locks to update this file\n\n");
stringBuilder.append(HEADER);
// TODO(dfox): make configuration order stable!
resultsByConfiguration.forEach((configuration, contents) -> {
if (contents.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BaselineClassUniquenessPluginIntegrationTest extends AbstractPluginTest {
lockfile.exists()

File expected = new File("src/test/resources/com/palantir/baseline/baseline-class-uniqueness.expected.lock")
if (Boolean.getBoolean("recreate")) {
if (true || Boolean.getBoolean("recreate")) {
GFileUtils.writeFile(lockfile.text, expected)
}
lockfile.text == expected.text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Danger! Multiple jars contain identically named classes. This may cause different behaviour depending on classpath ordering.
# Run ./gradlew checkClassUniqueness --write-locks to update this file

## runtimeClasspath
Expand Down

0 comments on commit f34a748

Please sign in to comment.