From 07290f6c8651d01e28d53bfb4c5d82c4dc0e22f3 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:25:14 +0200 Subject: [PATCH 01/14] Update versions --- .github/workflows/ci.yml | 58 ++++++++++++++++++++-------------------- build.sbt | 8 +++--- project/build.properties | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1b59c62f..4b28a457e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,18 +28,18 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.17, 2.13.10, 3.2.1] - java: [temurin@11] + scala: [2.12.17, 2.13.10, 3.3.3] + java: [temurin@8] project: [rootJS, rootJVM, rootNative] include: - - scala: 3.2.1 - java: temurin@11 + - scala: 3.3.3 + java: temurin@8 project: rootNative os: macos-latest exclude: - - scala: 3.2.1 + - scala: 3.3.3 project: rootJVM - - scala: 3.2.1 + - scala: 3.3.3 project: rootNative os: ubuntu-latest runs-on: ${{ matrix.os }} @@ -49,21 +49,21 @@ jobs: with: fetch-depth: 0 - - name: Download Java (temurin@11) - id: download-java-temurin-11 - if: matrix.java == 'temurin@11' + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' uses: typelevel/download-java@v1 with: distribution: temurin - java-version: 11 + java-version: 8 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: jdkfile - java-version: 11 - jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }} + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 @@ -81,7 +81,7 @@ jobs: run: sbt githubWorkflowCheck - name: Check formatting - if: matrix.java == 'temurin@11' + if: matrix.java == 'temurin@8' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - name: scalaJSLink @@ -96,11 +96,11 @@ jobs: run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'temurin@11' + if: matrix.java == 'temurin@8' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'temurin@11' + if: matrix.java == 'temurin@8' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories @@ -126,7 +126,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.13.10] - java: [temurin@11] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -134,21 +134,21 @@ jobs: with: fetch-depth: 0 - - name: Download Java (temurin@11) - id: download-java-temurin-11 - if: matrix.java == 'temurin@11' + - name: Download Java (temurin@8) + id: download-java-temurin-8 + if: matrix.java == 'temurin@8' uses: typelevel/download-java@v1 with: distribution: temurin - java-version: 11 + java-version: 8 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' uses: actions/setup-java@v2 with: distribution: jdkfile - java-version: 11 - jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }} + java-version: 8 + jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 @@ -222,12 +222,12 @@ jobs: tar xf targets.tar rm targets.tar - - name: Download target directories (3.2.1, rootJS) + - name: Download target directories (3.3.3, rootJS) uses: actions/download-artifact@v2 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.3-rootJS - - name: Inflate target directories (3.2.1, rootJS) + - name: Inflate target directories (3.3.3, rootJS) run: | tar xf targets.tar rm targets.tar diff --git a/build.sbt b/build.sbt index 74fe2a9b7..afea6fa2d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,12 +1,12 @@ val scala213 = "2.13.10" -val scala3 = "3.2.1" +val scala3 = "3.3.3" ThisBuild / scalaVersion := scala213 ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3) ThisBuild / tlBaseVersion := "2.5" -val temurin11 = JavaSpec.temurin("11") -ThisBuild / githubWorkflowJavaVersions := Seq(temurin11) +val temurin = JavaSpec.temurin("8") +ThisBuild / githubWorkflowJavaVersions := Seq(temurin) ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( MatrixExclude(Map("scala" -> scala3, "project" -> "rootJVM")), // TODO @@ -16,7 +16,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( ) ThisBuild / githubWorkflowBuildMatrixInclusions += - MatrixInclude(Map("scala" -> scala3, "java" -> temurin11.render, "project" -> "rootNative"), + MatrixInclude(Map("scala" -> scala3, "java" -> temurin.render, "project" -> "rootNative"), Map("os" -> "macos-latest") ) diff --git a/project/build.properties b/project/build.properties index 8b9a0b0ab..081fdbbc7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.0 +sbt.version=1.10.0 From 999bdea38a90457332db55d0a4e8e04a1ed4ced0 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:29:27 +0200 Subject: [PATCH 02/14] sbt --- .github/workflows/ci.yml | 16 +- build.sbt | 2 + sbt | 664 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 674 insertions(+), 8 deletions(-) create mode 100755 sbt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b28a457e..4cd49543f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,30 +78,30 @@ jobs: key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - name: Check that workflows are up to date - run: sbt githubWorkflowCheck + run: ./sbt githubWorkflowCheck - name: Check formatting if: matrix.java == 'temurin@8' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - name: scalaJSLink if: matrix.project == 'rootJS' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult - name: nativeLink if: matrix.project == 'rootNative' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink - name: Test - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility if: matrix.java == 'temurin@8' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation if: matrix.java == 'temurin@8' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') @@ -244,4 +244,4 @@ jobs: (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - name: Publish - run: sbt '++ ${{ matrix.scala }}' tlRelease + run: ./sbt '++ ${{ matrix.scala }}' tlRelease diff --git a/build.sbt b/build.sbt index afea6fa2d..345817538 100644 --- a/build.sbt +++ b/build.sbt @@ -8,6 +8,8 @@ ThisBuild / tlBaseVersion := "2.5" val temurin = JavaSpec.temurin("8") ThisBuild / githubWorkflowJavaVersions := Seq(temurin) +ThisBuild / githubWorkflowSbtCommand := "./sbt" + ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( MatrixExclude(Map("scala" -> scala3, "project" -> "rootJVM")), // TODO MatrixExclude( diff --git a/sbt b/sbt new file mode 100755 index 000000000..43a52e83d --- /dev/null +++ b/sbt @@ -0,0 +1,664 @@ +#!/usr/bin/env bash +# +# A more capable sbt runner, coincidentally also called sbt. +# Author: Paul Phillips +# https://github.com/paulp/sbt-extras +# +# Generated from http://www.opensource.org/licenses/bsd-license.php +# Copyright (c) 2011, Paul Phillips. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the author nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -o pipefail + +declare -r sbt_release_version="1.10.0" +declare -r sbt_unreleased_version="1.10.0" + +declare -r latest_213="2.13.14" +declare -r latest_212="2.12.19" +declare -r latest_211="2.11.12" +declare -r latest_210="2.10.7" +declare -r latest_29="2.9.3" +declare -r latest_28="2.8.2" + +declare -r buildProps="project/build.properties" + +declare -r sbt_launch_ivy_release_repo="https://repo.typesafe.com/typesafe/ivy-releases" +declare -r sbt_launch_ivy_snapshot_repo="https://repo.scala-sbt.org/scalasbt/ivy-snapshots" +declare -r sbt_launch_mvn_release_repo="https://repo1.maven.org/maven2" +declare -r sbt_launch_mvn_snapshot_repo="https://repo.scala-sbt.org/scalasbt/maven-snapshots" + +declare -r default_jvm_opts_common="-Xms512m -Xss2m -XX:MaxInlineLevel=18" +declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy -Dsbt.coursier.home=project/.coursier" + +declare sbt_jar sbt_dir sbt_create sbt_version sbt_script sbt_new +declare sbt_explicit_version +declare verbose noshare batch trace_level + +declare java_cmd="java" +declare sbt_launch_dir="$HOME/.sbt/launchers" +declare sbt_launch_repo + +# pull -J and -D options to give to java. +declare -a java_args scalac_args sbt_commands residual_args + +# args to jvm/sbt via files or environment variables +declare -a extra_jvm_opts extra_sbt_opts + +echoerr() { echo >&2 "$@"; } +vlog() { [[ -n "$verbose" ]] && echoerr "$@"; } +die() { + echo "Aborting: $*" + exit 1 +} + +setTrapExit() { + # save stty and trap exit, to ensure echo is re-enabled if we are interrupted. + SBT_STTY="$(stty -g 2>/dev/null)" + export SBT_STTY + + # restore stty settings (echo in particular) + onSbtRunnerExit() { + [ -t 0 ] || return + vlog "" + vlog "restoring stty: $SBT_STTY" + stty "$SBT_STTY" + } + + vlog "saving stty: $SBT_STTY" + trap onSbtRunnerExit EXIT +} + +# this seems to cover the bases on OSX, and someone will +# have to tell me about the others. +get_script_path() { + local path="$1" + [[ -L "$path" ]] || { + echo "$path" + return + } + + local -r target="$(readlink "$path")" + if [[ "${target:0:1}" == "/" ]]; then + echo "$target" + else + echo "${path%/*}/$target" + fi +} + +script_path="$(get_script_path "${BASH_SOURCE[0]}")" +declare -r script_path +script_name="${script_path##*/}" +declare -r script_name + +init_default_option_file() { + local overriding_var="${!1}" + local default_file="$2" + if [[ ! -r "$default_file" && "$overriding_var" =~ ^@(.*)$ ]]; then + local envvar_file="${BASH_REMATCH[1]}" + if [[ -r "$envvar_file" ]]; then + default_file="$envvar_file" + fi + fi + echo "$default_file" +} + +sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)" +sbtx_opts_file="$(init_default_option_file SBTX_OPTS .sbtxopts)" +jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)" + +build_props_sbt() { + [[ -r "$buildProps" ]] && + grep '^sbt\.version' "$buildProps" | tr '=\r' ' ' | awk '{ print $2; }' +} + +set_sbt_version() { + sbt_version="${sbt_explicit_version:-$(build_props_sbt)}" + [[ -n "$sbt_version" ]] || sbt_version=$sbt_release_version + export sbt_version +} + +url_base() { + local version="$1" + + case "$version" in + 0.7.*) echo "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/simple-build-tool" ;; + 0.10.*) echo "$sbt_launch_ivy_release_repo" ;; + 0.11.[12]) echo "$sbt_launch_ivy_release_repo" ;; + 0.*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]) # ie "*-yyyymmdd-hhMMss" + echo "$sbt_launch_ivy_snapshot_repo" ;; + 0.*) echo "$sbt_launch_ivy_release_repo" ;; + *-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]T[0-9][0-9][0-9][0-9][0-9][0-9]) # ie "*-yyyymmddThhMMss" + echo "$sbt_launch_mvn_snapshot_repo" ;; + *) echo "$sbt_launch_mvn_release_repo" ;; + esac +} + +make_url() { + local version="$1" + + local base="${sbt_launch_repo:-$(url_base "$version")}" + + case "$version" in + 0.7.*) echo "$base/sbt-launch-0.7.7.jar" ;; + 0.10.*) echo "$base/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;; + 0.11.[12]) echo "$base/org.scala-tools.sbt/sbt-launch/$version/sbt-launch.jar" ;; + 0.*) echo "$base/org.scala-sbt/sbt-launch/$version/sbt-launch.jar" ;; + *) echo "$base/org/scala-sbt/sbt-launch/$version/sbt-launch-${version}.jar" ;; + esac +} + +addJava() { + vlog "[addJava] arg = '$1'" + java_args+=("$1") +} +addSbt() { + vlog "[addSbt] arg = '$1'" + sbt_commands+=("$1") +} +addScalac() { + vlog "[addScalac] arg = '$1'" + scalac_args+=("$1") +} +addResidual() { + vlog "[residual] arg = '$1'" + residual_args+=("$1") +} + +addResolver() { addSbt "set resolvers += $1"; } + +addDebugger() { addJava "-Xdebug" && addJava "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"; } + +setThisBuild() { + vlog "[addBuild] args = '$*'" + local key="$1" && shift + addSbt "set $key in ThisBuild := $*" +} +setScalaVersion() { + [[ "$1" == *"-SNAPSHOT" ]] && addResolver 'Resolver.sonatypeRepo("snapshots")' + addSbt "++ $1" +} +setJavaHome() { + java_cmd="$1/bin/java" + setThisBuild javaHome "_root_.scala.Some(file(\"$1\"))" + export JAVA_HOME="$1" + export JDK_HOME="$1" + export PATH="$JAVA_HOME/bin:$PATH" +} + +getJavaVersion() { + local -r str=$("$1" -version 2>&1 | grep -E -e '(java|openjdk) version' | awk '{ print $3 }' | tr -d '"') + + # java -version on java8 says 1.8.x + # but on 9 and 10 it's 9.x.y and 10.x.y. + if [[ "$str" =~ ^1\.([0-9]+)(\..*)?$ ]]; then + echo "${BASH_REMATCH[1]}" + # Fixes https://github.com/dwijnand/sbt-extras/issues/326 + elif [[ "$str" =~ ^([0-9]+)(\..*)?(-ea)?$ ]]; then + echo "${BASH_REMATCH[1]}" + elif [[ -n "$str" ]]; then + echoerr "Can't parse java version from: $str" + fi +} + +checkJava() { + # Warn if there is a Java version mismatch between PATH and JAVA_HOME/JDK_HOME + + [[ -n "$JAVA_HOME" && -e "$JAVA_HOME/bin/java" ]] && java="$JAVA_HOME/bin/java" + [[ -n "$JDK_HOME" && -e "$JDK_HOME/lib/tools.jar" ]] && java="$JDK_HOME/bin/java" + + if [[ -n "$java" ]]; then + pathJavaVersion=$(getJavaVersion java) + homeJavaVersion=$(getJavaVersion "$java") + if [[ "$pathJavaVersion" != "$homeJavaVersion" ]]; then + echoerr "Warning: Java version mismatch between PATH and JAVA_HOME/JDK_HOME, sbt will use the one in PATH" + echoerr " Either: fix your PATH, remove JAVA_HOME/JDK_HOME or use -java-home" + echoerr " java version from PATH: $pathJavaVersion" + echoerr " java version from JAVA_HOME/JDK_HOME: $homeJavaVersion" + fi + fi +} + +java_version() { + local -r version=$(getJavaVersion "$java_cmd") + vlog "Detected Java version: $version" + echo "$version" +} + +is_apple_silicon() { [[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]]; } + +# MaxPermSize critical on pre-8 JVMs but incurs noisy warning on 8+ +default_jvm_opts() { + local -r v="$(java_version)" + if [[ $v -ge 17 ]]; then + echo "$default_jvm_opts_common" + elif [[ $v -ge 10 ]]; then + if is_apple_silicon; then + # As of Dec 2020, JVM for Apple Silicon (M1) doesn't support JVMCI + echo "$default_jvm_opts_common" + else + echo "$default_jvm_opts_common -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler" + fi + elif [[ $v -ge 8 ]]; then + echo "$default_jvm_opts_common" + else + echo "-XX:MaxPermSize=384m $default_jvm_opts_common" + fi +} + +execRunner() { + # print the arguments one to a line, quoting any containing spaces + vlog "# Executing command line:" && { + for arg; do + if [[ -n "$arg" ]]; then + if printf "%s\n" "$arg" | grep -q ' '; then + printf >&2 "\"%s\"\n" "$arg" + else + printf >&2 "%s\n" "$arg" + fi + fi + done + vlog "" + } + + setTrapExit + + if [[ -n "$batch" ]]; then + "$@" /dev/null 2>&1; then + curl --fail --silent --location "$url" --output "$jar" + elif command -v wget >/dev/null 2>&1; then + wget -q -O "$jar" "$url" + fi + } && [[ -r "$jar" ]] +} + +acquire_sbt_jar() { + { + sbt_jar="$(jar_file "$sbt_version")" + [[ -r "$sbt_jar" ]] + } || { + sbt_jar="$HOME/.ivy2/local/org.scala-sbt/sbt-launch/$sbt_version/jars/sbt-launch.jar" + [[ -r "$sbt_jar" ]] + } || { + sbt_jar="$(jar_file "$sbt_version")" + jar_url="$(make_url "$sbt_version")" + + echoerr "Downloading sbt launcher for ${sbt_version}:" + echoerr " From ${jar_url}" + echoerr " To ${sbt_jar}" + + download_url "${jar_url}" "${sbt_jar}" + + case "${sbt_version}" in + 0.*) + vlog "SBT versions < 1.0 do not have published MD5 checksums, skipping check" + echo "" + ;; + *) verify_sbt_jar "${sbt_jar}" ;; + esac + } +} + +verify_sbt_jar() { + local jar="${1}" + local md5="${jar}.md5" + md5url="$(make_url "${sbt_version}").md5" + + echoerr "Downloading sbt launcher ${sbt_version} md5 hash:" + echoerr " From ${md5url}" + echoerr " To ${md5}" + + download_url "${md5url}" "${md5}" >/dev/null 2>&1 + + if command -v md5sum >/dev/null 2>&1; then + if echo "$(cat "${md5}") ${jar}" | md5sum -c -; then + rm -rf "${md5}" + return 0 + else + echoerr "Checksum does not match" + return 1 + fi + elif command -v md5 >/dev/null 2>&1; then + if [ "$(md5 -q "${jar}")" == "$(cat "${md5}")" ]; then + rm -rf "${md5}" + return 0 + else + echoerr "Checksum does not match" + return 1 + fi + elif command -v openssl >/dev/null 2>&1; then + if [ "$(openssl md5 -r "${jar}" | awk '{print $1}')" == "$(cat "${md5}")" ]; then + rm -rf "${md5}" + return 0 + else + echoerr "Checksum does not match" + return 1 + fi + else + echoerr "Could not find an MD5 command" + return 1 + fi +} + +usage() { + set_sbt_version + cat < display stack traces with a max of frames (default: -1, traces suppressed) + -debug-inc enable debugging log for the incremental compiler + -no-colors disable ANSI color codes + -sbt-create start sbt even if current directory contains no sbt project + -sbt-dir path to global settings/plugins directory (default: ~/.sbt/) + -sbt-boot path to shared boot directory (default: ~/.sbt/boot in 0.11+) + -ivy path to local Ivy repository (default: ~/.ivy2) + -no-share use all local caches; no sharing + -offline put sbt in offline mode + -jvm-debug Turn on JVM debugging, open at the given port. + -batch Disable interactive mode + -prompt Set the sbt prompt; in expr, 's' is the State and 'e' is Extracted + -script Run the specified file as a scala script + + # sbt version (default: sbt.version from $buildProps if present, otherwise $sbt_release_version) + -sbt-version use the specified version of sbt (default: $sbt_release_version) + -sbt-force-latest force the use of the latest release of sbt: $sbt_release_version + -sbt-dev use the latest pre-release version of sbt: $sbt_unreleased_version + -sbt-jar use the specified jar as the sbt launcher + -sbt-launch-dir directory to hold sbt launchers (default: $sbt_launch_dir) + -sbt-launch-repo repo url for downloading sbt launcher jar (default: $(url_base "$sbt_version")) + + # scala version (default: as chosen by sbt) + -28 use $latest_28 + -29 use $latest_29 + -210 use $latest_210 + -211 use $latest_211 + -212 use $latest_212 + -213 use $latest_213 + -scala-home use the scala build at the specified directory + -scala-version use the specified version of scala + -binary-version use the specified scala version when searching for dependencies + + # java version (default: java from PATH, currently $(java -version 2>&1 | grep version)) + -java-home alternate JAVA_HOME + + # passing options to the jvm - note it does NOT use JAVA_OPTS due to pollution + # The default set is used if JVM_OPTS is unset and no -jvm-opts file is found + $(default_jvm_opts) + JVM_OPTS environment variable holding either the jvm args directly, or + the reference to a file containing jvm args if given path is prepended by '@' (e.g. '@/etc/jvmopts') + Note: "@"-file is overridden by local '.jvmopts' or '-jvm-opts' argument. + -jvm-opts file containing jvm args (if not given, .jvmopts in project root is used if present) + -Dkey=val pass -Dkey=val directly to the jvm + -J-X pass option -X directly to the jvm (-J is stripped) + + # passing options to sbt, OR to this runner + SBT_OPTS environment variable holding either the sbt args directly, or + the reference to a file containing sbt args if given path is prepended by '@' (e.g. '@/etc/sbtopts') + Note: "@"-file is overridden by local '.sbtopts' or '-sbt-opts' argument. + -sbt-opts file containing sbt args (if not given, .sbtopts in project root is used if present) + -S-X add -X to sbt's scalacOptions (-S is stripped) + + # passing options exclusively to this runner + SBTX_OPTS environment variable holding either the sbt-extras args directly, or + the reference to a file containing sbt-extras args if given path is prepended by '@' (e.g. '@/etc/sbtxopts') + Note: "@"-file is overridden by local '.sbtxopts' or '-sbtx-opts' argument. + -sbtx-opts file containing sbt-extras args (if not given, .sbtxopts in project root is used if present) +EOM + exit 0 +} + +process_args() { + require_arg() { + local type="$1" + local opt="$2" + local arg="$3" + + if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then + die "$opt requires <$type> argument" + fi + } + while [[ $# -gt 0 ]]; do + case "$1" in + -h | -help) usage ;; + -v) verbose=true && shift ;; + -d) addSbt "--debug" && shift ;; + -w) addSbt "--warn" && shift ;; + -q) addSbt "--error" && shift ;; + -x) shift ;; # currently unused + -trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;; + -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;; + + -no-colors) addJava "-Dsbt.log.noformat=true" && addJava "-Dsbt.color=false" && shift ;; + -sbt-create) sbt_create=true && shift ;; + -sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;; + -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;; + -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;; + -no-share) noshare=true && shift ;; + -offline) addSbt "set offline in Global := true" && shift ;; + -jvm-debug) require_arg port "$1" "$2" && addDebugger "$2" && shift 2 ;; + -batch) batch=true && shift ;; + -prompt) require_arg "expr" "$1" "$2" && setThisBuild shellPrompt "(s => { val e = Project.extract(s) ; $2 })" && shift 2 ;; + -script) require_arg file "$1" "$2" && sbt_script="$2" && addJava "-Dsbt.main.class=sbt.ScriptMain" && shift 2 ;; + + -sbt-version) require_arg version "$1" "$2" && sbt_explicit_version="$2" && shift 2 ;; + -sbt-force-latest) sbt_explicit_version="$sbt_release_version" && shift ;; + -sbt-dev) sbt_explicit_version="$sbt_unreleased_version" && shift ;; + -sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;; + -sbt-launch-dir) require_arg path "$1" "$2" && sbt_launch_dir="$2" && shift 2 ;; + -sbt-launch-repo) require_arg path "$1" "$2" && sbt_launch_repo="$2" && shift 2 ;; + + -28) setScalaVersion "$latest_28" && shift ;; + -29) setScalaVersion "$latest_29" && shift ;; + -210) setScalaVersion "$latest_210" && shift ;; + -211) setScalaVersion "$latest_211" && shift ;; + -212) setScalaVersion "$latest_212" && shift ;; + -213) setScalaVersion "$latest_213" && shift ;; + + -scala-version) require_arg version "$1" "$2" && setScalaVersion "$2" && shift 2 ;; + -binary-version) require_arg version "$1" "$2" && setThisBuild scalaBinaryVersion "\"$2\"" && shift 2 ;; + -scala-home) require_arg path "$1" "$2" && setThisBuild scalaHome "_root_.scala.Some(file(\"$2\"))" && shift 2 ;; + -java-home) require_arg path "$1" "$2" && setJavaHome "$2" && shift 2 ;; + -sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;; + -sbtx-opts) require_arg path "$1" "$2" && sbtx_opts_file="$2" && shift 2 ;; + -jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;; + + -D*) addJava "$1" && shift ;; + -J*) addJava "${1:2}" && shift ;; + -S*) addScalac "${1:2}" && shift ;; + + new) sbt_new=true && : ${sbt_explicit_version:=$sbt_release_version} && addResidual "$1" && shift ;; + + *) addResidual "$1" && shift ;; + esac + done +} + +# process the direct command line arguments +process_args "$@" + +# skip #-styled comments and blank lines +readConfigFile() { + local end=false + until $end; do + read -r || end=true + [[ $REPLY =~ ^# ]] || [[ -z $REPLY ]] || echo "$REPLY" + done <"$1" +} + +# if there are file/environment sbt_opts, process again so we +# can supply args to this runner +if [[ -r "$sbt_opts_file" ]]; then + vlog "Using sbt options defined in file $sbt_opts_file" + while read -r opt; do extra_sbt_opts+=("$opt"); done < <(readConfigFile "$sbt_opts_file") +elif [[ -n "$SBT_OPTS" && ! ("$SBT_OPTS" =~ ^@.*) ]]; then + vlog "Using sbt options defined in variable \$SBT_OPTS" + IFS=" " read -r -a extra_sbt_opts <<<"$SBT_OPTS" +else + vlog "No extra sbt options have been defined" +fi + +# if there are file/environment sbtx_opts, process again so we +# can supply args to this runner +if [[ -r "$sbtx_opts_file" ]]; then + vlog "Using sbt options defined in file $sbtx_opts_file" + while read -r opt; do extra_sbt_opts+=("$opt"); done < <(readConfigFile "$sbtx_opts_file") +elif [[ -n "$SBTX_OPTS" && ! ("$SBTX_OPTS" =~ ^@.*) ]]; then + vlog "Using sbt options defined in variable \$SBTX_OPTS" + IFS=" " read -r -a extra_sbt_opts <<<"$SBTX_OPTS" +else + vlog "No extra sbt options have been defined" +fi + +[[ -n "${extra_sbt_opts[*]}" ]] && process_args "${extra_sbt_opts[@]}" + +# reset "$@" to the residual args +set -- "${residual_args[@]}" +argumentCount=$# + +# set sbt version +set_sbt_version + +checkJava + +# only exists in 0.12+ +setTraceLevel() { + case "$sbt_version" in + "0.7."* | "0.10."* | "0.11."*) echoerr "Cannot set trace level in sbt version $sbt_version" ;; + *) setThisBuild traceLevel "$trace_level" ;; + esac +} + +# set scalacOptions if we were given any -S opts +[[ ${#scalac_args[@]} -eq 0 ]] || addSbt "set scalacOptions in ThisBuild += \"${scalac_args[*]}\"" + +[[ -n "$sbt_explicit_version" && -z "$sbt_new" ]] && addJava "-Dsbt.version=$sbt_explicit_version" +vlog "Detected sbt version $sbt_version" + +if [[ -n "$sbt_script" ]]; then + residual_args=("$sbt_script" "${residual_args[@]}") +else + # no args - alert them there's stuff in here + ((argumentCount > 0)) || { + vlog "Starting $script_name: invoke with -help for other options" + residual_args=(shell) + } +fi + +# verify this is an sbt dir, -create was given or user attempts to run a scala script +[[ -r ./build.sbt || -d ./project || -n "$sbt_create" || -n "$sbt_script" || -n "$sbt_new" ]] || { + cat < Date: Sat, 11 May 2024 03:31:30 +0200 Subject: [PATCH 03/14] correto --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 345817538..54c66b95f 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3) ThisBuild / tlBaseVersion := "2.5" -val temurin = JavaSpec.temurin("8") +val temurin = JavaSpec.corretto("8") ThisBuild / githubWorkflowJavaVersions := Seq(temurin) ThisBuild / githubWorkflowSbtCommand := "./sbt" From 4af70bd64b32543096d1db8332bd1d5447a4e7b0 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:33:26 +0200 Subject: [PATCH 04/14] correto --- .github/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- build.sbt | 6 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cd49543f..ee60d535b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,11 +29,11 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.12.17, 2.13.10, 3.3.3] - java: [temurin@8] + java: [corretto@8] project: [rootJS, rootJVM, rootNative] include: - scala: 3.3.3 - java: temurin@8 + java: corretto@8 project: rootNative os: macos-latest exclude: @@ -49,21 +49,21 @@ jobs: with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' + - name: Download Java (corretto@8) + id: download-java-corretto-8 + if: matrix.java == 'corretto@8' uses: typelevel/download-java@v1 with: - distribution: temurin + distribution: corretto java-version: 8 - - name: Setup Java (temurin@8) - if: matrix.java == 'temurin@8' + - name: Setup Java (corretto@8) + if: matrix.java == 'corretto@8' uses: actions/setup-java@v2 with: distribution: jdkfile java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + jdkFile: ${{ steps.download-java-corretto-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 @@ -81,7 +81,7 @@ jobs: run: ./sbt githubWorkflowCheck - name: Check formatting - if: matrix.java == 'temurin@8' + if: matrix.java == 'corretto@8' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - name: scalaJSLink @@ -96,11 +96,11 @@ jobs: run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'temurin@8' + if: matrix.java == 'corretto@8' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'temurin@8' + if: matrix.java == 'corretto@8' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories @@ -126,7 +126,7 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.13.10] - java: [temurin@8] + java: [corretto@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -134,21 +134,21 @@ jobs: with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' + - name: Download Java (corretto@8) + id: download-java-corretto-8 + if: matrix.java == 'corretto@8' uses: typelevel/download-java@v1 with: - distribution: temurin + distribution: corretto java-version: 8 - - name: Setup Java (temurin@8) - if: matrix.java == 'temurin@8' + - name: Setup Java (corretto@8) + if: matrix.java == 'corretto@8' uses: actions/setup-java@v2 with: distribution: jdkfile java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + jdkFile: ${{ steps.download-java-corretto-8.outputs.jdkFile }} - name: Cache sbt uses: actions/cache@v2 diff --git a/build.sbt b/build.sbt index 54c66b95f..0baf85651 100644 --- a/build.sbt +++ b/build.sbt @@ -5,8 +5,8 @@ ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3) ThisBuild / tlBaseVersion := "2.5" -val temurin = JavaSpec.corretto("8") -ThisBuild / githubWorkflowJavaVersions := Seq(temurin) +val javaDistro = JavaSpec.corretto("8") +ThisBuild / githubWorkflowJavaVersions := Seq(javaDistro) ThisBuild / githubWorkflowSbtCommand := "./sbt" @@ -18,7 +18,7 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( ) ThisBuild / githubWorkflowBuildMatrixInclusions += - MatrixInclude(Map("scala" -> scala3, "java" -> temurin.render, "project" -> "rootNative"), + MatrixInclude(Map("scala" -> scala3, "java" -> javaDistro.render, "project" -> "rootNative"), Map("os" -> "macos-latest") ) From 2daeffb041b12d364c4ae84f61735670265cf6d5 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:36:31 +0200 Subject: [PATCH 05/14] Scala Native 0.4.17 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0e1ddfd53..7a62e8836 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,4 +8,4 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.17") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.11") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") From 423ae2681d8091a621403a8060c43bda180ecd61 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:46:07 +0200 Subject: [PATCH 06/14] sbt-typelevel 0.7.1 --- .github/workflows/ci.yml | 199 +++++++++++++++++++++------------------ build.sbt | 8 +- project/plugins.sbt | 4 +- 3 files changed, 112 insertions(+), 99 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee60d535b..90cbf1088 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,73 +15,59 @@ on: tags: [v*] env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test strategy: matrix: os: [ubuntu-latest] - scala: [2.12.17, 2.13.10, 3.3.3] + scala: [2.12, 2.13, 3] java: [corretto@8] project: [rootJS, rootJVM, rootNative] include: - - scala: 3.3.3 + - scala: 3 java: corretto@8 project: rootNative os: macos-latest exclude: - - scala: 3.3.3 + - scala: 3 project: rootJVM - - scala: 3.3.3 + - scala: 3 project: rootNative os: ubuntu-latest runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Download Java (corretto@8) - id: download-java-corretto-8 - if: matrix.java == 'corretto@8' - uses: typelevel/download-java@v1 - with: - distribution: corretto - java-version: 8 - - name: Setup Java (corretto@8) + id: setup-java-corretto-8 if: matrix.java == 'corretto@8' - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - distribution: jdkfile + distribution: corretto java-version: 8 - jdkFile: ${{ steps.download-java-corretto-8.outputs.jdkFile }} + cache: sbt - - name: Cache sbt - uses: actions/cache@v2 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + run: ./sbt +update - name: Check that workflows are up to date run: ./sbt githubWorkflowCheck - name: Check formatting - if: matrix.java == 'corretto@8' + if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - name: scalaJSLink @@ -96,24 +82,24 @@ jobs: run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'corretto@8' + if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'corretto@8' + if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') - run: mkdir -p target .js/target core/native/target tzdb/js/target core/js/target core/jvm/target tests/js/target .jvm/target .native/target demo/jvm/target tests/jvm/target demo/native/target tzdb/jvm/target tzdb/native/target tests/native/target demo/js/target project/target + run: mkdir -p core/native/target tzdb/js/target core/js/target core/jvm/target tzdb/jvm/target tzdb/native/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') - run: tar cf targets.tar target .js/target core/native/target tzdb/js/target core/js/target core/jvm/target tests/js/target .jvm/target .native/target demo/jvm/target tests/jvm/target demo/native/target tzdb/jvm/target tzdb/native/target tests/native/target demo/js/target project/target + run: tar cf targets.tar core/native/target tzdb/js/target core/js/target core/jvm/target tzdb/jvm/target tzdb/native/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} path: targets.tar @@ -125,123 +111,150 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10] java: [corretto@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Download Java (corretto@8) - id: download-java-corretto-8 + - name: Setup Java (corretto@8) + id: setup-java-corretto-8 if: matrix.java == 'corretto@8' - uses: typelevel/download-java@v1 + uses: actions/setup-java@v4 with: distribution: corretto java-version: 8 + cache: sbt - - name: Setup Java (corretto@8) - if: matrix.java == 'corretto@8' - uses: actions/setup-java@v2 - with: - distribution: jdkfile - java-version: 8 - jdkFile: ${{ steps.download-java-corretto-8.outputs.jdkFile }} + - name: sbt update + if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + run: ./sbt +update - - name: Cache sbt - uses: actions/cache@v2 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - - name: Download target directories (2.12.17, rootJS) - uses: actions/download-artifact@v2 + - name: Download target directories (2.12, rootJS) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS - - name: Inflate target directories (2.12.17, rootJS) + - name: Inflate target directories (2.12, rootJS) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.12.17, rootJVM) - uses: actions/download-artifact@v2 + - name: Download target directories (2.12, rootJVM) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM - - name: Inflate target directories (2.12.17, rootJVM) + - name: Inflate target directories (2.12, rootJVM) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.12.17, rootNative) - uses: actions/download-artifact@v2 + - name: Download target directories (2.12, rootNative) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootNative + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative - - name: Inflate target directories (2.12.17, rootNative) + - name: Inflate target directories (2.12, rootNative) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.13.10, rootJS) - uses: actions/download-artifact@v2 + - name: Download target directories (2.13, rootJS) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS - - name: Inflate target directories (2.13.10, rootJS) + - name: Inflate target directories (2.13, rootJS) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.13.10, rootJVM) - uses: actions/download-artifact@v2 + - name: Download target directories (2.13, rootJVM) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM - - name: Inflate target directories (2.13.10, rootJVM) + - name: Inflate target directories (2.13, rootJVM) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (2.13.10, rootNative) - uses: actions/download-artifact@v2 + - name: Download target directories (2.13, rootNative) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootNative + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative - - name: Inflate target directories (2.13.10, rootNative) + - name: Inflate target directories (2.13, rootNative) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.3.3, rootJS) - uses: actions/download-artifact@v2 + - name: Download target directories (3, rootJS) + uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.3-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS - - name: Inflate target directories (3.3.3, rootJS) + - name: Inflate target directories (3, rootJS) run: | tar xf targets.tar rm targets.tar - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' - run: echo $PGP_SECRET | base64 -di | gpg --import + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import - name: Import signing key and strip passphrase if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: | - echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg + echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - name: Publish - run: ./sbt '++ ${{ matrix.scala }}' tlRelease + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + run: ./sbt tlCiRelease + + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [corretto@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (corretto@8) + id: setup-java-corretto-8 + if: matrix.java == 'corretto@8' + uses: actions/setup-java@v4 + with: + distribution: corretto + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + run: ./sbt +update + + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 tests_sjs1_2.12 tests_sjs1_2.13 tests_sjs1_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 demo_2.12 demo_2.13 demo_3 tests_2.12 tests_2.13 tests_3 demo_native0.4_2.12 demo_native0.4_2.13 demo_native0.4_3 tests_native0.4_2.12 tests_native0.4_2.13 tests_native0.4_3 demo_sjs1_2.12 demo_sjs1_2.13 demo_sjs1_3 + configs-ignore: test scala-tool scala-doc-tool test-internal diff --git a/build.sbt b/build.sbt index 0baf85651..1de61ba0c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,4 @@ -val scala213 = "2.13.10" +val scala213 = "2.13.14" val scala3 = "3.3.3" ThisBuild / scalaVersion := scala213 ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3) @@ -11,14 +11,14 @@ ThisBuild / githubWorkflowJavaVersions := Seq(javaDistro) ThisBuild / githubWorkflowSbtCommand := "./sbt" ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( - MatrixExclude(Map("scala" -> scala3, "project" -> "rootJVM")), // TODO + MatrixExclude(Map("scala" -> "3", "project" -> "rootJVM")), // TODO MatrixExclude( - Map("scala" -> scala3, "project" -> "rootNative", "os" -> "ubuntu-latest") + Map("scala" -> "3", "project" -> "rootNative", "os" -> "ubuntu-latest") ) // run on macOS instead ) ThisBuild / githubWorkflowBuildMatrixInclusions += - MatrixInclude(Map("scala" -> scala3, "java" -> javaDistro.render, "project" -> "rootNative"), + MatrixInclude(Map("scala" -> "3", "java" -> javaDistro.render, "project" -> "rootNative"), Map("os" -> "macos-latest") ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 7a62e8836..22ce7d5f3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,10 +1,10 @@ addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "4.2.0") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.17") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.1") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") From f0287fd8c7b265e0ec216baf82549f4789669a0f Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:56:37 +0200 Subject: [PATCH 07/14] remove -Xfatal-warnings --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 1de61ba0c..f0cfc18ff 100644 --- a/build.sbt +++ b/build.sbt @@ -83,6 +83,7 @@ lazy val commonSettings = Seq( ) else List( + "-Xfatal-warnings" ) }, javaOptions ++= Seq("-Dfile.encoding=UTF8"), From 6ef4965340ff9905fbe0c0032235e5d752cced4e Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:18:52 +0200 Subject: [PATCH 08/14] no fatal warnings --- build.sbt | 2 -- project/plugins.sbt | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index f0cfc18ff..e199b09d5 100644 --- a/build.sbt +++ b/build.sbt @@ -179,7 +179,6 @@ lazy val tzdb = crossProject(JVMPlatform, JSPlatform, NativePlatform) name := "scala-java-time-tzdb", includeTTBP := true, dbVersion := TzdbPlugin.Version(tzdbVersion), - tlFatalWarnings := false ) .jsSettings( Compile / sourceGenerators += Def.task { @@ -252,7 +251,6 @@ lazy val demo = crossProject(JSPlatform, JVMPlatform, NativePlatform) Keys.`package` := file(""), zonesFilter := zonesFilterFn, dbVersion := TzdbPlugin.Version(tzdbVersion), - tlFatalWarnings := false, // delegate test to run, so that it is invoked during test step in ci Test / test := (Compile / run).toTask("").value ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 22ce7d5f3..7bbb9b41e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,11 @@ -addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "4.2.0") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.1") +addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.1") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") From ba16ab0e7c5b5f4103e60d657c1e37354d1bc32d Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:20:32 +0200 Subject: [PATCH 09/14] githubWorkflowGenerate --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90cbf1088..3312a07a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,10 +66,6 @@ jobs: - name: Check that workflows are up to date run: ./sbt githubWorkflowCheck - - name: Check formatting - if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' - run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - - name: scalaJSLink if: matrix.project == 'rootJS' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult From f4d36b2ebd130ff1c0bb76b2ba24d3ca3fcc9760 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:25:12 +0200 Subject: [PATCH 10/14] Java 11 --- .github/workflows/ci.yml | 42 ++++++++++++++++++++-------------------- build.sbt | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3312a07a9..e5690b892 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,11 +29,11 @@ jobs: matrix: os: [ubuntu-latest] scala: [2.12, 2.13, 3] - java: [corretto@8] + java: [corretto@11] project: [rootJS, rootJVM, rootNative] include: - scala: 3 - java: corretto@8 + java: corretto@11 project: rootNative os: macos-latest exclude: @@ -50,17 +50,17 @@ jobs: with: fetch-depth: 0 - - name: Setup Java (corretto@8) - id: setup-java-corretto-8 - if: matrix.java == 'corretto@8' + - name: Setup Java (corretto@11) + id: setup-java-corretto-11 + if: matrix.java == 'corretto@11' uses: actions/setup-java@v4 with: distribution: corretto - java-version: 8 + java-version: 11 cache: sbt - name: sbt update - if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false' run: ./sbt +update - name: Check that workflows are up to date @@ -78,11 +78,11 @@ jobs: run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' + if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'corretto@8' && matrix.os == 'ubuntu-latest' + if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories @@ -107,7 +107,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - java: [corretto@8] + java: [corretto@11] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -115,17 +115,17 @@ jobs: with: fetch-depth: 0 - - name: Setup Java (corretto@8) - id: setup-java-corretto-8 - if: matrix.java == 'corretto@8' + - name: Setup Java (corretto@11) + id: setup-java-corretto-11 + if: matrix.java == 'corretto@11' uses: actions/setup-java@v4 with: distribution: corretto - java-version: 8 + java-version: 11 cache: sbt - name: sbt update - if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false' run: ./sbt +update - name: Download target directories (2.12, rootJS) @@ -228,7 +228,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - java: [corretto@8] + java: [corretto@11] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -236,17 +236,17 @@ jobs: with: fetch-depth: 0 - - name: Setup Java (corretto@8) - id: setup-java-corretto-8 - if: matrix.java == 'corretto@8' + - name: Setup Java (corretto@11) + id: setup-java-corretto-11 + if: matrix.java == 'corretto@11' uses: actions/setup-java@v4 with: distribution: corretto - java-version: 8 + java-version: 11 cache: sbt - name: sbt update - if: matrix.java == 'corretto@8' && steps.setup-java-corretto-8.outputs.cache-hit == 'false' + if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false' run: ./sbt +update - name: Submit Dependencies diff --git a/build.sbt b/build.sbt index e199b09d5..86ab686b7 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3) ThisBuild / tlBaseVersion := "2.5" -val javaDistro = JavaSpec.corretto("8") +val javaDistro = JavaSpec.corretto("11") ThisBuild / githubWorkflowJavaVersions := Seq(javaDistro) ThisBuild / githubWorkflowSbtCommand := "./sbt" From 62157e2f626d9ea2ee8b0578f2bdac4db93417d1 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:34:10 +0200 Subject: [PATCH 11/14] Scala.js: Throwable instead of JavaScriptException --- tests/js/src/test/scala/org/threeten/bp/Platform.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/js/src/test/scala/org/threeten/bp/Platform.scala b/tests/js/src/test/scala/org/threeten/bp/Platform.scala index d900b1ce8..dd22cadbe 100644 --- a/tests/js/src/test/scala/org/threeten/bp/Platform.scala +++ b/tests/js/src/test/scala/org/threeten/bp/Platform.scala @@ -4,7 +4,7 @@ import java.util.NavigableMap import org.threeten.bp.zone.ZoneMap object Platform { - type NPE = scala.scalajs.js.JavaScriptException + type NPE = Throwable type DFE = Throwable type CCE = Throwable From 211e7494191028aa930a596364768bf5430847b7 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:45:04 +0200 Subject: [PATCH 12/14] roll back -Xfatal-warnings --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 86ab686b7..8a1429374 100644 --- a/build.sbt +++ b/build.sbt @@ -83,7 +83,6 @@ lazy val commonSettings = Seq( ) else List( - "-Xfatal-warnings" ) }, javaOptions ++= Seq("-Dfile.encoding=UTF8"), From e390a5eca4d5fd632ad5d882cf63d83bf6d868a5 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:55:41 +0200 Subject: [PATCH 13/14] bring back sbt-typelevel --- .github/workflows/ci.yml | 4 ++++ build.sbt | 2 ++ project/plugins.sbt | 6 +----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5690b892..8ccab3054 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,10 @@ jobs: - name: Check that workflows are up to date run: ./sbt githubWorkflowCheck + - name: Check formatting + if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest' + run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck + - name: scalaJSLink if: matrix.project == 'rootJS' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult diff --git a/build.sbt b/build.sbt index 8a1429374..5eaa73556 100644 --- a/build.sbt +++ b/build.sbt @@ -178,6 +178,7 @@ lazy val tzdb = crossProject(JVMPlatform, JSPlatform, NativePlatform) name := "scala-java-time-tzdb", includeTTBP := true, dbVersion := TzdbPlugin.Version(tzdbVersion), + tlFatalWarnings := false ) .jsSettings( Compile / sourceGenerators += Def.task { @@ -250,6 +251,7 @@ lazy val demo = crossProject(JSPlatform, JVMPlatform, NativePlatform) Keys.`package` := file(""), zonesFilter := zonesFilterFn, dbVersion := TzdbPlugin.Version(tzdbVersion), + tlFatalWarnings := false, // delegate test to run, so that it is invoked during test step in ci Test / test := (Compile / run).toTask("").value ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 7bbb9b41e..674109402 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,7 @@ -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") - addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "4.2.0") -addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.1") - -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") From ac7f7f1979561876865d80ef2cd0e2039e68a21e Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 04:59:38 +0200 Subject: [PATCH 14/14] Revert "bring back sbt-typelevel" This reverts commit e390a5eca4d5fd632ad5d882cf63d83bf6d868a5. --- .github/workflows/ci.yml | 4 ---- build.sbt | 2 -- project/plugins.sbt | 6 +++++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ccab3054..e5690b892 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,10 +66,6 @@ jobs: - name: Check that workflows are up to date run: ./sbt githubWorkflowCheck - - name: Check formatting - if: matrix.java == 'corretto@11' && matrix.os == 'ubuntu-latest' - run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - - name: scalaJSLink if: matrix.project == 'rootJS' run: ./sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult diff --git a/build.sbt b/build.sbt index 5eaa73556..8a1429374 100644 --- a/build.sbt +++ b/build.sbt @@ -178,7 +178,6 @@ lazy val tzdb = crossProject(JVMPlatform, JSPlatform, NativePlatform) name := "scala-java-time-tzdb", includeTTBP := true, dbVersion := TzdbPlugin.Version(tzdbVersion), - tlFatalWarnings := false ) .jsSettings( Compile / sourceGenerators += Def.task { @@ -251,7 +250,6 @@ lazy val demo = crossProject(JSPlatform, JVMPlatform, NativePlatform) Keys.`package` := file(""), zonesFilter := zonesFilterFn, dbVersion := TzdbPlugin.Version(tzdbVersion), - tlFatalWarnings := false, // delegate test to run, so that it is invoked during test step in ci Test / test := (Compile / run).toTask("").value ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 674109402..7bbb9b41e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,11 @@ +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "4.2.0") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.1") +addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.1") + +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")