This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix-queryserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ca4db8  PHOENIX-5869 Use symlinks to reduce size of phoenix 
queryserver assembly
1ca4db8 is described below

commit 1ca4db8adbc32d7747bfaaa99fc3842698c7bfdf
Author: Istvan Toth <[email protected]>
AuthorDate: Tue Sep 15 08:51:35 2020 +0200

    PHOENIX-5869 Use symlinks to reduce size of phoenix queryserver assembly
    
    also fix top directory name in assmebly
---
 phoenix-queryserver-assembly/pom.xml                    | 17 +++++++++++++++++
 phoenix-queryserver-assembly/src/assembly/cluster.xml   | 12 ++++++------
 .../src/scripts/replace_jars_with_symlinks.sh           | 12 ++++++++++++
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/phoenix-queryserver-assembly/pom.xml 
b/phoenix-queryserver-assembly/pom.xml
index 3989d14..25286de 100644
--- a/phoenix-queryserver-assembly/pom.xml
+++ b/phoenix-queryserver-assembly/pom.xml
@@ -90,6 +90,23 @@
                  </execution>
               </executions>
             </plugin>
+            <plugin>
+              <artifactId>exec-maven-plugin</artifactId>
+              <groupId>org.codehaus.mojo</groupId>
+              <executions>
+                <execution>
+                  <id>Replace maven repo JARS with symlinks</id>
+                  <phase>prepare-package</phase>
+                  <goals>
+                    <goal>exec</goal>
+                  </goals>
+                  <configuration>
+                    
<executable>${basedir}/src/scripts/replace_jars_with_symlinks.sh</executable>
+                    
<commandlineArgs>${project.build.directory}/maven-repo</commandlineArgs>
+                  </configuration>
+                </execution>
+              </executions>
+            </plugin>
         </plugins>
     </build>
     <profiles>
diff --git a/phoenix-queryserver-assembly/src/assembly/cluster.xml 
b/phoenix-queryserver-assembly/src/assembly/cluster.xml
index 58ce02f..356968b 100644
--- a/phoenix-queryserver-assembly/src/assembly/cluster.xml
+++ b/phoenix-queryserver-assembly/src/assembly/cluster.xml
@@ -27,7 +27,7 @@
     <fileSets>
         <fileSet>
             <directory>${project.basedir}/../bin</directory>
-            
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/bin</outputDirectory>
+            
<outputDirectory>phoenix-queryserver-${project.parent.version}/bin</outputDirectory>
             <excludes>
               <exclude>__pycache__</exclude>
               <exclude>__pycache__/*</exclude>
@@ -36,34 +36,34 @@
         </fileSet>
         <fileSet>
             
<directory>${project.basedir}/../phoenix-queryserver/target</directory>
-            
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/</outputDirectory>
+            
<outputDirectory>phoenix-queryserver-${project.parent.version}/</outputDirectory>
             <includes>
                 
<include>phoenix-queryserver-${project.parent.version}.jar</include>
             </includes>
         </fileSet>
         <fileSet>
             
<directory>${project.basedir}/../phoenix-queryserver-client/target</directory>
-            
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/</outputDirectory>
+            
<outputDirectory>phoenix-queryserver-${project.parent.version}/</outputDirectory>
             <includes>
                 
<include>phoenix-queryserver-client-${project.parent.version}.jar</include>
             </includes>
         </fileSet>
         <fileSet>
           <directory>${project.build.directory}/maven-repo</directory>
-          
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/maven</outputDirectory>
+          
<outputDirectory>phoenix-queryserver-${project.parent.version}/maven</outputDirectory>
         </fileSet>
     </fileSets>
     <dependencySets>
       <dependencySet>
         <unpack>false</unpack>
-        
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/lib</outputDirectory>
+        
<outputDirectory>phoenix-queryserver-${project.parent.version}/lib</outputDirectory>
         <includes>
           <include>sqlline:sqlline:jar:jar-with-dependencies</include>
         </includes>
       </dependencySet>
       <dependencySet>
         <unpack>false</unpack>
-        
<outputDirectory>${project.parent.artifactId}-${project.parent.version}/</outputDirectory>
+        
<outputDirectory>phoenix-queryserver-${project.parent.version}/</outputDirectory>
         <includes>
           <include>org.apache.phoenix:phoenix-client:jar</include>
         </includes>
diff --git 
a/phoenix-queryserver-assembly/src/scripts/replace_jars_with_symlinks.sh 
b/phoenix-queryserver-assembly/src/scripts/replace_jars_with_symlinks.sh
new file mode 100755
index 0000000..2eb9b9f
--- /dev/null
+++ b/phoenix-queryserver-assembly/src/scripts/replace_jars_with_symlinks.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+REPO_ROOT=$1
+for linksource in $(find $REPO_ROOT -name \*.jar); do
+    linkfile=$(basename $linksource)
+    linkdir=$(dirname $linksource)
+    targetdir=$(realpath $REPO_ROOT/.. --relative-to=$linkdir)
+    target="$targetdir/$linkfile"
+    cd $linkdir
+    #The copy is necessary, as maven won't add dangling symlinks to the 
assmebly
+    cp $linkfile $target
+    ln -sf $target $linkfile
+done
\ No newline at end of file

Reply via email to