forked from projectnessie/nessie
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated protobuf code must be run with the protobuf runtime using the exact same version as the generator used. This is currently a soft constraint, but it is likely that protobuf will enforce that in future protobuf versions. Using a different version of the protobuf runtime can (and does) lead to issues at runtime, see [this issue for an example](protocolbuffers/protobuf#11986). This change adds a new Nessie artifact `nessie-protobuf-relocated` which contains a relocated protobuf runtime that is used by all other Nessie artifacts. Also: * Move `*.proto` files into the directories corresponding to the Java package names. * Remove the `ProtobufHelperPlugin`, as the underlying issue (not exposing the generated java source folders in IDEs) has been fixed. * Do not apply checkstyle to Gradle projects that just generate protobuf code (the `ProtobufHelperPlugin` did that before). Side note: CEL-Java heavily depends on protobuf itself via its API and not just as a runtime/compile-only dependency. As long as no generated protobuf code is being used, it _should_ be okay to use a different protobuf version at runtime, but there is and will be no guarantee.
- Loading branch information
Showing
7 changed files
with
59 additions
and
56 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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2023 Dremio | ||
* | ||
* 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. | ||
*/ | ||
|
||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
signing | ||
id("org.projectnessie.buildsupport.reflectionconfig") | ||
`nessie-conventions` | ||
} | ||
|
||
apply<NessieShadowJarPlugin>() | ||
|
||
extra["maven.name"] = "Nessie - Relocated Protobuf ${libs.protobuf.java.get().version}" | ||
|
||
dependencies { implementation(libs.protobuf.java) } | ||
|
||
reflectionConfig { | ||
// Consider classes that extend one of these classes... | ||
classExtendsPatterns.set( | ||
listOf( | ||
"com.google.protobuf.GeneratedMessageV3", | ||
"com.google.protobuf.GeneratedMessageV3.Builder" | ||
) | ||
) | ||
// ... and classes the implement this interface. | ||
classImplementsPatterns.set(listOf("com.google.protobuf.ProtocolMessageEnum")) | ||
// Also include generated classes (e.g. google.protobuf.Empty) via the "runtimeClasspath", | ||
// which contains the the "com.google.protobuf:protobuf-java" dependency. | ||
includeConfigurations.set(listOf("runtimeClasspath")) | ||
relocations.put("com[.]google[.]protobuf[.]", "org.projectnessie.nessie.relocated.protobuf.$1") | ||
} | ||
|
||
tasks.named<ShadowJar>("shadowJar") { | ||
dependsOn("generateReflectionConfig") | ||
relocate("com.google.protobuf", "org.projectnessie.nessie.relocated.protobuf") | ||
manifest { attributes["Google-Protobuf-Version"] = libs.protobuf.java.get().version } | ||
} |