@@ -36,6 +36,7 @@ subprojects {
36
36
configure< app.cash.licensee.LicenseeExtension > {
37
37
ignoreDependencies(" plus.sourceplus" , " protocol" )
38
38
ignoreDependencies(" plus.sourceplus" , " protocol-jvm" )
39
+ ignoreDependencies(" plus.sourceplus.interface" , " interface-booster-ui" )
39
40
allow(" Apache-2.0" )
40
41
allow(" MIT" )
41
42
allow(" EPL-1.0" )
@@ -95,11 +96,40 @@ subprojects {
95
96
configure< com.diffplug.gradle.spotless.SpotlessExtension > {
96
97
kotlin {
97
98
targetExclude(" **/generated/**" , " **/liveplugin/**" )
98
- if (file(" ../LICENSE-HEADER.txt" ).exists()) {
99
- licenseHeaderFile(file(" ../LICENSE-HEADER.txt" ))
99
+
100
+ val startYear = 2022
101
+ val currentYear = java.util.Calendar .getInstance().get(java.util.Calendar .YEAR )
102
+ val copyrightYears = if (startYear == currentYear) {
103
+ " $startYear "
100
104
} else {
101
- licenseHeaderFile(file(" ../../LICENSE-HEADER.txt" ))
105
+ " $startYear -$currentYear "
106
+ }
107
+
108
+ val jetbrainsProject = findProject(" :interfaces:jetbrains" ) ? : rootProject
109
+ val licenseHeader = Regex (" ( . Copyright [\\ S\\ s]+)" )
110
+ .find(File (jetbrainsProject.projectDir, " LICENSE" ).readText())!!
111
+ .value.lines().joinToString(" \n " ) {
112
+ if (it.trim().isEmpty()) {
113
+ " *"
114
+ } else {
115
+ " * " + it.trim()
116
+ }
117
+ }
118
+ val formattedLicenseHeader = buildString {
119
+ append(" /*\n " )
120
+ append(
121
+ licenseHeader.replace(
122
+ " Copyright [yyyy] [name of copyright owner]" ,
123
+ " Source++, the open-source live coding platform.\n " +
124
+ " * Copyright (C) $copyrightYears CodeBrig, Inc."
125
+ ).replace(
126
+ " http://www.apache.org/licenses/LICENSE-2.0" ,
127
+ " http://www.apache.org/licenses/LICENSE-2.0"
128
+ )
129
+ )
130
+ append(" /" )
102
131
}
132
+ licenseHeader(formattedLicenseHeader)
103
133
}
104
134
}
105
135
}
0 commit comments