Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create library runtime jar #1510

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
global-exclude *.py[cod] __pycache__ .DS_Store
recursive-include target/dependency *-all.jar
recursive-include target/dependency library-runtime-*.jar
2 changes: 1 addition & 1 deletion lib/python/pathling/etc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions lib/python/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
<dependencies>
<dependency>
<groupId>au.csiro.pathling</groupId>
<artifactId>library-api</artifactId>
<classifier>all</classifier>
<artifactId>library-runtime</artifactId>
</dependency>
</dependencies>

Expand Down Expand Up @@ -90,7 +89,6 @@
<goal>copy-dependencies</goal>
</goals>
<configuration>
<classifier>all</classifier>
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions lib/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")),
Expand Down
29 changes: 0 additions & 29 deletions library-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,35 +222,6 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>all</shadedClassifierName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
1 change: 1 addition & 0 deletions library-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dependency-reduced-pom.xml
137 changes: 137 additions & 0 deletions library-runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright 2023 Commonwealth Scientific and Industrial Research
~ Organisation (CSIRO) ABN 41 687 119 230.
~
~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>pathling</artifactId>
<groupId>au.csiro.pathling</groupId>
<version>6.2.2</version>
</parent>
<artifactId>library-runtime</artifactId>
<packaging>jar</packaging>

<name>Pathling Library Runtime</name>
<description>The uber-jar for Pathling Libray API.</description>

<properties>
<shaded.dependency.prefix>au.csiro.pathling.shaded</shaded.dependency.prefix>
<!-- We contain no source -->
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>

<dependencies>

<dependency>
<groupId>au.csiro.pathling</groupId>
<artifactId>library-api</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.apache.spark</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}</directory>
<includes>
<include>dependency-reduced-pom.xml</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- We contain no source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<shadedArtifactAttached>false</shadedArtifactAttached>
<useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<relocations>
<relocation>
<pattern>com/</pattern>
<shadedPattern>${shaded.dependency.prefix}.com.</shadedPattern>
<includes>
<include>com/github/benmanes/caffeine/**</include>
</includes>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
</project>
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<modules>
<module>encoders</module>
<module>library-api</module>
<module>library-runtime</module>
<module>terminology</module>
<module>fhirpath</module>
<module>fhir-server</module>
Expand Down Expand Up @@ -193,9 +194,8 @@
</dependency>
<dependency>
<groupId>au.csiro.pathling</groupId>
<artifactId>library-api</artifactId>
<artifactId>library-runtime</artifactId>
<version>${project.version}</version>
<classifier>all</classifier>
</dependency>
<dependency>
<groupId>au.csiro.pathling</groupId>
Expand Down Expand Up @@ -581,7 +581,7 @@
<artifactId>logback-core</artifactId>
<version>${pathling.logbackVersion}</version>
</dependency>

<!-- CVE-2022-42889-->
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -595,14 +595,14 @@
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>

<!-- CVE-2022-37865 -->
<dependency>
<groupId>org.apache.ivy</groupId>
<artifactId>ivy</artifactId>
<version>2.5.1</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
4 changes: 0 additions & 4 deletions utilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}
Expand Down