Skip to content
Open
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
50 changes: 50 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import mill._, scalalib._, publish._

trait MyModule extends PublishModule {
def publishVersion = "0.0.1"

def pomSettings = PomSettings(
description =
"DBUtils for Scala simplifies interacting with various components of Databricks, such " +
"as the Databricks File System (DBFS), Secret Scopes, Widgets, and other utilities.",
organization = "com.databricks",
url = "https://github.com/databricks/databricks-dbutils-scala",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("databricks", "databricks-dbutils-scala"),
developers = Seq(Developer("miles", "Miles Yucht", "https://github.com/mgyucht"))
)
}

trait MyScalaModule extends MyModule with CrossSbtModule {
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags:0.12.0")
object test extends SbtModuleTests {
def ivyDeps = Agg(
ivy"org.scalactic::scalactic:3.2.16",
ivy"org.scalatest::scalatest:3.2.16",
ivy"org.slf4j:slf4j-reload4j:2.0.7",
ivy"org.mockito:mockito-core:4.11.0",
)
def testFramework = "org.scalatest.tools.Framework"
}
}

val scalaVersions = Seq("2.13.8", "2.12.18")

object `databricks-dbutils-scala` extends Cross[DbutilsModule](scalaVersions)
trait DbutilsModule extends MyScalaModule {
def ivyDeps = Agg(
ivy"com.google.code.findbugs:jsr305:3.0.2",
ivy"com.databricks:databricks-sdk-java:0.7.0",
)
}

object examples extends Cross[ExampleModule](scalaVersions)
trait ExampleModule extends MyScalaModule {
def moduleDeps = Seq(`databricks-dbutils-scala`())
}

object release extends Cross[ReleaseModule](scalaVersions)
trait ReleaseModule extends MyScalaModule {
}


65 changes: 65 additions & 0 deletions mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env sh

# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION

set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.11.2
fi

if [ -z "$MILL_VERSION" ] ; then
if [ -f ".mill-version" ] ; then
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
elif [ -f ".config/mill-version" ] ; then
MILL_VERSION="$(head -n 1 .config/mill-version 2> /dev/null)"
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
else
MILL_VERSION=$DEFAULT_MILL_VERSION
fi
fi

if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
else
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
fi
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"

version_remainder="$MILL_VERSION"
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"

if [ ! -s "$MILL_EXEC_PATH" ] ; then
mkdir -p "$MILL_DOWNLOAD_PATH"
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
ASSEMBLY="-assembly"
fi
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION_TAG}/$MILL_VERSION${ASSEMBLY}"
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
unset DOWNLOAD_FILE
unset MILL_DOWNLOAD_URL
fi

if [ -z "$MILL_MAIN_CLI" ] ; then
MILL_MAIN_CLI="${0}"
fi

MILL_FIRST_ARG=""
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
# Need to preserve the first position of those listed options
MILL_FIRST_ARG=$1
shift
fi

unset MILL_DOWNLOAD_PATH
unset MILL_VERSION

exec $MILL_EXEC_PATH $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"