From 1a474430c62167e105e361d77cd9bfdecef78f59 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Mon, 22 Jan 2024 15:33:51 -0800 Subject: [PATCH 1/2] Update Scala CLI Template (#3757) * Use "dep" instead of deprecated "lib" * Add _root_ to `import circt.stage.ChiselStage` * Also add comment describing how this disambiguates from chisel3.util.circt when the user does `import chisel3.util._` * Bump versions in Github workflows (cherry picked from commit 589f10672d540d5202ee34df6d869d3b6f0b7340) # Conflicts: # .github/workflows/build-scala-cli-template.yml # .github/workflows/build-scala-cli-template/chisel-template.scala --- .../workflows/build-scala-cli-template.yml | 64 +++++++++++++++++++ .../chisel-template.scala | 8 ++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-scala-cli-template.yml diff --git a/.github/workflows/build-scala-cli-template.yml b/.github/workflows/build-scala-cli-template.yml new file mode 100644 index 00000000000..f40788b2700 --- /dev/null +++ b/.github/workflows/build-scala-cli-template.yml @@ -0,0 +1,64 @@ +name: Build and Test Scala-CLI Template + +on: + workflow_call: + inputs: + circt: + description: 'The version of CIRCT to use' + type: string + +jobs: + build_template: + name: Build and Test + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + # Need to fetch full history for deriving version + with: + fetch-depth: 0 + - name: Install CIRCT + id: install-circt + if: ${{ inputs.circt }} + uses: circt/install-circt@v1.1.1 + with: + version: ${{ inputs.circt }} + github-token: ${{ github.token }} + # TODO have install-circt do this + - name: Set CHISEL_FIRTOOL_PATH + if: steps.install-circt.outcome == 'success' + run: | + dir=$(dirname $(which firtool)) + echo "CHISEL_FIRTOOL_PATH=$dir" >> "$GITHUB_ENV" + - name: Cache Scala-CLI + uses: coursier/cache-action@v6 + - name: Setup Scala-CLI + uses: VirtusLab/scala-cli-setup@v1 + with: + jvm: adoptium:17 + apps: sbt + - name: Generate Scala CLI Template + shell: bash + run: | + # Determine the version and insert it into the template + sbt emitVersion + VERSION=$(cat version.txt) + sed "s/@VERSION@/$VERSION/g" .github/workflows/build-scala-cli-template/chisel-template.scala > chisel-template.scala + # If the version does NOT contain SNAPSHOT, remove line including snapshots repo + if ! grep -qi 'snapshot' <<< $VERSION; then + sed -i '1d' chisel-template.scala + fi + # Need to publishLocal to test the template + - name: Publish Local + shell: bash + run: sbt "unipublish / publishLocal" + - name: Test Scala CLI Template + shell: bash + run: scala-cli chisel-template.scala + - name: Upload Template + uses: actions/upload-artifact@v3 + with: + name: chisel-template.scala + path: chisel-template.scala + retention-days: 7 diff --git a/.github/workflows/build-scala-cli-template/chisel-template.scala b/.github/workflows/build-scala-cli-template/chisel-template.scala index b862aeb6a5f..3f257117df2 100644 --- a/.github/workflows/build-scala-cli-template/chisel-template.scala +++ b/.github/workflows/build-scala-cli-template/chisel-template.scala @@ -1,11 +1,17 @@ //> using repository "sonatype-s01:snapshots" +<<<<<<< HEAD //> using scala "2.13.10" //> using lib "org.chipsalliance::chisel::@VERSION@" +======= +//> using scala "2.13.12" +//> using dep "org.chipsalliance::chisel::@VERSION@" +>>>>>>> 589f10672 (Update Scala CLI Template (#3757)) //> using plugin "org.chipsalliance:::chisel-plugin::@VERSION@" //> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations" import chisel3._ -import circt.stage.ChiselStage +// _root_ disambiguates from package chisel3.util.circt if user imports chisel3.util._ +import _root_.circt.stage.ChiselStage class Foo extends Module { val a, b, c = IO(Input(Bool())) From e436466a6bbe86f1aabf185d7be8d127c2d5575f Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Mon, 22 Jan 2024 15:48:01 -0800 Subject: [PATCH 2/2] Resolve backport conflicts --- .../workflows/build-scala-cli-template.yml | 64 ------------------- .../build-scala-cli-template/action.yml | 4 +- .../chisel-template.scala | 5 -- 3 files changed, 2 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/build-scala-cli-template.yml diff --git a/.github/workflows/build-scala-cli-template.yml b/.github/workflows/build-scala-cli-template.yml deleted file mode 100644 index f40788b2700..00000000000 --- a/.github/workflows/build-scala-cli-template.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build and Test Scala-CLI Template - -on: - workflow_call: - inputs: - circt: - description: 'The version of CIRCT to use' - type: string - -jobs: - build_template: - name: Build and Test - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@v3 - # Need to fetch full history for deriving version - with: - fetch-depth: 0 - - name: Install CIRCT - id: install-circt - if: ${{ inputs.circt }} - uses: circt/install-circt@v1.1.1 - with: - version: ${{ inputs.circt }} - github-token: ${{ github.token }} - # TODO have install-circt do this - - name: Set CHISEL_FIRTOOL_PATH - if: steps.install-circt.outcome == 'success' - run: | - dir=$(dirname $(which firtool)) - echo "CHISEL_FIRTOOL_PATH=$dir" >> "$GITHUB_ENV" - - name: Cache Scala-CLI - uses: coursier/cache-action@v6 - - name: Setup Scala-CLI - uses: VirtusLab/scala-cli-setup@v1 - with: - jvm: adoptium:17 - apps: sbt - - name: Generate Scala CLI Template - shell: bash - run: | - # Determine the version and insert it into the template - sbt emitVersion - VERSION=$(cat version.txt) - sed "s/@VERSION@/$VERSION/g" .github/workflows/build-scala-cli-template/chisel-template.scala > chisel-template.scala - # If the version does NOT contain SNAPSHOT, remove line including snapshots repo - if ! grep -qi 'snapshot' <<< $VERSION; then - sed -i '1d' chisel-template.scala - fi - # Need to publishLocal to test the template - - name: Publish Local - shell: bash - run: sbt "unipublish / publishLocal" - - name: Test Scala CLI Template - shell: bash - run: scala-cli chisel-template.scala - - name: Upload Template - uses: actions/upload-artifact@v3 - with: - name: chisel-template.scala - path: chisel-template.scala - retention-days: 7 diff --git a/.github/workflows/build-scala-cli-template/action.yml b/.github/workflows/build-scala-cli-template/action.yml index 2e6a24d1db2..45b8953331e 100644 --- a/.github/workflows/build-scala-cli-template/action.yml +++ b/.github/workflows/build-scala-cli-template/action.yml @@ -8,9 +8,9 @@ runs: - name: Cache Scala-CLI uses: coursier/cache-action@v6 - name: Setup Scala-CLI - uses: VirtusLab/scala-cli-setup@v0.2.1 + uses: VirtusLab/scala-cli-setup@v1 with: - jvm: adoptium:1.17 + jvm: adoptium:17 apps: sbt - name: Generate Scala CLI Template shell: bash diff --git a/.github/workflows/build-scala-cli-template/chisel-template.scala b/.github/workflows/build-scala-cli-template/chisel-template.scala index 3f257117df2..57a49ee46d8 100644 --- a/.github/workflows/build-scala-cli-template/chisel-template.scala +++ b/.github/workflows/build-scala-cli-template/chisel-template.scala @@ -1,11 +1,6 @@ //> using repository "sonatype-s01:snapshots" -<<<<<<< HEAD //> using scala "2.13.10" -//> using lib "org.chipsalliance::chisel::@VERSION@" -======= -//> using scala "2.13.12" //> using dep "org.chipsalliance::chisel::@VERSION@" ->>>>>>> 589f10672 (Update Scala CLI Template (#3757)) //> using plugin "org.chipsalliance:::chisel-plugin::@VERSION@" //> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"