-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
cel-standalone
(no dependencies) artifact (#479)
Generated Protobuf code must be used with the exact same Protobuf runtime version, because especially provides no back-/forward compatibility guarantees. This change introduces a new artifact `cel-standalone`, which provides a shadow/uber jar with including relocated classes of the required dependencies. `cel-standalone` should only be used when there are library compatibility issues, but must not be used in combination with other CEL artifacts.
- Loading branch information
Showing
6 changed files
with
105 additions
and
6 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
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,87 @@ | ||
/* | ||
* Copyright (C) 2023 The Authors of CEL-Java | ||
* | ||
* 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("com.github.johnrengelman.shadow") | ||
`cel-conventions` | ||
} | ||
|
||
dependencies { | ||
api(project(":cel-tools")) | ||
api(project(":cel-jackson")) | ||
api(project(":cel-generated-antlr", configuration = "shadow")) | ||
|
||
compileOnly(libs.protobuf.java) | ||
compileOnly(libs.agrona) | ||
|
||
compileOnly(platform(libs.jackson.bom)) | ||
compileOnly("com.fasterxml.jackson.core:jackson-databind") | ||
compileOnly("com.fasterxml.jackson.core:jackson-core") | ||
compileOnly("com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf") | ||
compileOnly("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") | ||
} | ||
|
||
val shadowJar = tasks.named<ShadowJar>("shadowJar") | ||
|
||
shadowJar.configure { | ||
relocate("com.google.protobuf", "org.projectnessie.cel.relocated.protobuf") | ||
relocate("com.fasterxml.jackson", "org.projectnessie.cel.relocated.jackson") | ||
relocate("org.agrona", "org.projectnessie.cel.relocated.agrona") | ||
manifest { | ||
attributes["Specification-Title"] = "Common-Expression-Language - dependency-free CEL" | ||
attributes["Specification-Version"] = libs.protobuf.java.get().version | ||
} | ||
configurations = listOf(project.configurations.getByName("compileClasspath")) | ||
dependencies { | ||
include(project(":cel-tools")) | ||
include(project(":cel-core")) | ||
include(project(":cel-jackson")) | ||
include(project(":cel-generated-pb")) | ||
include(project(":cel-generated-antlr")) | ||
|
||
include(dependency(libs.protobuf.java.get())) | ||
include(dependency("com.fasterxml.jackson.core:jackson-databind")) | ||
include(dependency("com.fasterxml.jackson.core:jackson-core")) | ||
include(dependency("com.fasterxml.jackson.core:jackson-annotations")) | ||
include(dependency("com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf")) | ||
include(dependency("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")) | ||
include(dependency(libs.agrona.get())) | ||
} | ||
} | ||
|
||
tasks.named("compileJava").configure { finalizedBy(shadowJar) } | ||
|
||
tasks.named("processResources").configure { finalizedBy(shadowJar) } | ||
|
||
tasks.named("jar").configure { dependsOn("processJandexIndex", "shadowJar") } | ||
|
||
shadowJar.configure { | ||
outputs.cacheIf { false } // do not cache uber/shaded jars | ||
archiveClassifier.set("") | ||
mergeServiceFiles() | ||
} | ||
|
||
tasks.named<Jar>("jar").configure { | ||
dependsOn(shadowJar) | ||
archiveClassifier.set("raw") | ||
} | ||
|
||
tasks.withType<ShadowJar>().configureEach { exclude("META-INF/jandex.idx") } |