Skip to content

Commit b1668d2

Browse files
wip
1 parent 1cace31 commit b1668d2

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

build.sc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import mill._, scalalib._, publish._
2+
3+
trait MyModule extends PublishModule {
4+
def publishVersion = "0.0.1"
5+
6+
def pomSettings = PomSettings(
7+
description =
8+
"DBUtils for Scala simplifies interacting with various components of Databricks, such " +
9+
"as the Databricks File System (DBFS), Secret Scopes, Widgets, and other utilities.",
10+
organization = "com.databricks",
11+
url = "https://github.com/databricks/databricks-dbutils-scala",
12+
licenses = Seq(License.MIT),
13+
versionControl = VersionControl.github("databricks", "databricks-dbutils-scala"),
14+
developers = Seq(Developer("miles", "Miles Yucht", "https://github.com/mgyucht"))
15+
)
16+
}
17+
18+
trait MyScalaModule extends MyModule with CrossSbtModule {
19+
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags:0.12.0")
20+
object test extends SbtModuleTests {
21+
def ivyDeps = Agg(
22+
ivy"org.scalactic::scalactic:3.2.16",
23+
ivy"org.scalatest::scalatest:3.2.16",
24+
ivy"org.slf4j:slf4j-reload4j:2.0.7",
25+
ivy"org.mockito:mockito-core:4.11.0",
26+
)
27+
def testFramework = "org.scalatest.tools.Framework"
28+
}
29+
}
30+
31+
val scalaVersions = Seq("2.13.8", "2.12.18")
32+
33+
object `databricks-dbutils-scala` extends Cross[DbutilsModule](scalaVersions)
34+
trait DbutilsModule extends MyScalaModule {
35+
def ivyDeps = Agg(
36+
ivy"com.google.code.findbugs:jsr305:3.0.2",
37+
ivy"com.databricks:databricks-sdk-java:0.7.0",
38+
)
39+
}
40+
41+
object examples extends Cross[ExampleModule](scalaVersions)
42+
trait ExampleModule extends MyScalaModule {
43+
def moduleDeps = Seq(`databricks-dbutils-scala`())
44+
}
45+
46+
object release extends Cross[ReleaseModule](scalaVersions)
47+
trait ReleaseModule extends MyScalaModule {
48+
}
49+
50+

mill

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env sh
2+
3+
# This is a wrapper script, that automatically download mill from GitHub release pages
4+
# You can give the required mill version with MILL_VERSION env variable
5+
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
6+
7+
set -e
8+
9+
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
10+
DEFAULT_MILL_VERSION=0.11.2
11+
fi
12+
13+
if [ -z "$MILL_VERSION" ] ; then
14+
if [ -f ".mill-version" ] ; then
15+
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
16+
elif [ -f ".config/mill-version" ] ; then
17+
MILL_VERSION="$(head -n 1 .config/mill-version 2> /dev/null)"
18+
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then
19+
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
20+
else
21+
MILL_VERSION=$DEFAULT_MILL_VERSION
22+
fi
23+
fi
24+
25+
if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
26+
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
27+
else
28+
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
29+
fi
30+
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
31+
32+
version_remainder="$MILL_VERSION"
33+
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
34+
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
35+
36+
if [ ! -s "$MILL_EXEC_PATH" ] ; then
37+
mkdir -p "$MILL_DOWNLOAD_PATH"
38+
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
39+
ASSEMBLY="-assembly"
40+
fi
41+
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
42+
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
43+
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION_TAG}/$MILL_VERSION${ASSEMBLY}"
44+
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
45+
chmod +x "$DOWNLOAD_FILE"
46+
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
47+
unset DOWNLOAD_FILE
48+
unset MILL_DOWNLOAD_URL
49+
fi
50+
51+
if [ -z "$MILL_MAIN_CLI" ] ; then
52+
MILL_MAIN_CLI="${0}"
53+
fi
54+
55+
MILL_FIRST_ARG=""
56+
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
57+
# Need to preserve the first position of those listed options
58+
MILL_FIRST_ARG=$1
59+
shift
60+
fi
61+
62+
unset MILL_DOWNLOAD_PATH
63+
unset MILL_VERSION
64+
65+
exec $MILL_EXEC_PATH $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"

0 commit comments

Comments
 (0)