Skip to content

Commit

Permalink
Merge pull request #24 from izeigerman/build-dist
Browse files Browse the repository at this point in the history
Introduce the akkeeper-submit script. Enable the SBT native packager …
  • Loading branch information
izeigerman committed Aug 7, 2018
2 parents 0414cfb + c762c84 commit d32657b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
38 changes: 38 additions & 0 deletions bin/akkeeper-submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

#
# Copyright 2017-2018 Iaroslav Zeigerman
#
# 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.
#

JAVA_BIN="java"
if [[ "$JAVA_HOME" != "" ]]; then
JAVA_BIN="$JAVA_HOME/bin/java"
fi

export HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_HOME/etc/hadoop}"
export YARN_CONF_DIR="${YARN_CONF_DIR:-$HADOOP_HOME/etc/hadoop}"

YARN_BIN="yarn"
if [[ "$HADOOP_HOME" != "" ]]; then
YARN_BIN="$HADOOP_HOME/bin/yarn"
fi

AKKEEPER_HOME="${AKKEEPER_HOME:-$(dirname $(dirname $(realpath $0)))}"
AKKEEPER_JARS="$AKKEEPER_HOME/lib"
AKEEEPER_FAT_JAR="$AKKEEPER_JARS/$(ls $AKKEEPER_JARS | grep --color=never akkeeper-assembly)"
AKKEEPER_CLASSPATH="$AKKEEPER_JARS/*:`$YARN_BIN classpath`"
AKKEEPER_MAIN="akkeeper.launcher.LauncherMain"

exec $JAVA_BIN -cp $AKKEEPER_CLASSPATH $AKKEEPER_MAIN --akkeeperJar $AKEEEPER_FAT_JAR "$@"
15 changes: 13 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ val AkkeeperSettings = CommonSettings ++ Seq(
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},

mappings in Universal := {
val fatJar = (assembly in Compile).value
Seq(
new File(baseDirectory.value.getAbsolutePath, "../README.md") -> "README.md",
new File(baseDirectory.value.getAbsolutePath, "../LICENSE") -> "LICENSE",
new File(baseDirectory.value.getAbsolutePath, "../bin/akkeeper-submit") -> "bin/akkeeper-submit",
fatJar -> ("lib/" + fatJar.getName)
)
}
)

Expand All @@ -101,12 +111,13 @@ val NoPublishSettings = CommonSettings ++ Seq(
lazy val root = Project(id = "root", base = file("."))
.settings(NoPublishSettings: _*)
.aggregate(akkeeper, akkeeperExamples)
.disablePlugins(sbtassembly.AssemblyPlugin)
.disablePlugins(sbtassembly.AssemblyPlugin, JavaAppPackaging)

lazy val akkeeper = Project(id = "akkeeper", base = file("akkeeper"))
.settings(AkkeeperSettings: _*)
.enablePlugins(JavaAppPackaging)

lazy val akkeeperExamples = Project(id = "akkeeper-examples", base = file("akkeeper-examples"))
.settings(NoPublishSettings: _*)
.dependsOn(akkeeper)
.disablePlugins(sbtassembly.AssemblyPlugin)
.disablePlugins(sbtassembly.AssemblyPlugin, JavaAppPackaging)
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.5")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.6")

0 comments on commit d32657b

Please sign in to comment.