make nbr the owning module of runtime accesories

This commit is contained in:
Jonathan Shook 2021-08-10 14:34:53 -05:00
parent ef650c769f
commit bf26583b7f
83 changed files with 496 additions and 28 deletions

View File

@ -0,0 +1,34 @@
#!/bin/bash
set -e
set -x
NBJAR_VERSION=${NBJAR_VERSION:?NBJAR_VERSION must be specified}
echo "NBJAR_VERSION: ${NBJAR_VERSION}"
cd target
if [ -e "nb.jar" ]
then
echo "nb.jar link exists, skipping"
exit 0
fi
for qualifier in jar-with-dependencies
do
JARNAME="nb-${NBJAR_VERSION}-${qualifier}.jar"
if [ -e "$JARNAME" ]
then
echo "linking $JARNAME to nb.jar"
ln -s $JARNAME nb.jar
echo "linked $JARNAME to nb.jar, exiting"
exit 0
else
echo "$JARNAME does not exist, skipping"
fi
done
echo "Unable to find any jar to link to nb.jar name.."
exit 2

View File

@ -18,7 +18,7 @@ fi
if [ "$1" = "--java-version" ]
then
shift
java -version
$DIR/jre/bin/java -version
exit
fi

View File

@ -23,31 +23,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-rest</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-cli</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docs</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-extensions</artifactId>
<artifactId>nbr</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Name=nosqlbench
Exec=nbr %F
Icon=nbr
Type=Application
Categories=Development;Network;Utility;Science;
Comment=nosqlbench
MimeType=text/yaml;application/yaml;
Name[nbr]=nbr
Terminal=false
StartupNotify=true
NoDisplay=false

BIN
nbr/appimage/skel/nbr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

35
nbr/appimage/skel/usr/bin/nbr Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#set -x
DIR="$(dirname "$(readlink -f "$0")")"
if [ "$1" = "--wrapper-help" ]
then
echo "OPTIONS:"
echo " # run the bundled JRE with -version"
echo " --java-version"
echo " # run the app with JDWP debugging support, with suspend=n"
echo " --DN"
echo " # run the app with JDWP debugging support, with suspend=y"
echo " --DY"
echo " # set additional JRE options ..."
echo " JAVA_OPTS=... $0 ..."
exit 0
fi
if [ "$1" = "--java-version" ]
then
shift
$DIR/jre/bin/java -version
exit
fi
if [ "$1" = "-DN" ]
then
shift
exec $DIR/jre/bin/java -Dnashorn.args="--no-deprecation-warning" ${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar $DIR/nbr.jar "$@"
elif [ "$1" = "-DY" ]
then
shift
exec $DIR/jre/bin/java -Dnashorn.args="--no-deprecation-warning" ${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 -jar $DIR/nbr.jar "$@"
else
exec $DIR/jre/bin/java -Dnashorn.args="--no-deprecation-warning" ${JAVA_OPTS} -jar $DIR/nbr.jar "$@"
fi

26
nbr/assembly.xml Normal file
View File

@ -0,0 +1,26 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<containerDescriptorHandlers>
<containerDescriptorHandler>
<handlerName>metaInf-services</handlerName>
</containerDescriptorHandler>
</containerDescriptorHandlers>
</assembly>

167
nbr/build-bin-nbr.sh Executable file
View File

@ -0,0 +1,167 @@
#!/usr/bin/env bash
set -e
set -x
JAVA_VERSION="16"
APPDIR=target/NBR.AppDir
mkdir -p ${APPDIR}
BUILD_OPENJ9="false"
if [ "$1" = "--with-openj9" ]
then
BUILD_OPENJ9="true"
printf "using openj9 for build\n"
shift;
fi
if [ ! -f target/nbr.jar ]
then
printf "target/nbr.jar does not exist"
exit 2
fi
#if [ -x "target/nbr" ]
#then
# printf "Removing stale target/nbr...\n"
# rm target/nbr
#fi
rsync -av appimage/skel/ "${APPDIR}/"
cp target/nbr.jar "${APPDIR}/usr/bin/nbr.jar"
mkdir -p "${APPDIR}/usr/bin/jre"
if [ "$JAVA_VERSION" == "16" ]
then
if [ ! -d "cache/jre16" ] ; then
printf "getting jre once into cache/jre15\n";
mkdir -p cache
(cd cache && (
if [ "$BUILD_OPENJ9" = "true" ]
then
printf "BUILD_OPENJ9 is not supported in this version yet\n"
exit 2
else
wget -c 'https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1+9/OpenJDK16U-jre_x64_linux_hotspot_16.0.1_9.tar.gz'
tar xf OpenJDK16U-jre_x64_linux_hotspot_16.0.1_9.tar.gz
mv jdk-16.0.1+9-jre jre16
fi
))
fi
rsync -av cache/jre16/ "${APPDIR}/usr/bin/jre/"
elif [ "$JAVA_VERSION" == "15" ]
then
if [ ! -d "cache/jre15" ] ; then
printf "getting jre once into cache/jre15\n";
mkdir -p cache
(cd cache && (
if [ "$BUILD_OPENJ9" = "true" ]
then
wget -c https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk15u-2020-11-19-07-04/OpenJDK15U-jre_x64_linux_openj9_linuxXL_2020-11-19-07-04.tar.gz
tar -xf OpenJDK15U-jre_x64_linux_openj9_linuxXL_2020-11-19-07-04.tar.gz
mv jdk-15.0.1+9-jre jre15
rm OpenJDK15U-jre_x64_linux_openj9_linuxXL_2020-11-19-07-04.tar.gz
else
wget -c https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk15u-2020-11-19-07-04/OpenJDK15U-jre_x64_linux_hotspot_2020-11-19-07-04.tar.gz
tar xf OpenJDK15U-jre_x64_linux_hotspot_2020-11-19-07-04.tar.gz
mv jdk-15.0.1+9-jre jre15
fi
))
fi
rsync -av cache/jre15/ "${APPDIR}/usr/bin/jre/"
# Java 14 should run binaries targeted to Java 11 bytecode
elif [ "$JAVA_VERSION" == "14" ] ; then
if [ ! -d "cache/jre14" ] ; then
printf "getting jre once into cache/jre14\n";
mkdir -p cache
(cd cache && (
if [ "$BUILD_OPENJ9" = "true" ]
then
wget -c https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk14u-2020-04-27-07-27/OpenJDK14U-jre_x64_linux_openj9_linuxXL_2020-04-27-07-27.tar.gz
tar xf OpenJDK14U-jre_x64_linux_openj9_linuxXL_2020-04-27-07-27.tar.gz
mv jdk-14.0.1+7-jre jre14
rm OpenJDK14U-jre_x64_linux_openj9_linuxXL_2020-04-27-07-27.tar.gz
else
wget -c https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk14u-2020-04-27-07-27/OpenJDK14U-jre_x64_linux_hotspot_2020-04-27-07-27.tar.gz
tar xf OpenJDK14U-jre_x64_linux_hotspot_2020-04-27-07-27.tar.gz
mv jdk-14.0.1+7-jre jre14
fi
))
fi
rsync -av cache/jre14/ "${APPDIR}/usr/bin/jre/"
else
printf "Unknown java version indicated in $0"
exit 2
# wget -c https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
# tar xf OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
# mv jdk-12.0.2+10-jre jre
# rm OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
fi
if [ ! -f "${APPDIR}/AppRun" ]
then
( cd ${APPDIR} && (
printf "Linking AppRun...\n";
ln -s usr/bin/nbr AppRun
))
fi
#( cd ${APPDIR} && (
# rsync -av ..
# if [ ! -d "usr/bin/jre" ]
# then
# printf "getting jre...\n";
#
# # JRE 12
# wget -c https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
# tar xf OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
# mv jdk-12.0.2+10-jre usr/bin/jre
# rm OpenJDK12U-jre_x64_linux_hotspot_12.0.2_10.tar.gz
#
# # JRE 13
# # wget -c https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13%2B33/OpenJDK13U-jre_x64_linux_hotspot_13_33.tar.gz
# # tar xf OpenJDK13U-jre_x64_linux_hotspot_13_33.tar.gz
# #mv jdk-13+33-jre usr/bin/jre
# #rm OpenJDK13U-jre_x64_linux_hotspot_13_33.tar.gz
# else
# printf "jre directory present, skipping...\n";
# fi
#
# if [ -f "AppRun" ]
# then
# printf "Removing stale AppRun...\n";
# rm AppRun
# fi
#
# if [ ! -f "AppRun" ]
# then
# printf "Linking AppRun...\n";
# ln -s usr/bin/nbr AppRun
# fi
#
# )
#)
printf "getting appimage tool and building image...\n";
( cd target && (
if [ ! -x "appimagetool-x86_64.AppImage" ]
then
wget -c https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
fi
ARCH=x86_64 ./appimagetool-x86_64.AppImage NBR.AppDir nbr
# && chmod +x nbr
)
)
if [ -x "target/nbr" ]
then
printf "nosqlbench AppImage binary was built at target/nbr\n";
fi

View File

@ -0,0 +1,34 @@
#!/bin/bash
set -e
set -x
NBJAR_VERSION=${NBJAR_VERSION:?NBJAR_VERSION must be specified}
echo "NBJAR_VERSION: ${NBJAR_VERSION}"
cd target
if [ -e "nbr.jar" ]
then
echo "nbr.jar link exists, skipping"
exit 0
fi
for qualifier in jar-with-dependencies
do
JARNAME="nbr-${NBJAR_VERSION}-${qualifier}.jar"
if [ -e "$JARNAME" ]
then
echo "linking $JARNAME to nbr.jar"
ln -s $JARNAME nbr.jar
echo "linked $JARNAME to nbr.jar, exiting"
exit 0
else
echo "$JARNAME does not exist, skipping"
fi
done
echo "Unable to find any jar to link to nbr.jar name.."
exit 2

183
nbr/pom.xml Normal file
View File

@ -0,0 +1,183 @@
<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>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>4.15.52-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
<artifactId>nbr</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>Runbime-Only CLI for nosqlbench</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javadoc.name>nosqlbench Command Line</javadoc.name>
</properties>
<dependencies>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-rest</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-cli</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docs</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-extensions</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>driver-diag</artifactId>
<version>4.15.52-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>io.nosqlbench.engine.cli.NBCLI</mainClass>
</manifest>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>assemble-nb</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>link-nb-jar-name</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<environmentVariables>
<NBJAR_VERSION>${project.version}</NBJAR_VERSION>
</environmentVariables>
<basedir>${project.basedir}</basedir>
<executable>${project.basedir}/nbr-scripts/link-jar-name.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>build-nb-appimage</id>
<activation>
<os>
<family>unix</family>
<name>linux</name>
<arch>amd64</arch>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>build-nbr-appimage</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<basedir>${project.basedir}</basedir>
<executable>${project.basedir}/build-bin-nbr.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>enforce</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
<rules>
<dependencyConvergence />
</rules>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -29,7 +29,7 @@ public class ExitStatusIntegrationTests {
private final String java = Optional.ofNullable(System.getenv(
"JAVA_HOME")).map(v -> v+"/bin/java").orElse("java");
private final static String JARNAME = "target/nb.jar";
private final static String JARNAME = "target/nbr.jar";
@Test
public void testExitStatusOnBadParam() {
ProcessInvoker invoker = new ProcessInvoker();

View File

@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class NBCliIntegrationTests {
private final static String JARNAME = "target/nb.jar";
private final static String JARNAME = "target/nbr.jar";
private final Logger logger = LogManager.getLogger(NBCliIntegrationTests.class);
private final String java = Optional.ofNullable(System.getenv(
"JAVA_HOME")).map(v -> v+"/bin/java").orElse("java");

View File

@ -22,6 +22,7 @@
<!-- CORE MODULES -->
<module>mvn-defaults</module>
<module>nb</module>
<module>nbr</module>
<module>nb-api</module>
<module>nb-annotations</module>
<module>engine-api</module>