Skip to content

Commit

Permalink
feat: Add a property to hide the banner
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Nov 17, 2022
1 parent ac6463a commit 7f590fa
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ final class Banner {
private final List<String> visited = []

private static final Banner b = new Banner()
private static final String ORG_KORDAMP_BANNER = 'org.kordamp.banner'

private Banner() {
// nooop
// noop
}

static void display(Settings settings) {
Expand Down Expand Up @@ -76,22 +77,24 @@ final class Banner {
}

static private checkMarkerFile(Gradle gradle) {
boolean printBanner = null == System.getProperty(ORG_KORDAMP_BANNER) || Boolean.getBoolean(ORG_KORDAMP_BANNER)

File parent = new File(gradle.gradleUserHomeDir, 'caches')
File markerFile = b.getMarkerFile(parent)
if (!markerFile.exists()) {
markerFile.parentFile.mkdirs()
markerFile.text = '1'
println(b.banner)
if (printBanner) println(b.banner)
} else {
try {
int count = Integer.parseInt(markerFile.text)
if (count < 3) {
println(b.banner)
if (printBanner) println(b.banner)
}
markerFile.text = (count + 1) + ''
} catch (NumberFormatException e) {
markerFile.text = '1'
println(b.banner)
if (printBanner) println(b.banner)
}
}
}
Expand Down

0 comments on commit 7f590fa

Please sign in to comment.