-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add v2 buf.yaml Generate and Breaking test cases #214
Conversation
c109bdc
to
96cb31d
Compare
"--against", | ||
singleFileFromConfiguration(BUF_BREAKING_CONFIGURATION_NAME), | ||
) { | ||
val args = ArrayList<Any>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kotlin nit: conventionally one should use mutableListOf<Any>()
unless you specifically need an ArrayList.
3c405e1
to
3df659d
Compare
d4340c5
to
baf04c7
Compare
baf04c7
to
6dee0b0
Compare
val bufYaml = bufYamlGenerator.generate(project.bufConfigFile(), protoDirs) | ||
logger.info("Writing generated buf.yaml:{}\n", bufYaml) | ||
File(bufbuildDir, "buf.yaml").writeText(bufYaml) | ||
if (Version(project.getExtension().toolVersion) < Version("1.32.0")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we care about Version(project.getExtension().toolVersion) < Version("1.32.0")
in more than one place. Could be worth extracting to a constant or helper method of some kind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -35,6 +36,7 @@ import kotlin.reflect.full.declaredMemberProperties | |||
|
|||
const val CREATE_SYM_LINKS_TO_MODULES_TASK_NAME = "createSymLinksToModules" | |||
const val WRITE_WORKSPACE_YAML_TASK_NAME = "writeWorkspaceYaml" | |||
const val BUF_CLI_V2_INITIAL_VERSION = "1.32.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
9293863
to
791f20c
Compare
9738cff
to
58195cd
Compare
@@ -62,7 +62,7 @@ abstract class AbstractBreakingTest : AbstractBufIntegrationTest() { | |||
assertThat(result.output).contains("Cannot configure $BUF_BREAKING_TASK_NAME against latest release and a previous version.") | |||
} | |||
|
|||
private fun checkBreaking() { | |||
protected fun checkBreaking() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to be protected now? I saw a few commits go by with them flip flopping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can be private, not sure why my changes were not holding. Should be fixed now.
protoDirs | ||
.map { dir -> | ||
if (ignores.isEmpty()) { | ||
mapOf("path" to dir) | ||
} else { | ||
mapOf( | ||
"path" to dir, | ||
"breaking" to mapOf("ignore" to ignores.map { "$dir/$it" }), | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a format change right? Was this the output of running something like gradlew spotlessApply
? (If so, maybe we should verify formatting in CI checks -- not an action for this PR, just a comment about a possible future improvement.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a manual change but I can revert to make the PR cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting is verified in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
Note that
BreakingWithProtobufGradleTest/schema_with_multi_directory_workspace
is set to use an older Buf version because I have not been able to create a suitablev2
buf.yaml
to handle that case correctly.