From 5996632c1e8af39275896485be3d2b93442a93f9 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 11 Jun 2019 23:36:08 +0100 Subject: [PATCH] Enable running outside of sbt (#55) Enable running outside of sbt --- README.org | 11 +++++++++++ bin/s3thorp | 4 ++++ build.sbt | 19 +++++++++++++++++-- project/assembly.sbt | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 bin/s3thorp create mode 100644 project/assembly.sbt diff --git a/README.org b/README.org index cdce2eb..fa3cb63 100644 --- a/README.org +++ b/README.org @@ -40,3 +40,14 @@ When considering a local file, the following table governs what should happen: | 5 | exists | exists | no match | no matches | upload | | 6 | is missing | exists | - | - | delete | |---+------------+------------+------------------+--------------------+---------------------| + +* Executable JAR + +To build as an executable jar, perform `sbt assembly` + +This will create the file +`cli/target/scala-2.12/s3thorp-assembly-$VERSION.jar` (where $VERSION +is substituted) + +Copy and rename this file as `s3thorp.jar` into the same directory as +the `bin/s3throp` shell script. diff --git a/bin/s3thorp b/bin/s3thorp new file mode 100755 index 0000000..e4a3931 --- /dev/null +++ b/bin/s3thorp @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +THORP_HOME=`dirname $0` +eval `resize` +java -jar $THORP_HOME/s3thorp.jar $* diff --git a/build.sbt b/build.sbt index 435d5dd..6b918b4 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,12 @@ +val commonSettings = Seq( + version := "DEV-SNAPSHOT", + organization := "net.kemitix", + scalaVersion := "2.12.8", + test in assembly := {} +) + val applicationSettings = Seq( name := "s3thorp", - version := "0.1", - scalaVersion := "2.12.8" ) val testDependencies = Seq( libraryDependencies ++= Seq( @@ -39,23 +44,33 @@ val catsEffectsSettings = Seq( // cli -> aws-lib -> core -> aws-api -> domain lazy val cli = (project in file("cli")) + .settings(commonSettings) + .settings(mainClass in assembly := Some("net.kemitix.s3thorp.cli.Main")) .settings(applicationSettings) .aggregate(`aws-lib`, core, `aws-api`, domain) .settings(commandLineParsing) .dependsOn(`aws-lib`) lazy val `aws-lib` = (project in file("aws-lib")) + .settings(commonSettings) + .settings(assemblyJarName in assembly := "aws-lib.jar") .settings(awsSdkDependencies) .settings(testDependencies) .dependsOn(core) lazy val core = (project in file("core")) + .settings(commonSettings) + .settings(assemblyJarName in assembly := "core.jar") .settings(testDependencies) .dependsOn(`aws-api`) lazy val `aws-api` = (project in file("aws-api")) + .settings(commonSettings) + .settings(assemblyJarName in assembly := "aws-api.jar") .settings(catsEffectsSettings) .dependsOn(domain) lazy val domain = (project in file("domain")) + .settings(commonSettings) + .settings(assemblyJarName in assembly := "domain.jar") .settings(testDependencies) diff --git a/project/assembly.sbt b/project/assembly.sbt new file mode 100644 index 0000000..9c01471 --- /dev/null +++ b/project/assembly.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")