@@ -29,6 +29,8 @@ import org.gradle.api.Project
29
29
import org.gradle.api.file.RegularFileProperty
30
30
import org.gradle.api.provider.Property
31
31
import org.gradle.api.tasks.Input
32
+ import org.gradle.api.tasks.InputFiles
33
+ import org.gradle.api.tasks.Internal
32
34
import org.gradle.api.tasks.Optional
33
35
import org.gradle.api.tasks.OutputFile
34
36
import org.gradle.api.tasks.TaskAction
@@ -120,6 +122,14 @@ abstract class ReleaseGenerator : DefaultTask() {
120
122
121
123
@get:Optional @get:Input abstract val printReleaseConfig: Property <String >
122
124
125
+ @get:Optional @get:InputFiles abstract val commitsToIgnoreFile: RegularFileProperty
126
+
127
+ @get:Internal
128
+ val commitsToIgnore: List <ObjectId >
129
+ get() =
130
+ commitsToIgnoreFile.asFileIfExistsOrNull()?.readLines()?.map { ObjectId .fromString(it) }
131
+ ? : emptyList()
132
+
123
133
@get:OutputFile abstract val releaseConfigFile: RegularFileProperty
124
134
125
135
@get:OutputFile abstract val releaseReportMdFile: RegularFileProperty
@@ -224,7 +234,10 @@ abstract class ReleaseGenerator : DefaultTask() {
224
234
.addRange(previousReleaseRef, currentReleaseRef)
225
235
.setMaxCount(10 )
226
236
.call()
227
- .filter { ! it.fullMessage.contains(RELEASE_CHANGE_FILTER ) }
237
+ .filter {
238
+ ! it.fullMessage.contains(RELEASE_CHANGE_FILTER ) &&
239
+ ! commitsToIgnore.any { ignore -> it.id == ignore }
240
+ }
228
241
.isNotEmpty()
229
242
230
243
private fun getDirChanges (
@@ -238,8 +251,14 @@ abstract class ReleaseGenerator : DefaultTask() {
238
251
.addPath(directory)
239
252
.addRange(previousReleaseRef, currentReleaseRef)
240
253
.call()
241
- .filter { ! it.fullMessage.contains(RELEASE_CHANGE_FILTER ) }
254
+ .filter {
255
+ ! it.fullMessage.contains(RELEASE_CHANGE_FILTER ) &&
256
+ ! commitsToIgnore.any { ignore -> it.id == ignore }
257
+ }
242
258
.map { CommitDiff .fromRevCommit(it) }
243
259
244
260
private fun getRelativeDir (project : Project ) = project.path.substring(1 ).replace(' :' , ' /' )
245
261
}
262
+
263
+ fun RegularFileProperty.asFileIfExistsOrNull (): File ? =
264
+ if (isPresent && asFile.get().exists()) asFile.get() else null
0 commit comments