This is an automated email from the ASF dual-hosted git repository.
fchen pushed a commit to branch branch-0.4
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git
The following commit(s) were added to refs/heads/branch-0.4 by this push:
new 75fea12be [CELEBORN-1203] Add `LicenseAndNoticeMergeStrategy` to
resolve inner project LICENSE/NOTICE conflict for shaded client packaging
75fea12be is described below
commit 75fea12be33eabc9846ece1bce8e72e7655f9edd
Author: Fu Chen <[email protected]>
AuthorDate: Mon Jan 1 00:48:34 2024 +0800
[CELEBORN-1203] Add `LicenseAndNoticeMergeStrategy` to resolve inner
project LICENSE/NOTICE conflict for shaded client packaging
### What changes were proposed in this pull request?
### Why are the changes needed?
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
Closes #2197 from cfmcgrady/license.
Authored-by: Fu Chen <[email protected]>
Signed-off-by: Fu Chen <[email protected]>
(cherry picked from commit 9619958cb1879375e9ecfb3c277de409a739d084)
Signed-off-by: Fu Chen <[email protected]>
---
project/CelebornBuild.scala | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/project/CelebornBuild.scala b/project/CelebornBuild.scala
index e329e7a9a..15b9f5945 100644
--- a/project/CelebornBuild.scala
+++ b/project/CelebornBuild.scala
@@ -753,7 +753,13 @@ trait SparkClientProjects {
(assembly / assemblyMergeStrategy) := {
case m if m.toLowerCase(Locale.ROOT).endsWith("manifest.mf") =>
MergeStrategy.discard
- case "META-INF/LICENSE" | "META-INF/NOTICE" =>
MergeStrategy.preferProject
+ // the LicenseAndNoticeMergeStrategy always picks the license/notice
file from the current project
+ case m @ ("META-INF/LICENSE" | "META-INF/NOTICE") =>
CustomMergeStrategy("LicenseAndNoticeMergeStrategy") { conflicts =>
+ val entry = conflicts.head
+ val projectLicenseFile = (Compile / resourceDirectory).value /
entry.target
+ val stream = () => new java.io.BufferedInputStream(new
java.io.FileInputStream(projectLicenseFile))
+ Right(Vector(JarEntry(entry.target, stream)))
+ }
case PathList(ps@_*) if Assembly.isLicenseFile(ps.last) =>
MergeStrategy.discard
// Drop all proto files that are not needed as artifacts of the
build.
case m if m.toLowerCase(Locale.ROOT).endsWith(".proto") =>
MergeStrategy.discard
@@ -951,7 +957,13 @@ trait FlinkClientProjects {
(assembly / assemblyMergeStrategy) := {
case m if m.toLowerCase(Locale.ROOT).endsWith("manifest.mf") =>
MergeStrategy.discard
- case "META-INF/LICENSE" | "META-INF/NOTICE" =>
MergeStrategy.preferProject
+ // the LicenseAndNoticeMergeStrategy always picks the license/notice
file from the current project
+ case m @ ("META-INF/LICENSE" | "META-INF/NOTICE") =>
CustomMergeStrategy("LicenseAndNoticeMergeStrategy") { conflicts =>
+ val entry = conflicts.head
+ val projectLicenseFile = (Compile / resourceDirectory).value /
entry.target
+ val stream = () => new java.io.BufferedInputStream(new
java.io.FileInputStream(projectLicenseFile))
+ Right(Vector(JarEntry(entry.target, stream)))
+ }
case PathList(ps@_*) if Assembly.isLicenseFile(ps.last) =>
MergeStrategy.discard
// Drop all proto files that are not needed as artifacts of the
build.
case m if m.toLowerCase(Locale.ROOT).endsWith(".proto") =>
MergeStrategy.discard
@@ -1056,7 +1068,13 @@ object MRClientProjects {
case m if m.toLowerCase(Locale.ROOT).endsWith("manifest.mf") =>
MergeStrategy.discard
// For netty-3.x.y.Final.jar
case m if m.startsWith("META-INF/license/") => MergeStrategy.discard
- case "META-INF/LICENSE" | "META-INF/NOTICE" =>
MergeStrategy.preferProject
+ // the LicenseAndNoticeMergeStrategy always picks the license/notice
file from the current project
+ case m @ ("META-INF/LICENSE" | "META-INF/NOTICE") =>
CustomMergeStrategy("LicenseAndNoticeMergeStrategy") { conflicts =>
+ val entry = conflicts.head
+ val projectLicenseFile = (Compile / resourceDirectory).value /
entry.target
+ val stream = () => new java.io.BufferedInputStream(new
java.io.FileInputStream(projectLicenseFile))
+ Right(Vector(JarEntry(entry.target, stream)))
+ }
case PathList(ps@_*) if Assembly.isLicenseFile(ps.last) =>
MergeStrategy.discard
// Drop all proto files that are not needed as artifacts of the
build.
case m if m.toLowerCase(Locale.ROOT).endsWith(".proto") =>
MergeStrategy.discard