Skip to content
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

Compare against the built image rather than the ephemeral workspace #41

Merged
merged 4 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/kotlin/com/parmet/buf/gradle/Breaking.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ private fun Project.configureSchemaExtraction(bufBreakingFile: LazyBufBreakingFi
private fun Project.configureBreakingTask(ext: BufExtension, bufBreakingFile: LazyBufBreakingFile) {
tasks.register<Exec>(BUF_BREAKING_TASK_NAME) {
dependsOn(BUF_BREAKING_EXTRACT_TASK_NAME)
dependsOn(BUF_BUILD_TASK_NAME)

group = CHECK_TASK_NAME

bufTask(
ext,
"breaking",
BUF_BUILD_PUBLICATION_FILENAME,
"--against",
bufBreakingFile
)
Expand Down
7 changes: 7 additions & 0 deletions src/test/kotlin/com/parmet/buf/gradle/BreakingTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class BreakingTest : AbstractBufIntegrationTest() {
assertThat(result.output).contains("Cannot configure bufBreaking against latest release and a previous version.")
}

@Test
fun `schema with multi-directory workspace`() {
publishRunner().build()
buildFile.replace("//", "")
checkRunner().build()
}

private fun checkBreaking() {
checkRunner().build()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2021 Andrew Parmet
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: v1
lint:
ignore:
- google
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2021 Andrew Parmet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id 'java'
id 'com.parmet.buf'
id 'com.google.protobuf' version "$protobufGradleVersion"
id 'maven-publish'
}

repositories {
mavenCentral()
maven { url 'build/repos/test' }
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
}

compileJava.enabled = false

publishing {
repositories {
maven { url 'build/repos/test' }
}
}

buf {
publishSchema = true
//checkSchemaAgainstLatestRelease = true

imageArtifact {
groupId = 'foo'
artifactId = 'bar'
version = '2319'
}
}

dependencies {
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2021 Andrew Parmet
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package parmet.buf.test.v1;

import "google/protobuf/any.proto";

message BasicMessage {
google.protobuf.Any any = 1;
}