File tree 2 files changed +33
-17
lines changed
2 files changed +33
-17
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,7 +26,39 @@ subprojects {
26
26
apply (plugin = " com.diffplug.spotless" )
27
27
configure< com.diffplug.gradle.spotless.SpotlessExtension > {
28
28
kotlin {
29
- licenseHeaderFile(file(" ../LICENSE-HEADER.txt" ))
29
+ val startYear = 2022
30
+ val currentYear = java.util.Calendar .getInstance().get(java.util.Calendar .YEAR )
31
+ val copyrightYears = if (startYear == currentYear) {
32
+ " $startYear "
33
+ } else {
34
+ " $startYear -$currentYear "
35
+ }
36
+
37
+ val probeProject = findProject(" :probes:jvm" ) ? : rootProject
38
+ val licenseHeader = Regex (" ( . Copyright [\\ S\\ s]+)" )
39
+ .find(File (probeProject.projectDir, " LICENSE" ).readText())!!
40
+ .value.lines().joinToString(" \n " ) {
41
+ if (it.trim().isEmpty()) {
42
+ " *"
43
+ } else {
44
+ " * " + it.trim()
45
+ }
46
+ }
47
+ val formattedLicenseHeader = buildString {
48
+ append(" /*\n " )
49
+ append(
50
+ licenseHeader.replace(
51
+ " Copyright [yyyy] [name of copyright owner]" ,
52
+ " Source++, the open-source live coding platform.\n " +
53
+ " * Copyright (C) $copyrightYears CodeBrig, Inc."
54
+ ).replace(
55
+ " http://www.apache.org/licenses/LICENSE-2.0" ,
56
+ " http://www.apache.org/licenses/LICENSE-2.0"
57
+ )
58
+ )
59
+ append(" /" )
60
+ }
61
+ licenseHeader(formattedLicenseHeader)
30
62
}
31
63
}
32
64
}
You can’t perform that action at this time.
0 commit comments