Skip to content

Commit

Permalink
Revert "Revert "Set LLVM backend up to receive automatic updates from…
Browse files Browse the repository at this point in the history
… scala-kore"" (#1012)

Reverts #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
#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.
  • Loading branch information
Baltoli authored Mar 12, 2024
1 parent 30324a4 commit a071f0f
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-flake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
@@ -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 [email protected]
- name: 'Update scala-kore release tag'
run: ./scripts/update-scala-kore.sh

- name: 'Push updates'
run: git push
1 change: 1 addition & 0 deletions matching/deps/scala_kore_release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.0
38 changes: 31 additions & 7 deletions matching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.runtimeverification.k</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../../../../..</relativePath>
</parent>
<groupId>com.runtimeverification.k</groupId>
<artifactId>llvm-backend-matching</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>K Framework LLVM Backend Pattern Matching</name>

<properties>
<java.version>17</java.version>
<scala-kore.version>0.3.0</scala-kore.version>
<spotless.version>2.41.1</spotless.version>
<scala.majorVersion>2.12</scala.majorVersion>
<scala.minorVersion>18</scala.minorVersion>
<scala.version>${scala.majorVersion}.${scala.minorVersion}</scala.version>
<scalafmt.version>3.7.17</scalafmt.version>
</properties>

<repositories>
<repository>
<id>runtime.verification</id>
Expand All @@ -32,10 +38,20 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>com.runtimeverification.k</groupId>
<artifactId>scala-kore</artifactId>
<version>0.3.0</version>
<version>${scala-kore.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand Down Expand Up @@ -63,6 +79,14 @@

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions nix/llvm-backend-matching.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
16 changes: 16 additions & 0 deletions scripts/update-scala-kore.sh
Original file line number Diff line number Diff line change
@@ -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>.*</scala-kore.version>$! <scala-kore.version>'"${SCALA_KORE_VERSION}"'</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

0 comments on commit a071f0f

Please sign in to comment.