From a071f0f7738bc4336ca6e547b69a218844a601b8 Mon Sep 17 00:00:00 2001 From: Bruce Collie Date: Tue, 12 Mar 2024 17:06:49 +0000 Subject: [PATCH] Revert "Revert "Set LLVM backend up to receive automatic updates from scala-kore"" (#1012) Reverts runtimeverification/llvm-backend#1010 This PR reinstates the fixed Nix infrastructure that was reverted for POM incompatibility reasons; once this is merged we will stop experiencing the Nix hash invalidation issues that were bothering us over the weekend. I have verified locally that the changes in https://github.com/runtimeverification/llvm-backend/pull/1014 would have caught the problem that we needed to revert in the first place, but this PR needs to get merged first so that the CI will start working for that PR. The only non-revert changes here are to add an explicit plugin dependency on the maven compiler with the appropriate source version set explicitly, and to update the Nix hash as a result. The remainder of the PR has been reviewed already. --- .github/workflows/clang-format-check.yml | 3 +- .github/workflows/test-flake.yml | 3 ++ .github/workflows/update-deps.yml | 32 ++++++++++++++++++++ matching/deps/scala_kore_release | 1 + matching/pom.xml | 38 +++++++++++++++++++----- nix/llvm-backend-matching.nix | 5 ++++ nix/overlay.nix | 2 +- scripts/update-scala-kore.sh | 16 ++++++++++ 8 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/update-deps.yml create mode 100644 matching/deps/scala_kore_release create mode 100755 scripts/update-scala-kore.sh diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 610c54087..92d54d667 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -22,10 +22,11 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - uses: ludeeus/action-shellcheck@1.1.0 + - uses: ludeeus/action-shellcheck@2.0.0 name: Check that shell scripts follow best practices with: scandir: './bin' + additional_files: './scripts/update-scala-kore.sh' clang-tidy-check: name: Clang Tidy check diff --git a/.github/workflows/test-flake.yml b/.github/workflows/test-flake.yml index bc4a62ec2..ece3c5848 100644 --- a/.github/workflows/test-flake.yml +++ b/.github/workflows/test-flake.yml @@ -44,6 +44,9 @@ jobs: - name: 'Build LLVM backend' run: GC_DONT_GC=1 nix build --print-build-logs . + - name: 'Build pattern matching compiler' + run: GC_DONT_GC=1 nix build --print-build-logs .#llvm-backend-matching + - name: 'Test LLVM backend' run: GC_DONT_GC=1 nix flake check --print-build-logs diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml new file mode 100644 index 000000000..a3702c35e --- /dev/null +++ b/.github/workflows/update-deps.yml @@ -0,0 +1,32 @@ +name: 'Update dependencies' +on: + push: + branches: + - '_update-deps/runtimeverification/scala-kore' + workflow_dispatch: +# Stop in progress workflows on the same branch and same workflow to use latest committed code +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + update-versions: + name: 'Update scala-kore version' + runs-on: ubuntu-latest + steps: + - name: 'Check out code' + uses: actions/checkout@v3 + with: + submodules: recursive + token: ${{ secrets.JENKINS_GITHUB_PAT }} + + - name: 'Configure GitHub user' + run: | + git config user.name devops + git config user.email devops@runtimeverification.com + + - name: 'Update scala-kore release tag' + run: ./scripts/update-scala-kore.sh + + - name: 'Push updates' + run: git push diff --git a/matching/deps/scala_kore_release b/matching/deps/scala_kore_release new file mode 100644 index 000000000..0d91a54c7 --- /dev/null +++ b/matching/deps/scala_kore_release @@ -0,0 +1 @@ +0.3.0 diff --git a/matching/pom.xml b/matching/pom.xml index edd12a49d..334f5e565 100644 --- a/matching/pom.xml +++ b/matching/pom.xml @@ -3,17 +3,23 @@ 4.0.0 - - com.runtimeverification.k - parent - 1.0-SNAPSHOT - ../../../../../.. - + com.runtimeverification.k llvm-backend-matching + 1.0-SNAPSHOT jar K Framework LLVM Backend Pattern Matching + + 17 + 0.3.0 + 2.41.1 + 2.12 + 18 + ${scala.majorVersion}.${scala.minorVersion} + 3.7.17 + + runtime.verification @@ -32,10 +38,20 @@ + + org.scala-lang + scala-library + ${scala.version} + + + org.scala-lang + scala-reflect + ${scala.version} + com.runtimeverification.k scala-kore - 0.3.0 + ${scala-kore.version} org.yaml @@ -63,6 +79,14 @@ + + maven-compiler-plugin + 3.7.0 + + ${java.version} + ${java.version} + + net.alchim31.maven scala-maven-plugin diff --git a/nix/llvm-backend-matching.nix b/nix/llvm-backend-matching.nix index 0ce46911b..4dcaf0063 100644 --- a/nix/llvm-backend-matching.nix +++ b/nix/llvm-backend-matching.nix @@ -7,6 +7,11 @@ let self = maven.buildMavenPackage rec { buildOffline = true; + manualMvnArtifacts = [ + "org.scala-lang:scala-compiler:2.12.18" + "org.apache.maven.plugins:maven-compiler-plugin:3.7.0" + ]; + passthru = { jar = "${self}/share/java/llvm-backend-matching-1.0-SNAPSHOT-jar-with-dependencies.jar"; diff --git a/nix/overlay.nix b/nix/overlay.nix index ce59ef4ef..0978acdf7 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -21,7 +21,7 @@ let llvm-backend-matching = import ./llvm-backend-matching.nix { src = prev.llvm-backend-matching-src; - mvnHash = "sha256-g5H5C7oYdBZBIPdeyTH7ai29QfNCKVhn8C3hK06ZNj4"; + mvnHash = "sha256-HF6BXeCnV5I7+oRVGK8DGHjaAtHWLfEaCwtkVcQHoGU"; inherit (final) maven; }; diff --git a/scripts/update-scala-kore.sh b/scripts/update-scala-kore.sh new file mode 100755 index 000000000..9afe340db --- /dev/null +++ b/scripts/update-scala-kore.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +SCALA_KORE_VERSION="$(cat matching/deps/scala_kore_release)" +changed=false + +sed -i 's!^ .*$! '"${SCALA_KORE_VERSION}"'!' matching/pom.xml +if git add matching/pom.xml && git commit -m "matching: update scala-kore to ${SCALA_KORE_VERSION}"; then + changed=true +fi + +if [ "${changed}" = "true" ]; then + sed -i 's! mvnHash = "sha256-.*";! mvnHash = "";!' nix/overlay.nix + (git add nix/overlay.nix && git commit -m "nix: invalidate maven packages hash") || true +fi