Skip to content

Commit

Permalink
Restore ability to update libs
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Oct 29, 2024
1 parent db8f6f1 commit b58d209
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 24 deletions.
31 changes: 9 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ jobs:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
scala: [2.13, 3]
os: [ubuntu-latest, macos-latest, macos-13]
scala: [3]
java: [temurin@11]
project: [rootJVM]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt
uses: sbt/setup-sbt@v1

- name: Checkout current branch (full)
uses: actions/checkout@v4
Expand Down Expand Up @@ -78,11 +77,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p bindingsPython/.jvm/target core/.jvm/target sbtPlugin/.jvm/target project/target
run: mkdir -p bindingsPython/.jvm/target core/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar bindingsPython/.jvm/target core/.jvm/target sbtPlugin/.jvm/target project/target
run: tar cf targets.tar bindingsPython/.jvm/target core/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -102,8 +101,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt
uses: sbt/setup-sbt@v1

- name: Checkout current branch (full)
uses: actions/checkout@v4
Expand All @@ -123,16 +121,6 @@ jobs:
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (2.13, rootJVM)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM

- name: Inflate target directories (2.13, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3, rootJVM)
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -169,16 +157,15 @@ jobs:

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
if: github.event.repository.fork == false && github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt
uses: sbt/setup-sbt@v1

- name: Checkout current branch (full)
uses: actions/checkout@v4
Expand All @@ -201,5 +188,5 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: rootjs_2.13 rootjs_3 rootjvm_2.13 rootjvm_3 rootnative_2.13 rootnative_3 tests_2.13 tests_3
modules-ignore: rootjs_3 rootjvm_3 rootnative_3 tests_3
configs-ignore: test scala-tool scala-doc-tool test-internal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ ThisBuild / startYear := Some(2022)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(tlGitHubDev("kubukoz", "Jakub Kozłowski"))
ThisBuild / sonatypeCredentialHost := Sonatype.sonatype01
ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest")
ThisBuild / githubWorkflowOSes := Seq(
"ubuntu-latest", // x86
"macos-latest", // arm64
"macos-13", // x64
)

ThisBuild / tlJdkRelease := Some(11)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,37 @@
devShells.default = pkgs.mkShell {
packages = [ pkgs.sbt ];
};

packages.tree-sitter = pkgs.stdenv.mkDerivation {
name = "tree-sitter";
src = pkgs.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter";
rev = "v0.24.3";
sha256 = "sha256-2Pg4D1Pf1Ex6ykXouAJvD1NVfg5CH4rCQcSTAJmYwd4=";
};
buildPhase = "make";
installPhase = if system == "x86_64-darwin" || system == "aarch64-darwin" then ''
cp libtree-sitter.dylib $out
'' else ''
cp libtree-sitter.so $out
'';
};

packages.tree-sitter-python = pkgs.stdenv.mkDerivation {
name = "tree-sitter-python";
src = pkgs.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-python";
rev = "v0.23.2";
sha256 = "sha256-cOBG2xfFJ0PpR1RIKW1GeeNeOBA9DAP/N4RXRGYp3yw=";
};
buildPhase = "make";
installPhase = if system == "x86_64-darwin" || system == "aarch64-darwin" then ''
cp libtree-sitter-python.dylib $out
'' else ''
cp libtree-sitter-python.so $out
'';
};
});
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.0
sbt.version=1.10.3
46 changes: 46 additions & 0 deletions update-libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

set -e

# core
mkdir -p core/.jvm/src/main/resources/darwin-aarch64
BINARY_PATH=$(nix build .#packages.aarch64-darwin.tree-sitter --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH core/.jvm/src/main/resources/darwin-aarch64/libtree-sitter.dylib
chmod 755 core/.jvm/src/main/resources/darwin-aarch64/libtree-sitter.dylib
mkdir -p core/.jvm/src/main/resources/darwin-x86-64
BINARY_PATH=$(nix build .#packages.x86_64-darwin.tree-sitter --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH core/.jvm/src/main/resources/darwin-x86-64/libtree-sitter.dylib
chmod 755 core/.jvm/src/main/resources/darwin-x86-64/libtree-sitter.dylib
mkdir -p core/.jvm/src/main/resources/linux-aarch64
BINARY_PATH=$(nix build .#packages.aarch64-linux.tree-sitter --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH core/.jvm/src/main/resources/linux-aarch64/libtree-sitter.so
chmod 755 core/.jvm/src/main/resources/linux-aarch64/libtree-sitter.so
mkdir -p core/.jvm/src/main/resources/linux-x86-64
BINARY_PATH=$(nix build .#packages.x86_64-linux.tree-sitter --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH core/.jvm/src/main/resources/linux-x86-64/libtree-sitter.so
chmod 755 core/.jvm/src/main/resources/linux-x86-64/libtree-sitter.so
# bindingsPython
mkdir -p bindingsPython/.jvm/src/main/resources/darwin-aarch64
BINARY_PATH=$(nix build .#packages.aarch64-darwin.tree-sitter-python --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH bindingsPython/.jvm/src/main/resources/darwin-aarch64/libtree-sitter-python.dylib
chmod 755 bindingsPython/.jvm/src/main/resources/darwin-aarch64/libtree-sitter-python.dylib
mkdir -p bindingsPython/.jvm/src/main/resources/darwin-x86-64
BINARY_PATH=$(nix build .#packages.x86_64-darwin.tree-sitter-python --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH bindingsPython/.jvm/src/main/resources/darwin-x86-64/libtree-sitter-python.dylib
chmod 755 bindingsPython/.jvm/src/main/resources/darwin-x86-64/libtree-sitter-python.dylib
mkdir -p bindingsPython/.jvm/src/main/resources/linux-aarch64
BINARY_PATH=$(nix build .#packages.aarch64-linux.tree-sitter-python --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH bindingsPython/.jvm/src/main/resources/linux-aarch64/libtree-sitter-python.so
chmod 755 bindingsPython/.jvm/src/main/resources/linux-aarch64/libtree-sitter-python.so
mkdir -p bindingsPython/.jvm/src/main/resources/linux-x86-64
BINARY_PATH=$(nix build .#packages.x86_64-linux.tree-sitter-python --no-link --print-out-paths --print-build-logs)
cp $BINARY_PATH bindingsPython/.jvm/src/main/resources/linux-x86-64/libtree-sitter-python.so
chmod 755 bindingsPython/.jvm/src/main/resources/linux-x86-64/libtree-sitter-python.so

0 comments on commit b58d209

Please sign in to comment.