Skip to content

Commit

Permalink
Add Scala 2.12 support (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoenig authored Feb 23, 2024
1 parent a9f3ff1 commit b5d5f6f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-firtool-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Publish
shell: bash
run: |
./mill -i firtool-resolver.publishSigned
./mill -i firtool-resolver[_].publishSigned
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
name: Run Tests
strategy:
matrix:
scala-version: ["2.13", "2.12"]
runner: ["ubuntu-20.04", "macos-11", "windows-2019"]
include:
- runner: ubuntu-20.04
Expand Down Expand Up @@ -70,5 +71,5 @@ jobs:
run: |
# First run of mill is important to set itself up
./mill resolve _
./firtool-resolver/test/run_tests.sh ${{ matrix.os }}
./firtool-resolver/test/run_tests.sh ${{ matrix.os }} ${{ matrix.scala-version }}
9 changes: 7 additions & 2 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,13 @@ object `llvm-firtool` extends JavaModule with ChipsAlliancePublishModule {
// ******************** WARNING ********************
// This is extremely manual and changing dependencies IN ANY WAY (including bumping version)
// requires carefully checking the packages to shade and dynamic ivy deps in the outer project
object `firtool-resolver` extends ScalaModule with ChipsAlliancePublishModule { root =>
def scalaVersion = "2.13.11"
object `firtool-resolver` extends Cross[FirtoolResolver]("2.13", "2.12")
trait FirtoolResolver extends CrossScalaModule with ChipsAlliancePublishModule { root =>

override def crossScalaVersion = Map(
"2.13" -> "2.13.11",
"2.12" -> "2.12.18"
)(crossValue)

def publishVersion = VcsVersion.vcsState().format(countSep = "+", untaggedSuffix = "-SNAPSHOT")

Expand Down
2 changes: 1 addition & 1 deletion firtool-resolver/test/fetched.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

FIRTOOL=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
--main firtoolresolver.Main \
-- \
Expand Down
2 changes: 1 addition & 1 deletion firtool-resolver/test/firtool_cache.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

FIRTOOL=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
org.chipsalliance:llvm-firtool:$LLVM_FIRTOOL_VERSION \
--main firtoolresolver.Main \
Expand Down
6 changes: 3 additions & 3 deletions firtool-resolver/test/firtool_path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# From a previous test
FIRTOOL_BIN=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
org.chipsalliance:llvm-firtool:$LLVM_FIRTOOL_VERSION \
--main firtoolresolver.Main \
Expand All @@ -12,7 +12,7 @@ cs launch --scala 2.13.11 \
export CHISEL_FIRTOOL_PATH=$(dirname $FIRTOOL_BIN)

FIRTOOL=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
--main firtoolresolver.Main \
-- \
Expand All @@ -30,7 +30,7 @@ $FIRTOOL --version
# rather than just going ahead and fetching the dfeault version
mv $FIRTOOL_BIN ${FIRTOOL_BIN}_renamed

cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
--main firtoolresolver.Main \
-- \
Expand Down
2 changes: 1 addition & 1 deletion firtool-resolver/test/installed.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

FIRTOOL=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
--main firtoolresolver.Main \
-- \
Expand Down
4 changes: 2 additions & 2 deletions firtool-resolver/test/negative.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# This test needs to be run before publishLocal
# If this test fails when run locally, you may need to wipe your local ivy cache

cs launch --scala 2.13.11 org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION --main firtoolresolver.Main
# CHECK: Resolution error: Error downloading org.chipsalliance:firtool-resolver_2.13:{{.+}}
cs launch --scala $SCALA_VERSION org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION --main firtoolresolver.Main
# CHECK: Can't find a scala version suffix for org.chipsalliance::firtool-resolver:{{.+}}
2 changes: 1 addition & 1 deletion firtool-resolver/test/on_classpath.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

FIRTOOL=$(
cs launch --scala 2.13.11 \
cs launch --scala $SCALA_VERSION \
org.chipsalliance::firtool-resolver:$FIRTOOL_RESOLVER_VERSION \
org.chipsalliance:llvm-firtool:$LLVM_FIRTOOL_VERSION \
--main firtoolresolver.Main \
Expand Down
5 changes: 3 additions & 2 deletions firtool-resolver/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ set -ex
THIS_DIR=$(cd "$(dirname "$0")"; pwd -P)

OS=$1
export SCALA_VERSION=$2

export COURSIER_CACHE="$PWD/coursier_cache"
rm -rf $COURSIER_CACHE
export FIRTOOL_RESOLVER_VERSION=$(./mill show firtool-resolver.publishVersion | xargs)
export FIRTOOL_RESOLVER_VERSION=$(./mill show firtool-resolver[$SCALA_VERSION].publishVersion | xargs)
export LLVM_FIRTOOL_VERSION=$(./mill show llvm-firtool.publishVersion | xargs)
# If there's a -SNAPSHOT in LLVM_FIRTOOL_VERSION, strip it
export FIRTOOL_VERSION=${LLVM_FIRTOOL_VERSION%-SNAPSHOT}
Expand All @@ -18,7 +19,7 @@ $THIS_DIR/negative.sh 2>&1 | FileCheck $THIS_DIR/negative.sh
# TODO remove this line, use maven central published versions
./mill llvm-firtool.publishLocal

./mill firtool-resolver.publishLocal
./mill firtool-resolver[$SCALA_VERSION].publishLocal

$THIS_DIR/on_classpath.sh 2>&1 | FileCheck -DLLVM_FIRTOOL_VERSION="$LLVM_FIRTOOL_VERSION" -DFIRTOOL_VERSION="$FIRTOOL_VERSION" $THIS_DIR/on_classpath.sh

Expand Down

0 comments on commit b5d5f6f

Please sign in to comment.