From 9f14742c28ddd00163c6b35d1a4cb7415671a40c Mon Sep 17 00:00:00 2001 From: Piotr Szul Date: Thu, 29 Jun 2023 11:37:14 +1000 Subject: [PATCH] Moved creation of shaded jar to `library-runtime` module as main its main artefact. Added relocation of `caffeine` in the uber jar. Simplified dependencies of `utilities` by removing unnecessary `curator-client`. --- lib/python/MANIFEST.in | 2 +- lib/python/pathling/etc.py | 2 +- lib/python/pom.xml | 4 +- lib/python/setup.py | 4 +- library-api/pom.xml | 29 ---- library-runtime/.gitignore | 1 + library-runtime/pom.xml | 137 ++++++++++++++++++ pom.xml | 10 +- utilities/pom.xml | 4 - .../pathling/utilities/ObjectHolder.java | 3 +- 10 files changed, 149 insertions(+), 47 deletions(-) create mode 100644 library-runtime/.gitignore create mode 100644 library-runtime/pom.xml diff --git a/lib/python/MANIFEST.in b/lib/python/MANIFEST.in index 3a39cad40e..feac191cd2 100644 --- a/lib/python/MANIFEST.in +++ b/lib/python/MANIFEST.in @@ -1,2 +1,2 @@ global-exclude *.py[cod] __pycache__ .DS_Store -recursive-include target/dependency *-all.jar +recursive-include target/dependency library-runtime-*.jar diff --git a/lib/python/pathling/etc.py b/lib/python/pathling/etc.py index 3f296b0817..44da4f0e5a 100644 --- a/lib/python/pathling/etc.py +++ b/lib/python/pathling/etc.py @@ -41,7 +41,7 @@ def find_jar(verbose: bool = False) -> str: ) verbose and print("Project dir is: %s" % project_dir) jars_dir = os.path.join(project_dir, "target", "dependency") - jar_file = glob.glob(os.path.join(jars_dir, "library-api-*-all.jar")) + jar_file = glob.glob(os.path.join(jars_dir, "library-runtime-*.jar")) verbose and print("Found jar file(s): %s" % jar_file) if not jar_file: raise RuntimeError("Pathling jar not present at: %s" % jars_dir) diff --git a/lib/python/pom.xml b/lib/python/pom.xml index cfe3db885a..0f0a624560 100644 --- a/lib/python/pom.xml +++ b/lib/python/pom.xml @@ -43,8 +43,7 @@ au.csiro.pathling - library-api - all + library-runtime @@ -90,7 +89,6 @@ copy-dependencies - all true diff --git a/lib/python/setup.py b/lib/python/setup.py index 74da65fdf6..3fe944b2c0 100644 --- a/lib/python/setup.py +++ b/lib/python/setup.py @@ -41,7 +41,7 @@ # Check for existence of uber-jar for packaging # JARS_DIR = os.path.join(HERE, "target", "dependency") -UBER_JAR_GLOB = os.path.join(JARS_DIR, "library-api-*-all.jar") +UBER_JAR_GLOB = os.path.join(JARS_DIR, "library-runtime-*.jar") jar_files = glob.glob(UBER_JAR_GLOB) if not jar_files: print( @@ -91,7 +91,7 @@ "pathling.jars": "target/dependency", }, package_data={ - "pathling.jars": ["*-all.jar"], + "pathling.jars": ["library-runtime-*.jar"], }, data_files=[ ("share/pathling/examples", glob.glob("examples/*.py")), diff --git a/library-api/pom.xml b/library-api/pom.xml index 82d196984d..3e2dfb7e3e 100644 --- a/library-api/pom.xml +++ b/library-api/pom.xml @@ -222,35 +222,6 @@ org.jacoco jacoco-maven-plugin - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - false - true - all - - - *:* - - META-INF/MANIFEST.MF - - - - - - - - diff --git a/library-runtime/.gitignore b/library-runtime/.gitignore new file mode 100644 index 0000000000..89540d8235 --- /dev/null +++ b/library-runtime/.gitignore @@ -0,0 +1 @@ +/dependency-reduced-pom.xml diff --git a/library-runtime/pom.xml b/library-runtime/pom.xml new file mode 100644 index 0000000000..3608e7fd8a --- /dev/null +++ b/library-runtime/pom.xml @@ -0,0 +1,137 @@ + + + + + + 4.0.0 + + + pathling + au.csiro.pathling + 6.2.2 + + library-runtime + jar + + Pathling Library Runtime + The uber-jar for Pathling Libray API. + + + au.csiro.pathling.shaded + + true + + + + + + au.csiro.pathling + library-api + compile + + + org.apache.spark + * + + + org.scala-lang + * + + + org.slf4j + * + + + log4j + * + + + + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + + ${project.basedir} + + dependency-reduced-pom.xml + + + + + + + + org.apache.maven.plugins + maven-source-plugin + + true + + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + + + true + false + true + + + *:* + + META-INF/MANIFEST.MF + + + + + + + + + com/ + ${shaded.dependency.prefix}.com. + + com/github/benmanes/caffeine/** + + + + + + + + diff --git a/pom.xml b/pom.xml index 1cdb50604d..c4e6f95464 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,7 @@ encoders library-api + library-runtime terminology fhirpath fhir-server @@ -193,9 +194,8 @@ au.csiro.pathling - library-api + library-runtime ${project.version} - all au.csiro.pathling @@ -581,7 +581,7 @@ logback-core ${pathling.logbackVersion} - + org.apache.commons @@ -595,14 +595,14 @@ snakeyaml 1.33 - + org.apache.ivy ivy 2.5.1 - + diff --git a/utilities/pom.xml b/utilities/pom.xml index 2d5023bf7b..16629b1895 100644 --- a/utilities/pom.xml +++ b/utilities/pom.xml @@ -58,10 +58,6 @@ org.slf4j slf4j-api - - org.apache.curator - curator-client - org.scala-lang scala-library diff --git a/utilities/src/main/java/au/csiro/pathling/utilities/ObjectHolder.java b/utilities/src/main/java/au/csiro/pathling/utilities/ObjectHolder.java index 2d9a419695..ff79b20842 100644 --- a/utilities/src/main/java/au/csiro/pathling/utilities/ObjectHolder.java +++ b/utilities/src/main/java/au/csiro/pathling/utilities/ObjectHolder.java @@ -26,7 +26,6 @@ import java.util.function.Function; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.curator.utils.CloseableUtils; import org.apache.hadoop.util.ShutdownHookManager; /** @@ -91,7 +90,7 @@ public synchronized V getOrCreate(@Nonnull final C config) { @Override public synchronized void reset() { if (instance instanceof Closeable) { - CloseableUtils.closeQuietly((Closeable) instance); + closeQuietly((Closeable) instance); instance = null; configuration = null; }