Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewparmet committed Nov 15, 2024
1 parent 86a7374 commit 4dd4efd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/build/buf/gradle/LintConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal fun Project.configureLint() {

bufConfigFile.set(project.bufConfigFile())
inputFiles.setFrom(obtainDefaultProtoFileSet())
v1SyntaxOnly.set(bufV1SyntaxOnly())
}

tasks.named(CHECK_TASK_NAME).dependsOn(BUF_LINT_TASK_NAME)
Expand Down
10 changes: 9 additions & 1 deletion src/main/kotlin/build/buf/gradle/LintTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package build.buf.gradle

import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
Expand All @@ -34,11 +35,18 @@ abstract class LintTask : AbstractBufExecTask() {
@get:Optional
internal abstract val bufConfigFile: Property<File>

@get:Input
internal abstract val v1SyntaxOnly: Property<Boolean>

@TaskAction
fun bufLint() {
execBufInSpecificDirectory(
"lint",
bufConfigFile.orNull?.let { listOf("--config", it.readAndStripComments()) }?.takeIf { !hasWorkspace.get() }.orEmpty(),
if (v1SyntaxOnly.get() && !hasWorkspace.get()) {
bufConfigFile.orNull?.let { listOf("--config", it.readAndStripComments()) }
} else {
null
}.orEmpty(),
) {
"""
|Some Protobuf files had lint violations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ lint:
- google
- protokt
use:
- DEFAULT
- STANDARD
except:
- ENUM_ZERO_VALUE_SUFFIX

0 comments on commit 4dd4efd

Please sign in to comment.