diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index a219879..bdee5f8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -2,6 +2,10 @@ name: ci on: push: + branches: + - master + tags: + - '*' pull_request: branches: - master diff --git a/build.sc b/build.sc index 0dd50f0..78a5c1a 100644 --- a/build.sc +++ b/build.sc @@ -1,23 +1,23 @@ import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ -import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.1` +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.4` import de.tobiasroeser.mill.vcs.version.VcsVersion -import $ivy.`com.github.lolgab::mill-mima_mill0.9:0.0.4` +import $ivy.`com.github.lolgab::mill-mima::0.0.9` import com.github.lolgab.mill.mima._ val dottyVersions = sys.props.get("dottyVersion").toList -val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0" :: dottyVersions -val scala2Versions = scalaVersions.filter(_.startsWith("2.")) +val scala2VersionsAndDotty = "2.11.12" :: "2.12.13" :: "2.13.4" :: dottyVersions +val scala30 = "3.0.0" val scalaJSVersions = for { - scalaV <- scalaVersions + scalaV <- scala30 :: scala2VersionsAndDotty scalaJSV <- Seq("0.6.33", "1.5.1") if scalaV.startsWith("2.") || scalaJSV.startsWith("1.") } yield (scalaV, scalaJSV) val scalaNativeVersions = for { - scalaV <- scala2Versions - scalaNativeV <- Seq("0.4.0") + scalaV <- "3.1.0" :: scala2VersionsAndDotty + scalaNativeV <- Seq("0.4.3") } yield (scalaV, scalaNativeV) trait SourcecodeModule extends PublishModule with Mima { @@ -32,10 +32,7 @@ trait SourcecodeModule extends PublishModule with Mima { organization = "com.lihaoyi", url = "https://github.com/lihaoyi/sourcecode", licenses = Seq(License.MIT), - scm = SCM( - "git://github.com/lihaoyi/sourcecode.git", - "scm:git://github.com/lihaoyi/sourcecode.git" - ), + versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "sourcecode"), developers = Seq( Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") ) @@ -85,8 +82,7 @@ trait SourcecodeTestModule extends ScalaModule { } object sourcecode extends Module { - val dottyVersion = sys.props.get("dottyVersion") - object jvm extends Cross[JvmSourcecodeModule](scalaVersions: _*) + object jvm extends Cross[JvmSourcecodeModule](scala30 :: scala2VersionsAndDotty: _*) class JvmSourcecodeModule(val crossScalaVersion: String) extends SourcecodeMainModule with ScalaModule with SourcecodeModule { @@ -119,6 +115,15 @@ object sourcecode extends Module { def scalaNativeVersion = crossScalaNativeVersion + override def docJar = + if (crossScalaVersion.startsWith("2.")) super.docJar + else T { + val outDir = T.ctx().dest + val javadocDir = outDir / "javadoc" + os.makeDir.all(javadocDir) + mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir)) + } + object test extends SourcecodeTestModule with ScalaNativeModule{ def scalaVersion = crossScalaVersion def scalaNativeVersion = crossScalaNativeVersion diff --git a/mill b/mill index d3348a5..8edc814 100755 --- a/mill +++ b/mill @@ -3,14 +3,14 @@ # 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 -DEFAULT_MILL_VERSION=0.9.6-61-bd7927 +DEFAULT_MILL_VERSION=0.10.0 set -e if [ -z "$MILL_VERSION" ] ; then if [ -f ".mill-version" ] ; then MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)" - elif [ -f "mill" ] && [ "$BASH_SOURCE" != "mill" ] ; then + 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 @@ -28,13 +28,14 @@ version_remainder="$MILL_VERSION" MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}" MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}" -if [ ! -x "$MILL_EXEC_PATH" ] ; then - mkdir -p $MILL_DOWNLOAD_PATH +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_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION${ASSEMBLY}" + 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"