-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support other formats for published image (#170)
Co-authored-by: Andrew Parmet <[email protected]>
- Loading branch information
1 parent
7fc4efd
commit 8da0e3a
Showing
20 changed files
with
445 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/kotlin/build/buf/gradle/ImageGenerationSupport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package build.buf.gradle | ||
|
||
import com.google.common.collect.Lists | ||
import org.junit.jupiter.params.provider.Arguments | ||
|
||
private val NULL_SENTINEL = Any() | ||
|
||
object ImageGenerationSupport { | ||
@JvmStatic | ||
fun publicationFileExtensionTestCase() = | ||
Lists.cartesianProduct( | ||
ImageFormat.values().map { it.formatName }, | ||
CompressionFormat.values().map { it.ext } + NULL_SENTINEL, | ||
).map { imageAndCompression -> | ||
Arguments.of(imageAndCompression[0], imageAndCompression[1].takeIf { it != NULL_SENTINEL }) | ||
} | ||
|
||
fun AbstractBufIntegrationTest.replaceBuildDetails( | ||
format: String, | ||
compression: String?, | ||
) { | ||
buildFile.replace( | ||
"imageFormat = REPLACEME", | ||
"imageFormat = '$format'", | ||
) | ||
buildFile.replace( | ||
"compressionFormat = REPLACEME", | ||
"compressionFormat = ${compression?.let { "'$it'" }}", | ||
) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...kingTest/breaking_schema_with_specified_publication_file_extension/buf/test/v1/test.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// 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 buf.test.v1; | ||
|
||
message BasicMessage {} |
32 changes: 32 additions & 0 deletions
32
...urces/BreakingTest/breaking_schema_with_specified_publication_file_extension/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
plugins { | ||
id 'java' | ||
id 'build.buf' | ||
id 'maven-publish' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url 'build/repos/test' } | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { url 'build/repos/test' } | ||
} | ||
} | ||
|
||
buf { | ||
publishSchema = true | ||
//previousVersion = '2319' | ||
|
||
build { | ||
imageFormat = REPLACEME | ||
compressionFormat = REPLACEME | ||
} | ||
|
||
imageArtifact { | ||
groupId = 'foo' | ||
artifactId = 'bar' | ||
version = '2319' | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...ProtobufGradleTest/breaking_schema_with_specified_publication_file_extension/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
plugins { | ||
id 'java' | ||
id 'com.google.protobuf' version "$protobufGradleVersion" | ||
id 'build.buf' | ||
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 | ||
//previousVersion = '2319' | ||
|
||
build { | ||
imageFormat = REPLACEME | ||
compressionFormat = REPLACEME | ||
} | ||
|
||
imageArtifact { | ||
groupId = 'foo' | ||
artifactId = 'bar' | ||
version = '2319' | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ng_schema_with_specified_publication_file_extension/src/main/proto/buf/test/v1/test.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2023 Buf Technologies, Inc. | ||
// | ||
// 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 buf.test.v1; | ||
|
||
message BasicMessage {} |
3 changes: 3 additions & 0 deletions
3
...WithWorkspaceTest/breaking_schema_with_specified_publication_file_extension/buf.work.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version: v1 | ||
directories: | ||
- workspace |
Oops, something went wrong.