From f5081fa5bf840f92fd6ecf987e670efca31cbb60 Mon Sep 17 00:00:00 2001 From: Sam Gammon Date: Mon, 15 Jul 2024 02:25:35 -0700 Subject: [PATCH] feat: entrypoint work pt 4 (#1084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: entrypoint work pt 4 - feat(base): optimized rust routines for encodings - feat(base): build under `no_std` - feat(model): `model` crate initial structure - feat(sqlite): implement rust sqlite api layer - feat(project): new project crate - fix: sqlite symbol access from umbrella - fix: don't strip cargo outputs - fix: many fixes for `builder` crates - fix: don't move around third party libs - fix: clean for zlib and sqlite - fix: sqlite build flags aren't making it in - fix: rename `core` crate to `base` - fix: dynamic/static library builds for crates - fix(sqlite): loading of native sqlite libs in native image - chore: run `cargo test` with `make test` - chore: add some basic jvm and native encoding benchmarks - chore: merge `cli-bridge` module into `cli` - chore: rewrite `CliNativeBridge` in kotlin - chore: initial build wiring for protocol models in rust - chore: makefile support for ccache and sccache - chore: `cargo fuzz` support - chore: run `cargo update` - chore: run clippy - chore: run fmt - chore: update module pins, baselines - chore: update verification metadata + lockfiles - chore: update kotlinx benchmark → `0.4.11` - chore: update gradle → `8.9` - chore: update kotlin → `2.0.10-RC` - chore: update ksp → `2.0.10-RC-1.0.23` Signed-off-by: Sam Gammon * feat: first use of new entrypoint, set ELIDE_EXPERIMENTAL to try Signed-off-by: Sam Gammon * fix: python/shell build and init params Signed-off-by: Sam Gammon * fix: language aliases should trigger engine init for langs Signed-off-by: Sam Gammon * fix: detect version of graalpy/python for home paths Signed-off-by: Sam Gammon * chore: `base` crate prelude/smartstring support Signed-off-by: Sam Gammon * fix: consistent language init, engine lang support from args Signed-off-by: Sam Gammon * feat: initial project, protocol, deps crate structures Signed-off-by: Sam Gammon * chore: wiring for rust coverage in makefile/scripts Signed-off-by: Sam Gammon * chore: cargo update/relock Signed-off-by: Sam Gammon * chore: wire native tests into ci Signed-off-by: Sam Gammon * chore: update detekt baseline for `cli` module Signed-off-by: Sam Gammon * chore: run fmt Signed-off-by: Sam Gammon * fix: coverage report overwrite with json Signed-off-by: Sam Gammon * chore: native coverage reporting in ci Signed-off-by: Sam Gammon * chore: `make check` task Signed-off-by: Sam Gammon * chore: continued rust coverage/python support in ci Signed-off-by: Sam Gammon * chore: ci refactors for native layer build steps Signed-off-by: Sam Gammon * chore: run fmt, small build nits Signed-off-by: Sam Gammon * chore: clean natives on `make clean` Signed-off-by: Sam Gammon * chore: force deps to build for `make test` or `make check` Signed-off-by: Sam Gammon * chore: more build/ci fixes Signed-off-by: Sam Gammon * chore: task to enforce native lib existence before tests Signed-off-by: Sam Gammon * fix: pip install during ci test Signed-off-by: Sam Gammon * fix: yeet extra profiles after running jvm tests Signed-off-by: Sam Gammon * fix: build `third-party` before running tests in ci Signed-off-by: Sam Gammon * chore: add llvm install step to ci Signed-off-by: Sam Gammon * fix: rust coverage depends on `llvm-profdata` Signed-off-by: Sam Gammon * chore: ci support for rust checks, biome Signed-off-by: Sam Gammon * chore: name nits Signed-off-by: Sam Gammon * chore: adjust what runs in draft mode in ci Signed-off-by: Sam Gammon * fix: llvm version in ci Signed-off-by: Sam Gammon * chore: package of build consistency and reliability fixes Signed-off-by: Sam Gammon * chore(deps): Bump actions/download-artifact from 4.1.7 to 4.1.8 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.7 to 4.1.8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/65a9edc5881444af0b9093a5e628f2fe47ea3b2e...fa0a91b85d4f404e444e00e005971372dc801d16) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: Sam Gammon * chore(deps): Bump docker/setup-buildx-action from 3.3.0 to 3.4.0 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.3.0 to 3.4.0. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/d70bba72b1f3fd22344832f00baa16ece964efeb...4fd812986e6c8c2a69e18311145f9371337f27d4) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: Sam Gammon * chore(deps): Bump docker/setup-qemu-action from 3.0.0 to 3.1.0 Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 3.0.0 to 3.1.0. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/68827325e0b33c7199eb31dd4e31fbe9023e06e3...5927c834f5b4fdf503fca6f4c7eccda82949e1ee) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: Sam Gammon * chore(deps): Bump actions/upload-artifact from 4.3.3 to 4.3.4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/65462800fd760344b1a7b4382951275a0abb4808...0b2256b8c012f0828dc542b3febcab082c67f72b) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: Sam Gammon * chore: clippy/fmt Signed-off-by: Sam Gammon --------- Signed-off-by: Sam Gammon Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .cargo/config.aarch64.toml | 4 + .cargo/config.macos-aarch64.toml | 4 + .cargo/config.nightly.toml | 2 +- .cargo/config.toml | 25 +- .cargo/config.x86_64.toml | 4 + .gitattributes | 1 - .github/CONTRIBUTING.md | 37 +- .github/codecov.yml | 1 + .github/codeql/codeql-config.yml | 2 + .github/dependabot.yml | 203 +--- .github/workflows/checks.apicheck.yml | 2 +- .github/workflows/checks.clippy.yml | 58 ++ .github/workflows/checks.codeql.yml | 2 +- .github/workflows/checks.detekt.yml | 12 +- .github/workflows/checks.formatting.yml | 45 +- .github/workflows/checks.qodana.yml | 2 +- .github/workflows/checks.rustfmt.yml | 49 + .github/workflows/checks.scorecards.yml | 2 +- .github/workflows/checks.sonar.yml | 2 +- .github/workflows/job.build.yml | 94 +- .github/workflows/job.cli.yml | 12 +- .github/workflows/job.containers.yml | 8 +- .github/workflows/job.site.yml | 18 +- .github/workflows/job.test.yml | 331 +++--- .github/workflows/on.pr.yml | 28 +- .github/workflows/on.scheduled.yml | 4 +- .gitignore | 1 + .prettierignore | 2 + .rustfmt.toml | 3 + Cargo.lock | 948 +++++++++++++++--- Cargo.toml | 72 +- Makefile | 268 ++++- biome.jsonc | 18 +- buf.work.yaml | 1 - build.gradle.kts | 21 +- buildscript-gradle.lockfile | 8 +- crates/base/Cargo.toml | 43 + crates/{core/src/lib.rs => base/build.rs} | 15 +- crates/base/src/b64.rs | 564 +++++++++++ crates/base/src/crc.rs | 99 ++ crates/base/src/hex.rs | 14 + crates/base/src/lib.rs | 44 + crates/base/src/prelude.rs | 19 + crates/base/src/rng.rs | 14 + crates/base/src/sha.rs | 14 + crates/base/src/utf.rs | 14 + crates/base/src/uuid.rs | 14 + crates/builder/Cargo.toml | 4 +- crates/builder/src/lib.rs | 825 +++++++-------- crates/deps/Cargo.toml | 15 +- crates/deps/src/catalog.rs | 66 ++ crates/deps/src/lib.rs | 20 +- crates/deps/src/model.rs | 255 +++++ crates/entry/Cargo.toml | 3 + crates/entry/src/bin/elide.rs | 16 +- crates/entry/src/lib.rs | 12 + crates/model/Cargo.toml | 21 +- crates/model/build.rs | 45 + crates/model/src/features.rs | 121 +++ crates/model/src/lang.rs | 101 ++ crates/model/src/lib.rs | 245 ++++- crates/{core => project}/Cargo.toml | 14 +- crates/project/src/config.rs | 50 + crates/project/src/current.rs | 87 ++ crates/project/src/lib.rs | 23 + crates/protocol/Cargo.toml | 34 + crates/protocol/build.rs | 1 + crates/protocol/src/lib.rs | 17 + crates/sqlite/Cargo.toml | 4 +- crates/sqlite/build.rs | 164 +-- crates/sqlite/headers/NativeDB.h | 145 +-- crates/sqlite/src/NativeDB.c | 146 ++- crates/sqlite/src/lib.rs | 905 ++++++++++++++++- crates/substrate/Cargo.toml | 1 + crates/substrate/build.rs | 11 +- crates/substrate/src/lib.rs | 10 +- crates/terminal/build.rs | 85 +- crates/terminal/src/lib.rs | 10 +- crates/transport/build.rs | 194 ++-- crates/transport/src/lib.rs | 11 +- elide.toml | 5 + fuzz/.gitignore | 4 + fuzz/Cargo.toml | 21 + fuzz/fuzz_targets/fuzz_target_1.rs | 7 + gradle.properties | 3 - gradle/elide.versions.toml | 22 +- gradle/verification-metadata.xml | 23 + gradle/wrapper/gradle-wrapper.jar | Bin 43453 -> 43504 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 5 +- gradlew.bat | 2 + package.json | 4 +- packages/base/build.gradle.kts | 3 +- packages/cli-bridge/api/cli-bridge.api | 5 - packages/cli-bridge/build.gradle.kts | 104 -- packages/cli-bridge/gradle.lockfile | 12 - .../dev/elide/cli/bridge/CliNativeBridge.java | 47 - .../dev/elide/cli/bridge/NativeSubstrate.kt | 15 - .../kotlin/dev/elide/cli/tooling/api/model.kt | 61 -- .../kotlin/dev/elide/cli/tooling/api/suite.kt | 48 - .../dev_elide_cli_bridge_CliNativeBridge.h | 53 - .../cli-bridge/src/main/public/umbrella.h | 35 - packages/cli/build.gradle.kts | 79 +- packages/cli/detekt-baseline.xml | 11 +- packages/cli/gradle.lockfile | 37 +- .../resource-config-darwin-aarch64.json | 64 +- .../config/resource-config-darwin-amd64.json | 54 +- .../config/resource-config-linux-aarch64.json | 43 +- .../config/resource-config-linux-amd64.json | 43 +- .../resource-config-windows-aarch64.json | 43 +- .../config/resource-config-windows-amd64.json | 43 +- .../dev/elide/cli/bridge/CliNativeBridge.kt | 60 ++ .../elide/tool/cli/AbstractSubcommand.kt | 62 +- .../elide/tool/cli/AbstractToolCommand.kt | 4 +- .../src/main/kotlin/elide/tool/cli/Elide.kt | 6 +- .../tool/cli/cmd/repl/ToolShellCommand.kt | 56 +- .../tool/cli/cmd/tool/ToolInvokeCommand.kt | 2 +- .../src/main/kotlin/elide/tool/cli/main.kt | 80 +- .../kotlin/elide/tool/engine/NativeEngine.kt | 23 - .../tool/feature/ToolingUmbrellaFeature.kt | 9 - packages/core/build.gradle.kts | 14 + .../core/src/jvmMain/kotlin/module-info.java | 2 +- packages/core/src/jvmTest/kotlin/.gitkeep | 0 packages/engine/api/engine.api | 2 + packages/engine/gradle.lockfile | 20 +- .../runtime/plugins/AbstractLanguagePlugin.kt | 5 +- packages/graalvm-java/gradle.lockfile | 20 +- packages/graalvm-jvm/gradle.lockfile | 20 +- packages/graalvm-kt/gradle.lockfile | 38 +- packages/graalvm-llvm/gradle.lockfile | 20 +- packages/graalvm-py/gradle.lockfile | 20 +- .../elide/runtime/plugins/python/Python.kt | 21 +- .../embedded/runtime/python/environment.py | 22 +- packages/graalvm-rb/gradle.lockfile | 20 +- packages/graalvm-ts/gradle.lockfile | 20 +- packages/graalvm-wasm/gradle.lockfile | 20 +- packages/graalvm/api/graalvm.api | 6 + packages/graalvm/build.gradle.kts | 38 +- packages/graalvm/gradle.lockfile | 36 +- .../graalvm/src/benchmarks/kotlin/.gitkeep | 0 .../kotlin/elide/core/EncodingsBench.kt | 55 + .../AbstractStaticNativeLibraryFeature.kt | 21 +- .../feature/engine/NativeSQLiteFeature.kt | 20 +- packages/proto/proto-capnp/gradle.lockfile | 20 +- packages/proto/proto-core/build.gradle.kts | 1 - packages/proto/proto-core/gradle.lockfile | 42 - packages/proto/proto-kotlinx/build.gradle.kts | 11 - packages/proto/proto-kotlinx/gradle.lockfile | 22 +- packages/proto/proto-protobuf/gradle.lockfile | 22 +- packages/server/gradle.lockfile | 42 +- .../java/org/sqlite/SQLiteJDBCLoader.java | 18 +- packages/uuid | 2 +- requirements.txt | 2 +- .../react-ssr/server/build.gradle.kts | 2 +- settings.gradle.kts | 38 +- third_party/Makefile | 106 +- .../kotlin/dev.elide.build.kotlin.gradle.kts | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../elide/internal/conventions/Constants.kt | 3 +- .../linting/DetektConventionsPlugin.kt | 4 +- .../linting/SonarConventionsPlugin.kt | 29 +- .../gradle/kotlin/dsl/ElideConventionsDsl.kt | 53 + tools/plugin/gradle-plugin/build.gradle.kts | 2 +- .../gradle-plugin/gradle/libs.versions.toml | 2 +- .../plugin-build/buildSrc/build.gradle.kts | 2 +- tools/scripts/bench-cli.sh | 13 + tools/scripts/bench-common.sh | 13 + tools/scripts/bench-server.sh | 13 + tools/scripts/build-release-debug.sh | 13 + tools/scripts/build-release-opt.sh | 13 + tools/scripts/build-releases.sh | 13 + tools/scripts/cargo-coverage-report.sh | 64 ++ tools/scripts/cargo-coverage-show.sh | 38 + tools/scripts/cargo-test-coverage.sh | 43 + tools/scripts/llvm-linux.sh | 13 + tools/scripts/macos-linker.sh | 13 + tools/scripts/stamp-releases.sh | 13 + tools/scripts/train-pgo.sh | 13 + tools/umbrella/Cargo.toml | 14 +- tools/umbrella/build.rs | 18 +- tools/umbrella/src/diagnostics.rs | 40 +- tools/umbrella/src/lib.rs | 441 ++++---- tools/umbrella/src/nativetransport.rs | 6 +- tools/umbrella/src/tools.rs | 70 +- 184 files changed, 6967 insertions(+), 2773 deletions(-) create mode 100644 .github/workflows/checks.clippy.yml create mode 100644 .github/workflows/checks.rustfmt.yml create mode 100644 .rustfmt.toml create mode 100644 crates/base/Cargo.toml rename crates/{core/src/lib.rs => base/build.rs} (73%) create mode 100644 crates/base/src/b64.rs create mode 100644 crates/base/src/crc.rs create mode 100644 crates/base/src/hex.rs create mode 100644 crates/base/src/lib.rs create mode 100644 crates/base/src/prelude.rs create mode 100644 crates/base/src/rng.rs create mode 100644 crates/base/src/sha.rs create mode 100644 crates/base/src/utf.rs create mode 100644 crates/base/src/uuid.rs create mode 100644 crates/deps/src/catalog.rs create mode 100644 crates/deps/src/model.rs create mode 100644 crates/entry/src/lib.rs create mode 100644 crates/model/build.rs create mode 100644 crates/model/src/features.rs create mode 100644 crates/model/src/lang.rs rename crates/{core => project}/Cargo.toml (72%) create mode 100644 crates/project/src/config.rs create mode 100644 crates/project/src/current.rs create mode 100644 crates/project/src/lib.rs create mode 100644 crates/protocol/Cargo.toml create mode 100644 crates/protocol/build.rs create mode 100644 crates/protocol/src/lib.rs create mode 100644 elide.toml create mode 100644 fuzz/.gitignore create mode 100644 fuzz/Cargo.toml create mode 100644 fuzz/fuzz_targets/fuzz_target_1.rs delete mode 100644 packages/cli-bridge/api/cli-bridge.api delete mode 100644 packages/cli-bridge/build.gradle.kts delete mode 100644 packages/cli-bridge/gradle.lockfile delete mode 100644 packages/cli-bridge/src/main/java/dev/elide/cli/bridge/CliNativeBridge.java delete mode 100644 packages/cli-bridge/src/main/kotlin/dev/elide/cli/bridge/NativeSubstrate.kt delete mode 100644 packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/model.kt delete mode 100644 packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/suite.kt delete mode 100644 packages/cli-bridge/src/main/public/dev_elide_cli_bridge_CliNativeBridge.h delete mode 100644 packages/cli-bridge/src/main/public/umbrella.h create mode 100644 packages/cli/src/main/kotlin/dev/elide/cli/bridge/CliNativeBridge.kt delete mode 100644 packages/core/src/jvmTest/kotlin/.gitkeep delete mode 100644 packages/graalvm/src/benchmarks/kotlin/.gitkeep create mode 100644 packages/graalvm/src/benchmarks/kotlin/elide/core/EncodingsBench.kt delete mode 100644 packages/proto/proto-core/gradle.lockfile create mode 100755 tools/scripts/cargo-coverage-report.sh create mode 100755 tools/scripts/cargo-coverage-show.sh create mode 100755 tools/scripts/cargo-test-coverage.sh diff --git a/.cargo/config.aarch64.toml b/.cargo/config.aarch64.toml index 552bd0e49e..3392c06765 100644 --- a/.cargo/config.aarch64.toml +++ b/.cargo/config.aarch64.toml @@ -13,6 +13,10 @@ [build] rustflags = [ + # Enable Tokio unstable. + "--cfg", + "tokio_unstable", + # Enables access to unstable options. "-Zunstable-options", diff --git a/.cargo/config.macos-aarch64.toml b/.cargo/config.macos-aarch64.toml index 5327f4cb37..37cbe40f3f 100644 --- a/.cargo/config.macos-aarch64.toml +++ b/.cargo/config.macos-aarch64.toml @@ -13,6 +13,10 @@ [build] rustflags = [ + # Enable Tokio unstable. + "--cfg", + "tokio_unstable", + # Use clang to drive linking via linker plugins, with lld as the linker. Wire in the linker script which fixes LTO # arguments via linker plugins. "-Clinker=$CARGO_MANIFEST_DIR/tools/scripts/macos-linker.sh", diff --git a/.cargo/config.nightly.toml b/.cargo/config.nightly.toml index 780e7fba28..4de40929d2 100644 --- a/.cargo/config.nightly.toml +++ b/.cargo/config.nightly.toml @@ -13,7 +13,7 @@ [build] # See main config for docs on each flag. -rustflags = ["-Zunstable-options", "-Zbranch-protection=bti,pac-ret", "-Zbuild-std"] +rustflags = ["--cfg", "tokio_unstable", "-Zunstable-options", "-Zbranch-protection=bti,pac-ret", "-Zbuild-std"] [unstable] build-std = ["core", "alloc", "test", "proc_macro"] diff --git a/.cargo/config.toml b/.cargo/config.toml index d2f1bcf3ad..83e72fce0f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -12,16 +12,23 @@ # [build] -rustflags = [] +rustflags = [ + # Enable Tokio unstable. + "--cfg", + "tokio_unstable", + + # Enforce completely position-independent executables. + "-Crelocation-model=pic", + + # Enables access to unstable options. + "-Zunstable-options", + + # Enable multithreaded compiler frontend. + "-Zthreads=8", +] [env] ELIDE_ROOT = { value = ".", relative = true } -INCLUDE = { value = "target/include", relative = true } -LIB = { value = "target/lib", relative = true } SQLITE3_STATIC = { value = "1" } -BORING_BSSL_PATH = { value = "target/lib/boringssl", relative = true } -BORING_BSSL_INCLUDE_PATH = { value = "target/include", relative = true } -OPENSSL_LIB_DIR = { value = "target/lib", relative = true } -OPENSSL_INCLUDE_DIR = { value = "target/include", relative = true } -SQLITE3_LIB_DIR = { value = "target/lib", relative = true } -SQLITE3_INCLUDE_DIR = { value = "target/include", relative = true } +SQLITE3_LIB_DIR = { value = "third_party/sqlite/install/lib", relative = true } +SQLITE3_INCLUDE_DIR = { value = "third_party/sqlite/install/include", relative = true } diff --git a/.cargo/config.x86_64.toml b/.cargo/config.x86_64.toml index f9b86a061d..a1342d4cf4 100644 --- a/.cargo/config.x86_64.toml +++ b/.cargo/config.x86_64.toml @@ -13,6 +13,10 @@ [build] rustflags = [ + # Enable Tokio unstable. + "--cfg", + "tokio_unstable", + # Enables access to unstable options. "-Zunstable-options", diff --git a/.gitattributes b/.gitattributes index dba91e87ad..402b981519 100644 --- a/.gitattributes +++ b/.gitattributes @@ -53,4 +53,3 @@ packages/*/packaging/** -linguist-detectable .github/** -linguist-detectable .devcontainer/Dockerfile -linguist-detectable .devcontainer/*/Dockerfile -linguist-detectable - diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 796cf29132..b5659c1cb2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -8,41 +8,72 @@ The following guide should help you get started and submit a PR. Follow the directions in the main [README](../README.md). You will need a recent copy of GraalVM for Java 20, and several other components. Once you have these installed, you can try the `Makefile`: +### Notable tasks + +- `make info`: Show build environment +- `make build`: Build all targets +- `make test`: Build all targets, run all tests +- `make check`: Build all targets, run all tests, run all checks +- `make native`: Build the native binary for the CLI +- `make natives`: Rebuild native dependencies +- `make help`: Show all make tasks + +### All tasks + ``` $ make help Elide: api-check Check API/ABI compatibility with current changes. build Build the main library, and code-samples if SAMPLES=yes. +check Build all targets, run all tests, run all checks. clean-cli Clean built CLI targets. clean-docs Clean documentation targets. -clean-site Clean site targets. +clean-natives Clean local native targets. clean Clean build outputs and caches. cli-local Build the Elide command line tool and install it locally (into ~/bin, or LOCAL_CLI_INSTALL_DIR). cli-release Build an Elide command-line release. cli Build the Elide command-line tool (native target). +dependency-packages Print the suite of dependencies to install for this OS. distclean DANGER: Clean and remove any persistent caches. Drops changes. docs Generate docs for all library modules. +fmt Run all formatter tools. forceclean DANGER: Clean, distclean, and clear untracked files. +format Alias for `make fmt`. +gvm Build a custom copy of GraalVM for use locally. help Show this help text ('make help'). image-base-alpine Build base Alpine image. image-base Build base Ubuntu image. image-gvm17 Build GVM17 builder image. +image-gvm21 Build GVM21 builder image. +image-gvm22 Build GVM22 builder image. image-jdk17 Build JDK17 builder image. +image-jdk21 Build JDK21 builder image. +image-jdk22 Build JDK20 builder image. image-native-alpine Build native Alpine base image. image-native Build native Ubuntu base image. image-runtime-jvm17 Build runtime GVM17 builder image. +image-runtime-jvm21 Build runtime GVM21 builder image. +image-runtime-jvm22 Build runtime GVM22 builder image. images Build all Docker images. +info Show info about the current codebase and toolchain. model-update Update the proto model and re-build it. model Build proto model targets. +native Build Elide's native image target; use BUILD_MODE=release for a release binary. +natives-coverage Show the current native coverage report; only run if `natives-test` is run first. +natives-test Run Cargo and native tests, optionally buildin coverage if COVERAGE=yes. +natives Rebuild natives (C/C++ and Rust). publish Publish a new version of all Elide packages. release Perform a full release, including publishing to Maven Central and the Elide repository. relock-deps Update dependency locks and hashes across Yarn and Gradle. reports Generate reports for tests, coverage, etc. +runtime-build Build the JS runtime facade and the builtin modules bundle +runtime-update Rebuild and copy the JS runtime facade +runtime Build and update the JS runtime if needed. serve-docs Serve documentation locally. -serve-site Serve Elide site locally. -site Generate the static Elide website. +setup Setup development pre-requisites. test Run the library testsuite, and code-sample tests if SAMPLES=yes. third-party Build all third-party embedded projects. +umbrella Build the native umbrella tooling library. update-deps Perform interactive dependency upgrades across Yarn and Gradle. update-jdeps Interactively update Gradle dependencies. update-jsdeps Interactively update Yarn dependencies. diff --git a/.github/codecov.yml b/.github/codecov.yml index 88034ceeae..5bc56829c7 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -73,3 +73,4 @@ ignore: - "packages/cli-bridge/**/*.*" - "packages/graalvm-ts/src/main/java/elide/runtime/lang/typescript/TypeScriptModuleLoader.java" - "packages/graalvm-ts/src/main/java/elide/runtime/lang/typescript/TypeScriptFileTypeDetector.java" + - "crates/sqlite/src/lib.rs" diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml index d0431f713e..92c5c81d00 100644 --- a/.github/codeql/codeql-config.yml +++ b/.github/codeql/codeql-config.yml @@ -2,12 +2,14 @@ name: "CodeQL" languages: - javascript-typescript + - java-kotlin queries: - uses: security-and-quality paths: - packages + - crates paths-ignore: - .codebase diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 818b544f65..21047f4bf4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,246 +13,107 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - assignees: - - "sgammon" - - - package-ecosystem: "gradle" - directory: "/" - schedule: - interval: "daily" - assignees: - - "sgammon" - - - package-ecosystem: docker - directory: /.devcontainer - schedule: - interval: daily - - - package-ecosystem: npm + - package-ecosystem: github-actions directory: / schedule: - interval: daily + interval: weekly - - package-ecosystem: npm - directory: /packages/base + - package-ecosystem: cargo + directory: / schedule: interval: daily - - package-ecosystem: npm - directory: /packages/cli + - package-ecosystem: gradle + directory: / schedule: interval: daily - package-ecosystem: docker - directory: /packages/cli/packaging - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/cli/packaging/npm - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/core - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/frontend - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-js - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-react - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-react/src/main/node/emotion-server - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-react/src/main/node/stream - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/model - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/rpc - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/test + directory: /.devcontainer schedule: - interval: daily + interval: weekly - package-ecosystem: npm - directory: /site/docs/content + directory: / schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/base-alpine schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/base schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/builder schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/codespace schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/gvm11 + directory: /tools/images/gvm21 schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/gvm17 + directory: /tools/images/gvm22 schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/gvm20 + directory: /tools/images/jdk21 schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/jdk11 + directory: /tools/images/jdk22 schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/jdk17 - schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/jdk19 - schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/native-alpine schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/native schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/qodana-jvm + directory: /tools/images/runtime-jvm21 schedule: - interval: daily + interval: weekly - package-ecosystem: docker - directory: /tools/images/rbe + directory: /tools/images/runtime-jvm22 schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/runtime-jvm11 - schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/runtime-jvm17 - schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/runtime-jvm19 - schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/plugin/gradle-plugin/.devcontainer schedule: - interval: daily - - - package-ecosystem: npm - directory: /tools/plugin/gradle-plugin - schedule: - interval: daily - - - package-ecosystem: npm - directory: /tools/plugin/gradle-plugin/plugin-build/plugin/src/main/node/runtime/emotion-server - schedule: - interval: daily - - - package-ecosystem: npm - directory: /tools/plugin/gradle-plugin/plugin-build/plugin/src/main/node/runtime/stream - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-react/src/jsMain/node/emotion-server - schedule: - interval: daily - - - package-ecosystem: npm - directory: /packages/graalvm-react/src/jsMain/node/stream - schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/jdk20 - schedule: - interval: daily - - - package-ecosystem: docker - directory: /tools/images/runtime-jvm20 - schedule: - interval: daily - - - package-ecosystem: npm - directory: /tools/scripts - schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /.devcontainer/dev schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/bash schedule: - interval: daily + interval: weekly - package-ecosystem: docker directory: /tools/images/elide schedule: - interval: daily + interval: weekly diff --git a/.github/workflows/checks.apicheck.yml b/.github/workflows/checks.apicheck.yml index 8f3952b7c9..dfaef926e0 100644 --- a/.github/workflows/checks.apicheck.yml +++ b/.github/workflows/checks.apicheck.yml @@ -108,7 +108,7 @@ jobs: check-for-updates: false github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true diff --git a/.github/workflows/checks.clippy.yml b/.github/workflows/checks.clippy.yml new file mode 100644 index 0000000000..6277e7cbf9 --- /dev/null +++ b/.github/workflows/checks.clippy.yml @@ -0,0 +1,58 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +name: "Cargo - Clippy" + +"on": + workflow_dispatch: {} + workflow_call: {} + +permissions: + contents: read + +# Make sure CI fails on all warnings, including Clippy lints +env: + RUSTFLAGS: "-Dwarnings" + +jobs: + cargo-clippy: + name: Clippy + runs-on: ubuntu-latest + continue-on-error: true + permissions: + contents: read + steps: + - name: "Setup: Harden Runner" + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + disable-sudo: true + egress-policy: audit + - name: "Setup: Checkout" + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + persist-credentials: false + - name: "Setup: Rust" + uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 + with: + toolchain: nightly + components: clippy,rustfmt + rustflags: "-Dwarnings" + - name: "Setup: Rust Tooling" + run: cargo install clippy-sarif sarif-fmt + - name: "Checks: Clippy" + run: | + cargo clippy --all-targets --all-features --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt + - name: "Report: SARIF Upload" + uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 + with: + sarif_file: results.sarif diff --git a/.github/workflows/checks.codeql.yml b/.github/workflows/checks.codeql.yml index 84b6639c6f..1600abe86d 100644 --- a/.github/workflows/checks.codeql.yml +++ b/.github/workflows/checks.codeql.yml @@ -106,7 +106,7 @@ jobs: config-file: ./.github/codeql/codeql-config.yml languages: ${{ matrix.language }} - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true diff --git a/.github/workflows/checks.detekt.yml b/.github/workflows/checks.detekt.yml index f354c87f61..518e4c7c71 100644 --- a/.github/workflows/checks.detekt.yml +++ b/.github/workflows/checks.detekt.yml @@ -76,13 +76,13 @@ jobs: check-for-updates: false github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true - name: "Setup: Git History" run: git fetch --unshallow || exit 0 - - name: "Analysis: Detekt" + - name: "Setup: Gradle" uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 continue-on-error: true env: @@ -92,9 +92,11 @@ jobs: with: cache-read-only: true cache-encryption-key: ${{ secrets.GRADLE_CONFIGURATION_KEY }} - arguments: | - detekt - -x nativeCompile + - name: "Analysis: Detekt" + run: | + ./gradlew \ + detekt \ + -x nativeCompile \ -x nativeOptimizedCompile - name: "Report: SARIF Upload" uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 diff --git a/.github/workflows/checks.formatting.yml b/.github/workflows/checks.formatting.yml index f5406cfc51..caec434ee7 100644 --- a/.github/workflows/checks.formatting.yml +++ b/.github/workflows/checks.formatting.yml @@ -87,6 +87,12 @@ jobs: uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: 22 + - name: "Setup: GraalVM (Java 22)" + uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1.2.2 + with: + distribution: "graalvm" + java-version: "22" + github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: PNPM" uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 with: @@ -96,21 +102,13 @@ jobs: args: [--frozen-lockfile, --strict-peer-dependencies] - name: "Setup: Yarn" run: pnpm install -g yarn@1.22.19 - - name: "Setup: GraalVM (Java 22)" - uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1.2.2 - with: - distribution: "graalvm" - java-version: 22 - check-for-updates: false - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 - continue-on-error: true + - name: "Setup: Rust" + uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 with: - merge-multiple: true - - name: "Analysis: Formatting (Prettier)" - run: pnpm run prettier --check . - - name: "Analysis: Formatting (Spotless)" + toolchain: nightly + components: clippy,rustfmt + rustflags: "-Dwarnings" + - name: "Setup: Gradle" uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 continue-on-error: ${{ inputs.ignore_failures }} env: @@ -120,7 +118,20 @@ jobs: with: cache-read-only: true cache-encryption-key: ${{ secrets.GRADLE_CONFIGURATION_KEY }} - arguments: | - spotlessCheck - -x nativeCompile + - name: "Setup: Artifacts" + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + continue-on-error: true + with: + merge-multiple: true + - name: "Analysis: Formatting (Prettier)" + run: pnpm run prettier --check . + - name: "Analysis: Formatting (Biome)" + run: pnpm biome check . + - name: "Analysis: Formatting (Cargo)" + run: cargo fmt -- --check + - name: "Analysis: Formatting (Spotless)" + run: | + ./gradlew \ + spotlessCheck \ + -x nativeCompile \ -x nativeOptimizedCompile diff --git a/.github/workflows/checks.qodana.yml b/.github/workflows/checks.qodana.yml index 4b6ad7205d..2e5ca12cef 100644 --- a/.github/workflows/checks.qodana.yml +++ b/.github/workflows/checks.qodana.yml @@ -67,7 +67,7 @@ jobs: check-for-updates: false github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true diff --git a/.github/workflows/checks.rustfmt.yml b/.github/workflows/checks.rustfmt.yml new file mode 100644 index 0000000000..da9e9bdac9 --- /dev/null +++ b/.github/workflows/checks.rustfmt.yml @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +name: "Cargo - Fmt" + +"on": + workflow_dispatch: {} + workflow_call: {} + +permissions: + contents: read + +jobs: + rust-fmt: + name: Cargo Format + runs-on: ubuntu-latest + continue-on-error: true + permissions: + actions: read + contents: read + security-events: write + steps: + - name: "Setup: Harden Runner" + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + disable-sudo: true + egress-policy: audit + - name: "Setup: Checkout" + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + persist-credentials: false + - name: "Setup: Rust" + uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 + with: + toolchain: nightly + components: clippy,rustfmt + rustflags: "-Dwarnings" + - name: "Checks: Rust Formatting" + run: cargo fmt -- --check diff --git a/.github/workflows/checks.scorecards.yml b/.github/workflows/checks.scorecards.yml index d9a9051d5b..f81f3466ea 100644 --- a/.github/workflows/checks.scorecards.yml +++ b/.github/workflows/checks.scorecards.yml @@ -64,7 +64,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Artifact: Scorecard Analysis" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: SARIF file path: results.sarif diff --git a/.github/workflows/checks.sonar.yml b/.github/workflows/checks.sonar.yml index 7f9347f2a0..03f2d4930e 100644 --- a/.github/workflows/checks.sonar.yml +++ b/.github/workflows/checks.sonar.yml @@ -83,7 +83,7 @@ jobs: check-for-updates: false github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index dc2d2b2fe9..3c9972fc4d 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -241,10 +241,8 @@ jobs: - name: "Setup: Rust" uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 with: - toolchain: stable - target: wasm32-wasi + toolchain: nightly components: clippy,rustfmt - cache: false rustflags: "" - name: "Setup: SCCache" uses: mozilla-actions/sccache-action@89e9040de88b577a072e3760aaf59f585da083af # v0.0.5 @@ -258,6 +256,10 @@ jobs: distribution: "graalvm" java-version: "22" github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "Setup: Python (3.12)" + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: 3.12 - name: "Setup: Buildless" if: false # temporarily disabled uses: buildless/setup@30e82389418c7f17046606183bc4c78b2c8913e0 # v1.0.2 @@ -272,13 +274,32 @@ jobs: run_install: | - recursive: true args: [--frozen-lockfile, --strict-peer-dependencies] - - name: "Setup: Yarn" - run: pnpm install -g yarn@1.22.19 - - name: "Build Environment" - run: make info - - name: "🛠️ Build Natives" - run: make setup symlinks && cargo build - - name: "🛠️ Build Packages" + - name: "Setup: LLVM 18" + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 all + export LLVM_PATH=/usr/lib/llvm-18 + export PATH="$LLVM_PATH/bin:$PATH" + export LD_LIBRARY_PATH="$LLVM_PATH/lib:$LD_LIBRARY_PATH" + export LLVM_CONFIG="$LLVM_PATH/bin/llvm-config" + echo LLVM_PATH=$LLVM_PATH >> $GITHUB_ENV + echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >> $GITHUB_ENV + echo LLVM_CONFIG=$LLVM_CONFIG >> $GITHUB_ENV + echo PATH=$PATH >> $GITHUB_ENV + - name: "Setup: Dependencies" + run: | + cargo install cargo-fuzz cargo-insta rustfilt + pnpm install -g yarn@1.22.19 + python -m pip install uv + echo "Setting up venv..." + uv venv + echo "Installing dependencies via Pip..." + uv pip install -r requirements.txt + echo "Activating venv..." + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV + - name: "Setup: Gradle" uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 id: gradlebuild continue-on-error: ${{ matrix.mode == 'labs' }} @@ -299,41 +320,42 @@ jobs: notifications wrapper yarn - arguments: | - assemble - compileKotlin - -x check - -x test - -x jvmTest - -x jsTest - -x jsBrowserTest - --scan - --build-cache - --no-daemon - --warning-mode=none - --dependency-verification=lenient - --stacktrace - -Pelide.ci=true - -PbuildSamples=false + - name: "Build Environment" + run: make info 2>&1 | tee build-info.txt + - name: "🛠️ Build Packages" + env: + CI: true + BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + TEST_EXCEPTIONS: true + run: | + make setup natives -j`nproc` && ./gradlew \ + assemble \ + compileKotlin \ + -x check \ + -x test \ + -x jvmTest \ + -x jsTest \ + -x jsBrowserTest \ + --scan \ + --build-cache \ + --no-daemon \ + --warning-mode=none \ + --dependency-verification=lenient \ + --stacktrace \ + -Pelide.ci=true \ + -PbuildSamples=false \ -PbuildDocs=false - name: "Artifact: Build Outputs" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: elide-framework path: | + build-info.txt build/libs/**/*.* packages/*/build/libs/*.* packages/proto/*/build/libs/*.* tools/elide-build/build/**/*.* - - name: "Artifact: Reports" - if: failure() || success() - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - with: - name: build-reports-${{ matrix.os }}-latest-gvm-latest - path: | - build/reports/**/*.* - packages/*/build/reports/**/*.* - packages/proto/*/build/reports/**/*.* - name: "Artifact: Provenance Subject" id: hash if: ${{ matrix.os == 'ubuntu' && inputs.provenance }} diff --git a/.github/workflows/job.cli.yml b/.github/workflows/job.cli.yml index 0a0500bd7f..7107e8762e 100644 --- a/.github/workflows/job.cli.yml +++ b/.github/workflows/job.cli.yml @@ -183,7 +183,7 @@ jobs: - name: "Setup: Yarn" run: pnpm install -g yarn@1.22.19 - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true @@ -215,21 +215,21 @@ jobs: popd; echo "Binary compressed."; - name: "Artifacts: Debug Binary (Unix)" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 if: success() && !contains(matrix.runner, 'windows') with: name: cli-debug-${{ matrix.tag }} path: | ./packages/cli/build/native/nativeCompile/elide.debug.xz - name: "Artifacts: Debug Binary (Windows)" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 if: success() && contains(matrix.runner, 'windows') with: name: cli-debug-${{ matrix.tag }} path: | ./packages/cli/build/native/nativeCompile/elide.debug - name: "Artifacts: Dashboard Dump" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 if: success() with: name: cli-debug-report-${{ matrix.tag }} @@ -323,7 +323,7 @@ jobs: - name: "Setup: Yarn" run: pnpm install -g yarn@1.22.19 - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true @@ -349,7 +349,7 @@ jobs: -PbuildSamples=false -PbuildDocs=false - name: "Artifacts: Release Binary" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 if: success() with: name: cli-release-${{ matrix.tag }} diff --git a/.github/workflows/job.containers.yml b/.github/workflows/job.containers.yml index deb826aeb8..0e1a85f8ca 100644 --- a/.github/workflows/job.containers.yml +++ b/.github/workflows/job.containers.yml @@ -196,9 +196,9 @@ jobs: java-version: "22" github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: QEMU" - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 - name: "Setup: Docker" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 id: buildx with: install: true @@ -308,9 +308,9 @@ jobs: java-version: "22" github-token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: QEMU" - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 - name: "Setup: Docker" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 id: buildx with: install: true diff --git a/.github/workflows/job.site.yml b/.github/workflows/job.site.yml index 31e395aa28..cdb5f0afaf 100644 --- a/.github/workflows/job.site.yml +++ b/.github/workflows/job.site.yml @@ -49,9 +49,9 @@ jobs: fetch-depth: 0 persist-credentials: false - name: "Setup: QEMU" - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 - name: "Setup: Docker Buildx" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 - name: "Setup: GraalVM" uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1.2.2 with: @@ -119,12 +119,12 @@ jobs: run: | tar -czf site.tar.gz build/site - name: "Upload: Manifest" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: site-tarball-phase1 path: ./site.tar.gz - name: "Upload: Site" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: site-manifest path: ./site/docs/app/build/generated/ksp/main/resources/elide/runtime/generated/app.manifest.pb @@ -167,9 +167,9 @@ jobs: - name: "Setup: Checkout" uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: "Setup: QEMU" - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 - name: "Setup: Docker Buildx" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 - name: "Setup: GraalVM" uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1.2.2 with: @@ -206,12 +206,12 @@ jobs: - name: "Setup: Yarn" run: yarn - name: "Setup: Site Manifest" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: site-manifest path: ./artifacts/ - name: "Setup: Site Tarball" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: site-tarball-phase1 path: . @@ -247,7 +247,7 @@ jobs: rm -fv site.tar.gz; tar -czf site.tar.gz build/site; - name: "Upload: Site Tarball" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: site-tarball-phase2 path: ./site.tar.gz diff --git a/.github/workflows/job.test.yml b/.github/workflows/job.test.yml index b5cdd8e9f5..60114d2836 100644 --- a/.github/workflows/job.test.yml +++ b/.github/workflows/job.test.yml @@ -153,8 +153,6 @@ jobs: pull-requests: "write" steps: - - name: "Setup: Apt Dependencies" - run: sudo apt-get install -y libtool-bin build-essential libc6-dev - name: "Setup: Harden Runner" uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 with: @@ -201,6 +199,21 @@ jobs: services.gradle.org:443 sonarcloud.io:443 storage.googleapis.com:443 + - name: "Setup: Apt Dependencies" + run: sudo apt-get install -y libtool-bin build-essential libc6-dev + - name: "Setup: LLVM 18" + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 all + export LLVM_PATH=/usr/lib/llvm-18 + export PATH="$LLVM_PATH/bin:$PATH" + export LD_LIBRARY_PATH="$LLVM_PATH/lib:$LD_LIBRARY_PATH" + export LLVM_CONFIG="$LLVM_PATH/bin/llvm-config" + echo LLVM_PATH=$LLVM_PATH >> $GITHUB_ENV + echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >> $GITHUB_ENV + echo LLVM_CONFIG=$LLVM_CONFIG >> $GITHUB_ENV + echo PATH=$PATH >> $GITHUB_ENV - name: "Setup: Clear Tooling Cache" run: rm -rf /opt/hostedtoolcache - name: "Setup: Checkout" @@ -214,7 +227,7 @@ jobs: id: cache-restore uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: elide-framework-v2-tests-${{ hashFiles('gradle/elide.versions.toml') }} + key: elide-framework-v2-tests-${{ github.sha }} path: | build/reports/kover/**/*.* packages/*/test-results/ @@ -223,13 +236,15 @@ jobs: packages/*/reports/ packages/proto/*/reports/ tools/elide-build/reports/ + third_party/google/boringssl/build + third_party/sqlite/.libs restore-keys: | elide-framework-v2-tests-${{ hashFiles('gradle/elide.versions.toml') }} elide-framework-v2-tests- - name: "Setup: Rust" uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 with: - toolchain: stable + toolchain: nightly target: wasm32-wasi components: clippy,rustfmt cache: false @@ -246,14 +261,10 @@ jobs: distribution: "graalvm" java-version: "22" github-token: ${{ secrets.GITHUB_TOKEN }} - - id: "auth" - name: "Setup: Authorize Service Account" - uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2 + - name: "Setup: Python (3.12)" + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 with: - credentials_json: "${{ secrets.BUILDBOT_SERVICE_ACCOUNT }}" - create_credentials_file: true - export_environment_variables: true - cleanup_credentials: true + python-version: 3.12 - name: "Setup: Buildless" if: false uses: buildless/setup@30e82389418c7f17046606183bc4c78b2c8913e0 # v1.0.2 @@ -268,18 +279,24 @@ jobs: run_install: | - recursive: true args: [--frozen-lockfile, --strict-peer-dependencies] - - name: "Setup: Yarn" - run: pnpm install -g yarn@1.22.19 + - name: "Setup: Dependencies" + run: | + cargo install cargo-fuzz cargo-insta rustfilt + pnpm install -g yarn@1.22.19 + python -m pip install uv + echo "Setting up venv..." + uv venv + echo "Installing dependencies via Pip..." + uv pip install -r requirements.txt + echo "Activating venv..." + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true - - name: "Build Environment" - run: make info - - name: "🛠️ Build Native" - run: make setup symlinks && cargo build - - name: "Testsuite" + - name: "Setup: Gradle" uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 env: CI: true @@ -299,82 +316,60 @@ jobs: notifications wrapper yarn - arguments: | - test - jvmTest - koverXmlReport - koverBinaryReport - koverVerify - detekt - -x nativeTest - --scan - --build-cache - --no-daemon - --warning-mode=none - --dependency-verification=lenient - -x apiCheck - -Pelide.ci=true - -PbuildSamples=false - -PbuildDocs=false - - name: "Analysis: Sonar" - uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 - continue-on-error: true + - name: "Build Environment" + run: make info CI=yes 2>&1 | tee build-info.txt + - name: "👨‍🔬️ Test: Native" + run: make third-party natives-test COVERAGE=yes CI=yes -j`nproc` + - name: "👨‍🔬 Test: Runtime" env: CI: true BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} TEST_EXCEPTIONS: true - with: - cache-read-only: true - cache-encryption-key: ${{ secrets.GRADLE_CONFIGURATION_KEY }} - dependency-graph: disabled - gradle-home-cache-includes: binaryen - caches - jdks - native - native-build-tools - nodejs - notifications - wrapper - yarn - arguments: | - sonar - --scan - --build-cache - --no-daemon - --warning-mode=none - --dependency-verification=lenient - -x apiCheck - -Pelide.ci=true - -PbuildSamples=false + run: | + cargo build -p sqlite + ./gradlew \ + test \ + jvmTest \ + allTests \ + koverXmlReport \ + koverBinaryReport \ + koverVerify \ + detekt \ + -x nativeTest \ + --scan \ + --build-cache \ + --warning-mode=none \ + --dependency-verification=lenient \ + -x apiCheck \ + -x spotlessCheck \ + -Pelide.ci=true \ -PbuildDocs=false - - name: "Runtime Self-tests (JVM)" - uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + - name: "Analysis: Sonar" continue-on-error: true env: CI: true - TEST_EXCEPTIONS: true BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} - with: - cache-read-only: true - cache-encryption-key: ${{ secrets.GRADLE_CONFIGURATION_KEY }} - dependency-graph: disabled - arguments: | - optimizedRun - --scan - --no-daemon - --warning-mode=none - --dependency-verification=lenient - -x apiCheck - -Pelide.ci=true - -PbuildSamples=false - -PbuildDocs=false - --args="selftest" - - name: "Artifact: Test Reports" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + TEST_EXCEPTIONS: true + run: | + ./gradlew \ + sonar \ + --scan \ + --build-cache \ + --warning-mode=none \ + --dependency-verification=lenient \ + -x apiCheck \ + -Pelide.ci=true \ + -PbuildDocs=false + - name: "Artifact: Reports" + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: test-reports-jvm path: | + build-info.txt + target/coverage-report.lcov + target/coverage-report.json **/build/reports/jacoco/test/jacocoTestReport.xml **/build/reports/jacoco/testCodeCoverageReport/jacocoTestReport.xml **/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml @@ -386,17 +381,19 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/reports/kover/merged/xml/report.xml + exclude: target name: elide flags: jvm,lib fail_ci_if_error: false verbose: true - - name: "Report: Codecov (Plugin)" + - name: "Report: Codecov (Native)" uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./tools/plugin/gradle-plugin/plugin-build/plugin/build/reports/kover/xml/report.xml - name: plugin-gradle - flags: jvm,plugin,gradle + files: ./target/coverage-report.lcov + name: elide-native + flags: native + disable_search: true fail_ci_if_error: false verbose: true - name: "Artifact: Caches" @@ -420,25 +417,83 @@ jobs: runs-on: ${{ inputs.runner_large || 'ubuntu-latest-8-cores' }} if: inputs.native steps: - - name: "Setup: Apt Dependencies" - run: sudo apt-get install -y libtool-bin build-essential libc6-dev - name: "Setup: Harden Runner" uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 with: - egress-policy: audit disable-sudo: false + egress-policy: audit + allowed-endpoints: > + agent.less.build:443 + static.rust-lang.org:443 + androidx.dev:443 + api.codecov.io:443 + api.foojay.io:443 + api.github.com:443 + cli.codecov.io:443 + cli.less.build:443 + d3ob9fqp587by1.cloudfront.net:443 + dc.services.visualstudio.com:443 + dl.google.com:443 + dl.less.build:443 + download-cdn.jetbrains.com:443 + download.jetbrains.com:443 + download.oracle.com:443 + ea6ne4j2sb.execute-api.eu-central-1.amazonaws.com:443 + edge.pkg.st:443 + maven.elide.dev:443 + github.com:22 + github.com:443 + global.less.build:443 + gradle.pkg.st:443 + jpms.pkg.st:443 + keys.openpgp.org:443 + keyserver.ubuntu.com:443 + local.less.build:443 + maven.pkg.jetbrains.space:443 + maven.pkg.st:443 + nodejs.org:443 + npm.pkg.st:443 + objects.githubusercontent.com:443 + pgp.mit.edu:443 + registry.npmjs.org:443 + repo.maven.apache.org:443 + sc-cleancode-sensorcache-eu-central-1-prod.s3.amazonaws.com:443 + scanner.sonarcloud.io:443 + scans-in.gradle.com:443 + services.gradle.org:443 + sonarcloud.io:443 + storage.googleapis.com:443 + - name: "Setup: Apt Dependencies" + run: sudo apt-get install -y libtool-bin build-essential libc6-dev + - name: "Setup: LLVM 18" + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 all + export LLVM_PATH=/usr/lib/llvm-18 + export PATH="$LLVM_PATH/bin:$PATH" + export LD_LIBRARY_PATH="$LLVM_PATH/lib:$LD_LIBRARY_PATH" + export LLVM_CONFIG="$LLVM_PATH/bin/llvm-config" + echo LLVM_PATH=$LLVM_PATH >> $GITHUB_ENV + echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >> $GITHUB_ENV + echo LLVM_CONFIG=$LLVM_CONFIG >> $GITHUB_ENV + echo PATH=$PATH >> $GITHUB_ENV + - name: "Setup: Clear Tooling Cache" + run: rm -rf /opt/hostedtoolcache - name: "Setup: Checkout" uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 submodules: true persist-credentials: false + token: ${{ secrets.GITHUB_TOKEN }} - name: "Setup: Cache Restore (Test)" id: cache-restore uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: elide-framework-v2-tests-${{ hashFiles('gradle/elide.versions.toml') }} + key: elide-framework-v2-tests-${{ github.sha }} path: | + build/reports/kover/**/*.* packages/*/test-results/ packages/proto/*/test-results/ tools/elide-build/test-results/ @@ -448,22 +503,33 @@ jobs: restore-keys: | elide-framework-v2-tests-${{ hashFiles('gradle/elide.versions.toml') }} elide-framework-v2-tests- + - name: "Setup: Rust" + uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 + with: + toolchain: nightly + target: wasm32-wasi + components: clippy,rustfmt + cache: false + rustflags: "" + - name: "Setup: SCCache" + uses: mozilla-actions/sccache-action@89e9040de88b577a072e3760aaf59f585da083af # v0.0.5 + - name: "Setup: Rust Caching" + run: | + echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - name: "Setup: GraalVM (Java 22)" uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1.2.2 with: distribution: "graalvm" java-version: "22" github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "Setup: Python (3.12)" + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: 3.12 - name: "Setup: Buildless" + if: false uses: buildless/setup@30e82389418c7f17046606183bc4c78b2c8913e0 # v1.0.2 - - id: "auth" - name: "Setup: Authorize Service Account" - uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2 - with: - credentials_json: "${{ secrets.BUILDBOT_SERVICE_ACCOUNT }}" - create_credentials_file: true - export_environment_variables: true - cleanup_credentials: true - name: "Setup: Node" uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: @@ -471,43 +537,70 @@ jobs: - name: "Setup: PNPM" uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 with: - version: "9.0.2" + version: "9.2.0" run_install: | - recursive: true args: [--frozen-lockfile, --strict-peer-dependencies] - - name: "Setup: Yarn" - run: pnpm install -g yarn@1.22.19 + - name: "Setup: Dependencies" + run: | + cargo install cargo-fuzz cargo-insta rustfilt + pnpm install -g yarn@1.22.19 + python -m pip install uv + echo "Setting up venv..." + uv venv + echo "Installing dependencies via Pip..." + uv pip install -r requirements.txt + echo "Activating venv..." + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: "Setup: Artifacts" - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 continue-on-error: true with: merge-multiple: true - - name: "🛠️ Build Native" - run: make setup && cargo build - - name: "Run Tests (Native)" + - name: "Setup: Gradle" uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 - continue-on-error: true env: CI: true BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + TEST_EXCEPTIONS: true with: cache-read-only: true cache-encryption-key: ${{ secrets.GRADLE_CONFIGURATION_KEY }} dependency-graph: disabled - arguments: | - nativeTest - check - jacocoTestReport - --scan - --no-daemon - --warning-mode=none - --dependency-verification=lenient - -x apiCheck - -x :packages:server:nativeTest - -Pelide.ci=true - -PbuildSamples=false + gradle-home-cache-includes: binaryen + caches + jdks + native + native-build-tools + nodejs + notifications + wrapper + yarn + - name: "Build Environment" + run: make info CI=yes 2>&1 | tee build-info.txt + - name: "🛠️ Build Native" + run: make setup && cargo build + - name: "Run Tests (Native)" + env: + CI: true + BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} + run: | + ./gradlew \ + nativeTest \ + check \ + jacocoTestReport \ + --scan \ + --no-daemon \ + --warning-mode=none \ + --dependency-verification=lenient \ + -x apiCheck \ + -x :packages:server:nativeTest \ + -Pelide.ci=true \ -PbuildDocs=false - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + - name: "Artifact: Reports" + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: name: test-reports-native path: | diff --git a/.github/workflows/on.pr.yml b/.github/workflows/on.pr.yml index 1c4e35f8ee..d3e70037ba 100644 --- a/.github/workflows/on.pr.yml +++ b/.github/workflows/on.pr.yml @@ -45,6 +45,7 @@ jobs: changes: ${{ steps.extract_branch.outputs.changes }} branch: ${{ steps.extract_branch.outputs.branch }} base: ${{ steps.filter.outputs.base }} + natives: ${{ steps.filter.outputs.natives }} devcontainer: ${{ steps.filter.outputs.base }} model: ${{ steps.filter.outputs.model }} packages: ${{ steps.filter.outputs.packages }} @@ -110,6 +111,13 @@ jobs: - *model - *packages - *tools + natives: &natives + - *base + - "crates" + - "crates/*" + - "crates/**/*.*" + - "third_party/Makefile" + - "third_party/*/**/*.*" ## ## Job: Multi-platform Build @@ -157,7 +165,7 @@ jobs: name: "Checks" uses: ./.github/workflows/checks.apicheck.yml needs: [triage] - if: fromJson(needs.triage.outputs.srcs) + if: fromJson(needs.triage.outputs.srcs) && github.event.pull_request.draft == false secrets: GRADLE_CONFIGURATION_KEY: ${{ secrets.GRADLE_CONFIGURATION_KEY }} BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} @@ -186,18 +194,30 @@ jobs: name: "Checks" uses: ./.github/workflows/checks.formatting.yml needs: [triage] - if: fromJson(needs.triage.outputs.model) + if: fromJson(needs.triage.outputs.model) || fromJson(needs.triage.outputs.natives) || fromJson(needs.triage.outputs.srcs) secrets: inherit permissions: contents: "read" with: ignore_failures: ${{ contains(github.event.pull_request.labels.*.name, 'ci:fmt-ignore') }} + ## + ## Job: Clippy Check + ## + check-clippy: + name: "Checks" + uses: ./.github/workflows/checks.clippy.yml + needs: [triage] + if: fromJson(needs.triage.outputs.natives) + permissions: + contents: "read" + ## ## Job: Check for Wrapper ## check-wrapper: name: "Checks" + if: github.event.pull_request.draft == false uses: ./.github/workflows/checks.gradle-wrapper.yml needs: [triage] permissions: @@ -208,6 +228,7 @@ jobs: ## check-dependencies: name: "Checks" + if: github.event.pull_request.draft == false uses: ./.github/workflows/checks.dependency-review.yml needs: [triage, pr-build] permissions: @@ -218,9 +239,9 @@ jobs: ## check-codeql: name: "Checks" + if: github.event.pull_request.draft == false && fromJson(needs.triage.outputs.packages) uses: ./.github/workflows/checks.codeql.yml needs: [triage, pr-build] - if: fromJson(needs.triage.outputs.packages) secrets: BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} GRADLE_CONFIGURATION_KEY: ${{ secrets.GRADLE_CONFIGURATION_KEY }} @@ -236,7 +257,6 @@ jobs: name: "Checks" uses: ./.github/workflows/checks.detekt.yml needs: [triage, pr-build] - if: fromJson(needs.triage.outputs.srcs) secrets: GRADLE_CONFIGURATION_KEY: ${{ secrets.GRADLE_CONFIGURATION_KEY }} BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} diff --git a/.github/workflows/on.scheduled.yml b/.github/workflows/on.scheduled.yml index efd27bf493..7a76eba8af 100644 --- a/.github/workflows/on.scheduled.yml +++ b/.github/workflows/on.scheduled.yml @@ -71,7 +71,7 @@ jobs: egress-policy: audit - name: "Setup: Docker" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 id: buildx with: install: true @@ -145,7 +145,7 @@ jobs: egress-policy: audit - name: "Setup: Docker" - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 id: buildx with: install: true diff --git a/.gitignore b/.gitignore index bf7c72ac64..d75153be70 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ tools/images/bench/elide-edge.tgz /.graalvm-home /.java-home /third_party/oracle/graaljs +*.profraw diff --git a/.prettierignore b/.prettierignore index 36102b6d60..6f125ef9e5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -71,3 +71,5 @@ detekt-baseline.xml tools/images/*/Dockerfile tools/umbrella third_party +fuzz/fuzz_targets/ +biome.jsonc diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000000..a7c8c048cc --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,3 @@ +edition = "2021" +tab_spaces = 2 +imports_layout = "HorizontalVertical" diff --git a/Cargo.lock b/Cargo.lock index ef5a21840e..1af2793f36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,6 +145,15 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "argfile" version = "0.2.0" @@ -331,6 +340,28 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "async-tar-wasm" version = "0.4.2-wasm.1" @@ -353,13 +384,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -408,6 +439,51 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags 1.3.2", + "bytes 1.6.1", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 0.1.2", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes 1.6.1", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + [[package]] name = "backoff" version = "0.4.0" @@ -458,11 +534,45 @@ dependencies = [ "backtrace", ] +[[package]] +name = "base" +version = "1.0.0-alpha11-SNAPSHOT" +dependencies = [ + "arbitrary", + "base64 0.22.1", + "base64-simd", + "const_fn", + "const_panic", + "crc32fast", + "crc64fast", + "libabort", + "panic-abort", + "simdutf", + "smartstring", + "uuid", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" source = "git+https://github.com/elide-tools/rust-base64?rev=e14400697453bcc85997119b874bc03d9601d0af#e14400697453bcc85997119b874bc03d9601d0af" +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + [[package]] name = "bincode" version = "1.3.3" @@ -489,7 +599,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -511,7 +621,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.69", + "syn 2.0.71", "which 4.4.2", ] @@ -915,7 +1025,7 @@ checksum = "9a8d5b11f7fa1068e5bbac8ab6c8c2c6940047f69185987446b60c995d4bf89c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -961,12 +1071,20 @@ dependencies = [ "serde", ] +[[package]] +name = "build_const" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" + [[package]] name = "builder" version = "1.0.0-alpha11-SNAPSHOT" dependencies = [ + "base", "bindgen 0.69.4", "cc", + "model", ] [[package]] @@ -1006,6 +1124,26 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" +[[package]] +name = "bytemuck" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -1024,9 +1162,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" [[package]] name = "bzip2" @@ -1094,6 +1232,24 @@ dependencies = [ "tempfile", ] +[[package]] +name = "capnp" +version = "0.19.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de71387912cac7dd3cb7c219e09628411620a18061bba58c71453c26ae7bf66a" +dependencies = [ + "embedded-io", +] + +[[package]] +name = "capnpc" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ba30e0f08582d53c2f3710cf4bb65ff562614b1ba86906d7391adffe189ec" +dependencies = [ + "capnp", +] + [[package]] name = "cargo-util" version = "0.2.12" @@ -1128,9 +1284,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.104" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" +checksum = "9711f33475c22aab363b05564a17d7b789bf3dfec5ebabb586adee56f0e271b5" dependencies = [ "jobserver", "libc", @@ -1169,7 +1325,7 @@ name = "charset" version = "0.1.3" source = "git+https://github.com/elide-tools/charset?rev=62cb8a4f42bf43df7c654da073d106de777252b7#62cb8a4f42bf43df7c654da073d106de777252b7" dependencies = [ - "base64", + "base64 0.22.1", "encoding_rs", ] @@ -1218,9 +1374,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.8" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" dependencies = [ "clap_builder", "clap_derive", @@ -1228,9 +1384,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.8" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" dependencies = [ "anstream", "anstyle", @@ -1242,9 +1398,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.7" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d598e88f6874d4b888ed40c71efbcbf4076f1dfbae128a08a8c9e45f710605d" +checksum = "5b4be9c4c4b1f30b78d8a750e0822b6a6102d97e62061c583a6c1dea2dfb33ae" dependencies = [ "clap", ] @@ -1290,7 +1446,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -1343,7 +1499,7 @@ version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "memchr", ] @@ -1400,6 +1556,44 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "console-api" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a257c22cd7e487dd4a13d413beabc512c5052f0bc048db0da6a84c3d8a6142fd" +dependencies = [ + "futures-core", + "prost 0.12.6", + "prost-types 0.12.6", + "tonic", + "tracing-core", +] + +[[package]] +name = "console-subscriber" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c4cc54bae66f7d9188996404abdf7fdfa23034ef8e43478c8810828abad758" +dependencies = [ + "console-api", + "crossbeam-channel", + "crossbeam-utils", + "futures-task", + "hdrhistogram", + "humantime", + "prost 0.12.6", + "prost-types 0.12.6", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic", + "tracing", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -1410,6 +1604,47 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const-crc32-nostd" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808ac43170e95b11dd23d78aa9eaac5bea45776a602955552c4e833f3f0f823d" + +[[package]] +name = "const_fn" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d" + +[[package]] +name = "const_format" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "const_panic" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" +dependencies = [ + "typewit", +] + [[package]] name = "convert_case" version = "0.6.0" @@ -1419,10 +1654,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "core" -version = "1.0.0-alpha11-SNAPSHOT" - [[package]] name = "core-foundation" version = "0.9.4" @@ -1463,6 +1694,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crc64fast" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bb92ecea20291efcf0009e2713d64b7e327dedb8ce780545250f24075429e2" + [[package]] name = "crossbeam-channel" version = "0.5.13" @@ -1540,9 +1777,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -1550,27 +1787,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -1619,6 +1856,17 @@ dependencies = [ [[package]] name = "deps" version = "1.0.0-alpha11-SNAPSHOT" +dependencies = [ + "base", + "model", + "pubgrub 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "purl", + "semver", + "serde", + "toml 0.8.14", + "toml_edit", + "typeshare", +] [[package]] name = "deranged" @@ -1640,6 +1888,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "derive_builder" version = "0.20.0" @@ -1658,7 +1917,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -1668,7 +1927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -1821,6 +2080,12 @@ dependencies = [ "winreg 0.10.1", ] +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1986,7 +2251,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -2136,7 +2401,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -2240,6 +2505,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes 1.6.1", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2256,6 +2540,19 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hdrhistogram" +version = "7.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" +dependencies = [ + "base64 0.21.7", + "byteorder", + "flate2", + "nom", + "num-traits", +] + [[package]] name = "heck" version = "0.5.0" @@ -2309,25 +2606,47 @@ dependencies = [ "utf8-width", ] +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes 1.6.1", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "fnv", "itoa", ] [[package]] name = "http-body" -version = "1.0.0" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes 1.6.1", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ - "bytes 1.6.0", - "http", + "bytes 1.6.1", + "http 1.1.0", ] [[package]] @@ -2336,10 +2655,10 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -2352,7 +2671,7 @@ dependencies = [ "async-trait", "bincode", "cacache", - "http", + "http 1.1.0", "http-cache-semantics", "httpdate", "serde", @@ -2367,7 +2686,7 @@ checksum = "be3e27c4e2e510571cbcc601407b639667146aa9a4e818d5cc1d97c8b4b27d61" dependencies = [ "anyhow", "async-trait", - "http", + "http 1.1.0", "http-cache", "http-cache-semantics", "reqwest", @@ -2382,7 +2701,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92baf25cf0b8c9246baecf3a444546360a97b569168fdf92563ee6a47829920c" dependencies = [ - "http", + "http 1.1.0", "http-serde", "serde", "time", @@ -2400,7 +2719,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f056c8559e3757392c8d091e796416e4649d8e49e88b8d76df6c002f05027fd" dependencies = [ - "http", + "http 1.1.0", "serde", ] @@ -2422,17 +2741,47 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" -version = "1.4.0" +version = "0.14.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +dependencies = [ + "bytes 1.6.1", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "futures-channel", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", "httparse", "itoa", "pin-project-lite", @@ -2448,8 +2797,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", - "http", - "hyper", + "http 1.1.0", + "hyper 1.4.1", "hyper-util", "rustls", "rustls-native-certs", @@ -2460,15 +2809,27 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.30", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "http-body-util", - "hyper", + "hyper 1.4.1", "hyper-util", "native-tls", "tokio", @@ -2482,12 +2843,12 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "futures-channel", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", "pin-project-lite", "socket2", "tokio", @@ -2708,7 +3069,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -2785,7 +3146,7 @@ source = "git+https://github.com/elide-tools/jni-macros?rev=7dc95cc2d7534761d0b1 dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -2910,6 +3271,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "libabort" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c5cd8a1b4270cf70eee9ff36ef22b7324e0b7a525cadd8273dc1f83b81f6950" +dependencies = [ + "libc", + "rustversion-detect", +] + [[package]] name = "libc" version = "0.2.155" @@ -2936,7 +3307,7 @@ version = "1.4.0" source = "git+https://github.com/elide-tools/libcst?rev=a2dff05ebfd5ccebfa6a57ac4417cccea5a33515#a2dff05ebfd5ccebfa6a57ac4417cccea5a33515" dependencies = [ "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -3032,9 +3403,15 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matchit" -version = "0.8.3" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "matchit" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3c2fcf089c060eb333302d80c5f3ffa8297abecf220f788e4a09ef85f59420" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "md-5" @@ -3110,7 +3487,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -3121,7 +3498,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -3179,9 +3556,19 @@ dependencies = [ name = "model" version = "1.0.0-alpha11-SNAPSHOT" dependencies = [ + "build_const", + "const-crc32-nostd", + "rustc_version", "serde", + "typeshare", ] +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + [[package]] name = "nanoid" version = "0.4.0" @@ -3455,9 +3842,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "open" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2c909a3fce3bd80efef4cd1c6c056bd9376a8fe06fcfdbebaf32cb485a7e37" +checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" dependencies = [ "is-wsl", "libc", @@ -3487,7 +3874,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -3521,10 +3908,10 @@ source = "git+https://github.com/elide-dev/orogene?rev=c8dc2a63e67b0984beccfee2b dependencies = [ "anyhow", "async-trait", - "base64", + "base64 0.22.1", "chrono", "futures 0.3.30", - "http", + "http 1.1.0", "http-cache-reqwest", "indexmap 2.2.6", "miette 7.2.0", @@ -3577,7 +3964,7 @@ version = "0.3.35-elide" source = "git+https://github.com/elide-dev/orogene?rev=c8dc2a63e67b0984beccfee2b2fa74990bfa9e15#c8dc2a63e67b0984beccfee2b2fa74990bfa9e15" dependencies = [ "async-std", - "base64", + "base64 0.22.1", "dialoguer", "kdl", "miette 7.2.0", @@ -3700,6 +4087,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "outref" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" + [[package]] name = "overload" version = "0.1.1" @@ -3790,9 +4183,9 @@ dependencies = [ [[package]] name = "oxc_resolver" -version = "1.9.3" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee5850e737373628dfd9db8be5a0e85f1c816985fbb9cda58387b7f4b1f571d6" +checksum = "c368aa1e41d8f8fb0ecbbe7130cd47814897f9a537cc7213be586ec34702d31f" dependencies = [ "dashmap 6.0.1", "dunce", @@ -3829,6 +4222,12 @@ dependencies = [ "unicode-id-start", ] +[[package]] +name = "panic-abort" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e20e6499bbbc412f280b04a42346b356c6fa0753d5fd22b7bd752ff34c778ee" + [[package]] name = "parking" version = "2.2.0" @@ -4056,7 +4455,8 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", + "unicase", ] [[package]] @@ -4066,6 +4466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", + "unicase", ] [[package]] @@ -4085,7 +4486,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -4177,7 +4578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -4223,6 +4624,117 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "project" +version = "1.0.0-alpha11-SNAPSHOT" +dependencies = [ + "builder", + "model", + "serde", + "toml 0.8.14", + "toml_edit", + "typeshare", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes 1.6.1", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +dependencies = [ + "bytes 1.6.1", + "prost-derive 0.13.1", +] + +[[package]] +name = "prost-build" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" +dependencies = [ + "bytes 1.6.1", + "heck", + "itertools 0.13.0", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost 0.13.1", + "prost-types 0.13.1", + "regex", + "syn 2.0.71", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.71", +] + +[[package]] +name = "prost-derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +dependencies = [ + "anyhow", + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn 2.0.71", +] + +[[package]] +name = "prost-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +dependencies = [ + "prost 0.12.6", +] + +[[package]] +name = "prost-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" +dependencies = [ + "prost 0.13.1", +] + +[[package]] +name = "protocol" +version = "1.0.0-alpha11-SNAPSHOT" +dependencies = [ + "builder", + "bytes 1.6.1", + "capnp", + "capnpc", + "const_format", + "model", + "prost 0.13.1", + "prost-build", +] + [[package]] name = "ptr_meta" version = "0.1.4" @@ -4243,6 +4755,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pubgrub" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd14552ad5f5d743a323c10d576f26822a044355d6601f377d813ece46f38fd" +dependencies = [ + "rustc-hash 1.1.0", + "thiserror", +] + [[package]] name = "pubgrub" version = "0.2.1" @@ -4255,6 +4777,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "purl" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c14fe28c8495f7eaf77a6e6106966f95211c0a2404b9da50d248fc32af3a3f14" +dependencies = [ + "hex", + "percent-encoding", + "phf", + "smartstring", + "thiserror", + "unicase", +] + [[package]] name = "pypi-types" version = "0.0.1" @@ -4321,7 +4857,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "pin-project-lite", "quinn-proto", "quinn-udp", @@ -4338,7 +4874,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "rand", "ring", "rustc-hash 1.1.0", @@ -4573,15 +5109,15 @@ version = "0.12.5" source = "git+https://github.com/elide-tools/reqwest?rev=cc6b9a9b198033ac3d8161871627a4787cef3aec#cc6b9a9b198033ac3d8161871627a4787cef3aec" dependencies = [ "async-compression", - "base64", - "bytes 1.6.0", + "base64 0.22.1", + "bytes 1.6.1", "futures-channel", "futures-core", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.4.1", "hyper-rustls", "hyper-tls", "hyper-util", @@ -4601,7 +5137,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "tokio", "tokio-native-tls", "tokio-rustls", @@ -4624,7 +5160,7 @@ checksum = "39346a33ddfe6be00cbc17a34ce996818b97b230b87229f10114693becca1268" dependencies = [ "anyhow", "async-trait", - "http", + "http 1.1.0", "reqwest", "serde", "thiserror", @@ -4642,8 +5178,8 @@ dependencies = [ "chrono", "futures 0.3.30", "getrandom", - "http", - "hyper", + "http 1.1.0", + "hyper 1.4.1", "parking_lot", "reqwest", "reqwest-middleware", @@ -4684,7 +5220,7 @@ source = "git+https://github.com/elide-tools/rkyv?rev=7b883203b216fcfc594077a578 dependencies = [ "bitvec", "bytecheck", - "bytes 1.6.0", + "bytes 1.6.1", "hashbrown 0.14.5", "ptr_meta", "rend", @@ -4892,7 +5428,7 @@ dependencies = [ "proc-macro2", "quote", "ruff_python_trivia", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5080,7 +5616,7 @@ dependencies = [ "is-macro", "itertools 0.13.0", "log", - "matchit", + "matchit 0.8.4", "path-absolutize", "path-slash", "pep440_rs 0.6.0 (git+https://github.com/elide-dev/uv?rev=7c3eb5e431d1fe392f71a21b03e8b6da70f7b451)", @@ -5160,9 +5696,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" dependencies = [ "once_cell", "ring", @@ -5191,7 +5727,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64", + "base64 0.22.1", "rustls-pki-types", ] @@ -5218,6 +5754,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +[[package]] +name = "rustversion-detect" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f70190da06c9502678bf4784c8a66228b325072df916e13f7e1d6cfdc7887fb" + [[package]] name = "ryu" version = "1.0.18" @@ -5264,7 +5806,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals 0.29.1", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5281,9 +5823,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", "core-foundation", @@ -5294,9 +5836,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -5461,7 +6003,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5472,7 +6014,7 @@ checksum = "e578a843d40b4189a4d66bba51d7684f57da5bd7c304c64e14bd63efbef49509" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5483,7 +6025,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5521,9 +6063,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "serde", "serde_derive", @@ -5532,14 +6074,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5620,6 +6162,16 @@ dependencies = [ "libc", ] +[[package]] +name = "simdutf" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8fd29a602ffc1f2d4587b7fb7b74ea7b480901c634eb8bd748501adbc586a2" +dependencies = [ + "bitflags 2.6.0", + "cc", +] + [[package]] name = "simdutf8" version = "0.1.4" @@ -5657,6 +6209,19 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "arbitrary", + "autocfg", + "serde", + "static_assertions", + "version_check", +] + [[package]] name = "smawk" version = "0.3.2" @@ -5698,7 +6263,7 @@ name = "ssri" version = "9.2.0" source = "git+https://github.com/elide-tools/ssri-rs?rev=015e101918b6664cbae4c38c6b122db2e76bf9d0#015e101918b6664cbae4c38c6b122db2e76bf9d0" dependencies = [ - "base64", + "base64 0.22.1", "digest", "hex", "miette 7.2.0", @@ -5749,7 +6314,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -5761,6 +6326,7 @@ dependencies = [ "java_native", "jni", "jni-sys", + "libloading", ] [[package]] @@ -5803,15 +6369,21 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.69" +version = "2.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201fcda3845c23e8212cd466bfebf0bd20694490fc0356ae8e428e0824a915a6" +checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.1" @@ -5847,9 +6419,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.14" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" [[package]] name = "tempfile" @@ -5939,22 +6511,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -6020,9 +6592,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6b6a2fb3a985e99cebfaefa9faa3024743da73304ca1c683a36429613d3d22" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -6046,7 +6618,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", - "bytes 1.6.0", + "bytes 1.6.1", "libc", "mio", "num_cpus", @@ -6054,6 +6626,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", + "tracing", "windows-sys 0.48.0", ] @@ -6068,6 +6641,16 @@ dependencies = [ "log", ] +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-macros" version = "2.3.0" @@ -6076,7 +6659,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -6133,7 +6716,7 @@ version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ - "bytes 1.6.0", + "bytes 1.6.1", "futures-core", "futures-io", "futures-sink", @@ -6173,9 +6756,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.14" +version = "0.22.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" dependencies = [ "indexmap 2.2.6", "serde", @@ -6184,6 +6767,33 @@ dependencies = [ "winnow", ] +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.21.7", + "bytes 1.6.1", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.12.6", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower" version = "0.4.13" @@ -6192,11 +6802,16 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", + "indexmap 1.9.3", "pin-project", "pin-project-lite", + "rand", + "slab", "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -6243,7 +6858,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -6362,7 +6977,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals 0.28.0", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -6396,14 +7011,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a615d6c2764852a2e88a4f16e9ce1ea49bb776b5872956309e170d63a042a34f" dependencies = [ "quote", - "syn 2.0.69", + "syn 2.0.71", +] + +[[package]] +name = "typewit" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" +dependencies = [ + "typewit_proc_macros", ] +[[package]] +name = "typewit_proc_macros" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" + [[package]] name = "umbrella" version = "0.1.0" dependencies = [ "anyhow", + "base", "biome_console", "biome_css_formatter", "biome_diagnostics", @@ -6415,15 +7046,23 @@ dependencies = [ "biome_markup", "biome_suppression", "biome_unicode_table", + "builder", + "bytemuck", "clap", "colored", + "console-subscriber", + "deps", + "entry", "java_native", "jni", "jni-sys", "miette 7.2.0", "mimalloc", + "model", "orogene", "oxc", + "project", + "protocol", "ruff", "serde", "sqlite", @@ -6510,9 +7149,9 @@ checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" [[package]] name = "unicode-id-start" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da" +checksum = "bc3882f69607a2ac8cc4de3ee7993d8f68bb06f2974271195065b3bd07f2edea" [[package]] name = "unicode-ident" @@ -6547,6 +7186,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "unicode_names2" version = "1.2.2" @@ -6587,7 +7232,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" dependencies = [ - "base64", + "base64 0.22.1", "log", "native-tls", "once_cell", @@ -6626,26 +7271,28 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ + "arbitrary", "getrandom", "rand", "serde", "uuid-macro-internal", "wasm-bindgen", + "zerocopy", ] [[package]] name = "uuid-macro-internal" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ff64d5cde1e2cb5268bdb497235b6bd255ba8244f910dbc3574e59593de68c" +checksum = "ee1cd046f83ea2c4e920d6ee9f7c3537ef928d75dce5d84a87c2c5d6b3999a3a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -6714,9 +7361,9 @@ source = "git+https://github.com/elide-dev/uv?rev=f068af78f779f4ea3f6629b63ebef3 dependencies = [ "anyhow", "async-trait", - "base64", + "base64 0.22.1", "futures 0.3.30", - "http", + "http 1.1.0", "once-map", "once_cell", "reqwest", @@ -6821,7 +7468,7 @@ dependencies = [ "fs-err", "futures 0.3.30", "html-escape", - "http", + "http 1.1.0", "install-wheel-rs", "itertools 0.13.0", "pep440_rs 0.6.0 (git+https://github.com/elide-dev/uv?rev=f068af78f779f4ea3f6629b63ebef39ddc1cf3e3)", @@ -7071,7 +7718,7 @@ version = "0.0.1" source = "git+https://github.com/elide-dev/uv?rev=f068af78f779f4ea3f6629b63ebef39ddc1cf3e3#f068af78f779f4ea3f6629b63ebef39ddc1cf3e3" dependencies = [ "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -7153,7 +7800,7 @@ dependencies = [ "pep508_rs 0.6.0 (git+https://github.com/elide-dev/uv?rev=f068af78f779f4ea3f6629b63ebef39ddc1cf3e3)", "petgraph", "platform-tags", - "pubgrub", + "pubgrub 0.2.1 (git+https://github.com/elide-tools/pubgrub?rev=8fd8d1370302508991e1b39ec936c363d582ee4c)", "pypi-types", "requirements-txt", "rkyv", @@ -7367,6 +8014,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + [[package]] name = "vswhom" version = "0.1.0" @@ -7466,7 +8119,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", "wasm-bindgen-shared", ] @@ -7500,7 +8153,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7672,7 +8325,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -7683,7 +8336,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] @@ -7928,6 +8581,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -7939,7 +8593,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.71", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 82e638d9cf..f4c22f3605 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ license = "MIT" [profile.dev] opt-level = 0 -strip = true +strip = false incremental = true codegen-units = 1 overflow-checks = false @@ -33,10 +33,17 @@ split-debuginfo = "unpacked" [profile.release] opt-level = 3 lto = true -strip = true +strip = false incremental = false codegen-units = 1 +[profile.dev.package.builder] +opt-level = 3 +incremental = false +codegen-units = 1 +overflow-checks = false +split-debuginfo = "unpacked" + [patch.crates-io] ## Version Pins / Overrides async-std = { git = "https://github.com/elide-tools/async-std", rev = "0802b3439e42167825359567cffeb35f0f4525af" } @@ -59,11 +66,13 @@ pubgrub = { git = "https://github.com/elide-tools/pubgrub", rev = "8fd8d13703025 [workspace.dependencies] ## Local +base = { path = "crates/base" } builder = { path = "crates/builder" } -core = { path = "crates/core" } deps = { path = "crates/deps" } entry = { path = "crates/entry" } model = { path = "crates/model" } +project = { path = "crates/project" } +protocol = { path = "crates/protocol" } sqlite = { path = "crates/sqlite" } substrate = { path = "crates/substrate" } terminal = { path = "crates/terminal" } @@ -71,13 +80,36 @@ transport = { path = "crates/transport" } ## Dependencies anyhow = { version = "1.0.80" } +arbitrary = { version = "1", features = ["derive"] } argfile = { version = "0.2.0" } +base64 = { version = "0.22.1", default-features = false, features = ["alloc"] } +base64-simd = { version = "0.8.0" } bindgen = { version = "0.69.4" } boring = { version = "4.7.0" } -cc = { version = "1.0.104" } +build_const = { version = "0.2.2", default-features = false } +bytes = { version = "1.6.0" } +bytemuck = { version = "1.16.1", features = [ + "derive", + "extern_crate_std", + "nightly_stdsimd", + "nightly_float", + "nightly_portable_simd", + "aarch64_simd", +] } +capnp = { version = "0.19.6" } +capnpc = { version = "0.19.0" } +capnp-futures = { version = "0.19.0" } +capnp-rpc = { version = "0.19.2" } +cc = { version = "1.0.104", features = ["parallel"] } clap = { version = "4.5.3", features = ["derive"] } colored = { version = "2.1.0" } +console-subscriber = { version = "0.3.0" } const_fn = { version = "0.4" } +const_format = { version = "0.2.32" } +const-crc32-nostd = { version = "1.3.1" } +const_panic = { version = "0.2.8" } +crc32fast = { version = "1.4.2", default-features = false, features = ["nightly"] } +crc64fast = { version = "1.1.0", features = ["pmull"] } futures = { version = "0.3.24", default-features = false } heapless = { version = "0.8.0", features = ["portable-atomic"] } java_native = { git = "https://github.com/elide-tools/jni-macros", rev = "7dc95cc2d7534761d0b16899dcda9e7729bdb89d" } @@ -85,34 +117,60 @@ jni = { version = "0.21.1", default-features = false, features = [] } jni-sys = { version = "0.4.0" } jni-utils = { version = "0.1.1" } lazy_static = { version = "1.5.0" } +libabort = { version = "0.1.8", features = ["libc"] } +libloading = { version = "0.8.4" } +libsqlite3-sys = { version = "0.29.0", default-features = false, features = ["loadable_extension", "openssl-sys"] } maven-toolbox = { version = "0.0.3" } miette = { version = "7.2.0", features = ["fancy", "supports-hyperlinks"] } mimalloc = { version = "0.1.43" } mvn = { version = "0.2.0" } orogene = { git = "https://github.com/elide-dev/orogene", rev = "c8dc2a63e67b0984beccfee2b2fa74990bfa9e15" } +panic-abort = { version = "0.3.2" } +panic-halt = { version = "0.2.0" } pkg-config = { version = "0.3.30" } portable-atomic = { version = "1", default-features = false } powerfmt = { version = "0.2.0", default-features = false } -pubgrub = "0.2.1" +prost = { version = "0.13.1" } +prost-build = { version = "0.13.1" } +prost-types = { version = "0.13.1" } +pubgrub = { version = "0.2.1" } +purl = { version = "0.1.3" } rkyv = { version = "0.7.44", default-features = false } rusqlite = { version = "0.31.0", default-features = false } +rustc_version = { version = "0.4.0" } sccache = { version = "0.8.1", default-features = false, features = ["dist-client", "gha", "redis", "s3"] } -serde = { version = "1.0.203", default-features = false } +semver = { version = "1.0.23" } sentry = { version = "0.34.0" } -libsqlite3-sys = { version = "0.28.0", default-features = false, features = ["loadable_extension", "openssl-sys"] } +serde = { version = "1.0.203", default-features = false } +simdutf = { version = "0.4.17" } +smartstring = { version = "1.0.1", default-features = false } tikv-jemallocator = { version = "0.5.4", default-features = false, features = ["disable_initial_exec_tls"] } tokio = { version = "1", default-features = false, features = [ "fs", "io-util", + "io-std", "macros", "process", "rt-multi-thread", "sync", + "signal", + "signal-hook-registry", + "tracing", ] } tokio-uring = { version = "0.5.0" } toml = { version = "0.8.14", default-features = false } +toml_edit = { version = "0.22.15" } trauma = { version = "2.2.5" } typeshare = { version = "1.0.3" } +uuid = { version = "1.10.0", default-features = false, features = [ + "arbitrary", + "fast-rng", + "serde", + "v4", + "v7", + "v8", + "zerocopy", +] } vcpkg = { version = "0.2.15" } wild = { version = "2" } diff --git a/Makefile b/Makefile index 82e78be942..810b601a82 100644 --- a/Makefile +++ b/Makefile @@ -13,32 +13,59 @@ # Makefile: Elide # +# Build Configuration +# --------------------------------------------------------------------------------------------------------------------- VERSION ?= $(shell cat .version) -export STRICT ?= yes -export WASM ?= no -export RELOCK ?= no -DEFAULT_REPOSITORY ?= s3://elide-maven -REPOSITORY ?= $(DEFAULT_REPOSITORY) JVM ?= 22 +RELEASE ?= no SAMPLES ?= no SIGNING_KEY ?= F812016B REMOTE ?= no PUSH ?= no CHECK ?= yes +NATIVE ?= no +COVERAGE ?= yes +BUILD_NATIVE_IMAGE ?= no BUILD_STDLIB ?= no +RELEASE ?= no MACOS_MIN_VERSION ?= 12.3 +ENABLE_CCACHE ?= yes +ENABLE_SCCACHE ?= yes +CUSTOM_JVM ?= no +export STRICT ?= yes +export WASM ?= no +export RELOCK ?= no +DEFAULT_REPOSITORY ?= s3://elide-maven +REPOSITORY ?= $(DEFAULT_REPOSITORY) # Flags that are exported to the third_party build. export CUSTOM_ZLIB ?= no +# Required tools for build: +# --------------------------------------------------------------------------------------------------------------------- +# - Bash +# - Git +# - Rust +# - Java & GraalVM +# - Node.js & Yarn +# - Bazel +# - Buf +# - jq + +# Optional tools for build: +# --------------------------------------------------------------------------------------------------------------------- +# - ccache +# - sccache + # Flags that control this makefile, along with their defaults: -# +# --------------------------------------------------------------------------------------------------------------------- # DEBUG ?= no # STRICT ?= yes # RELEASE ?= no # JVMDEBUG ?= no # NATIVE ?= no +# BUILD_NATIVE_IMAGE ?= no # CI ?= no # DRY ?= no # SCAN ?= no @@ -58,12 +85,28 @@ export CUSTOM_ZLIB ?= no # GVM_PROFILE ?= (default for os) # BUILD_STDLIB ?= yes + +# Required packages for build: +# --------------------------------------------------------------------------------------------------------------------- + +LINUX_PKGS ?= libtool-bin tclsh build-essential git curl automake autoconf pkg-config +MACOS_PKGS ?= automake autoconf libtool pkg-config tcl-tk git curl + +# --------------------------------------------------------------------------------------------------------------------- +# Key Environment Variables + export PATH export JAVA_HOME export GRAALVM_HOME +# --------------------------------------------------------------------------------------------------------------------- +# Tools + GRADLE ?= ./gradlew +BASH ?= $(shell which bash) RUSTUP ?= $(shell which rustup) +CCACHE ?= $(shell which ccache) +SCCACHE ?= $(shell which sccache) CARGO ?= $(shell which cargo) YARN ?= $(shell which yarn) RM ?= $(shell which rm) @@ -85,16 +128,31 @@ NODE ?= $(shell which node) BUN ?= $(shell which bun) JAVA ?= $(shell which java) NATIVE_IMAGE ?= $(shell which native-image) +BUF ?= $(shell which buf) +JQ ?= $(shell which jq) +BAZEL ?= $(shell which bazel) +RUSTC ?= $(shell which rustc) +CARGO ?= $(shell which cargo) +LLVM_COV ?= $(shell which llvm-cov) +LLVM_PROFDATA ?= $(shell which llvm-profdata) +LLVM_CONFIG ?= $(shell which llvm-config) +CLANG ?= $(shell which clang) +LLD ?= $(shell which lld) +BOLT ?= $(shell which llvm-bolt) +PYTHON ?= $(shell which python) +RUFF ?= $(shell which ruff) +RUBY ?= $(shell which ruby) + +# --------------------------------------------------------------------------------------------------------------------- +# Build State/Environment + export ELIDE_ROOT ?= $(shell pwd) PWD ?= $(ELIDE_ROOT) TARGET ?= $(PWD)/build DIST ?= $(PWD)/target DOCS ?= $(PWD)/docs REPORTS ?= -BUF ?= $(shell which buf) SYSTEM ?= $(shell uname -s) -JQ ?= $(shell which jq) -BAZEL ?= $(shell which bazel) OS ?= $(shell uname -s) UNAME_P := $(shell uname -p) ARCH := $(shell uname -m) @@ -102,9 +160,25 @@ ARCH := $(shell uname -m) export PROJECT_ROOT ?= $(shell pwd) export ELIDE_ROOT ?= yes +ifeq ($(ENABLE_SCCACHE),yes) +ifeq ($(SCCACHE),) +ENABLE_SCCACHE = no +else +CACHE_MODE = sccache +endif +endif + +ifeq ($(CACHE_MODE),) +ifeq ($(ENABLE_CCACHE),yes) +ifeq ($(CCACHE),) +ENABLE_CCACHE = no +else +CACHE_MODE = ccache +endif +endif +endif + # Exports for `third_party` Makefile. -RELEASE ?= no -NATIVE ?= no export RELEASE export NATIVE export MACOS_MIN_VERSION @@ -118,7 +192,6 @@ endif PATH := $(shell echo $$PATH) # Handle custom Java home path. -CUSTOM_JVM ?= no JAVA_HOME ?= $(shell echo $$JAVA_HOME) GRAALVM_HOME ?= $(shell echo $$GRAALVM_HOME) @@ -259,18 +332,13 @@ endif OMIT_NATIVE ?= -x nativeCompile -x nativeTest -x nativeOptimizedCompile -ifneq ($(NATIVE),) -ifeq ($(NATIVE),no) -BUILD_ARGS += $(patsubst %,-x %,$(NATIVE_TASKS)) -OMIT_NATIVE = -else +ifeq ($(BUILD_NATIVE_IMAGE),yes) ifeq ($(RELEASE),yes) CLI_TASKS += :packages:cli:nativeOptimizedCompile -Pelide.buildMode=release -Pelide.release=true -PenableSigning=true -PbuildDocs=true else CLI_TASKS += :packages:cli:nativeCompile endif endif -endif ifneq ($(VERBOSE),) RULE ?= @@ -300,24 +368,37 @@ RUNTIME_GEN = $(JS_MODULE_OUT) $(PY_FACADE_OUT) $(PY_MODULE_OUT) GRADLE_OMIT ?= $(OMIT_NATIVE) _ARGS ?= $(GRADLE_ARGS) $(BUILD_ARGS) $(ARGS) -DEPS ?= node_modules/ third-party umbrella +DEPS ?= node_modules/ third-party GRADLE_PREFIX ?= JAVA_HOME="$(JAVA_HOME)" GRAALVM_HOME="$(GRAALVM_HOME)" PATH="$(PATH)" CC="" CXX="" CFLAGS="" LDFLAGS="" -# ---- Targets ---- # +ifeq ($(RELEASE),yes) +EXTRA_RUSTC_FLAGS ?= +else +ifeq ($(COVERAGE),yes) +EXTRA_RUSTC_FLAGS ?=-Cinstrument-coverage +endif +endif + +ifneq ($(EXTRA_RUSTC_FLAGS),) +RUSTC_FLAGS = "$(RUSTC_FLAGS) $(EXTRA_RUSTC_FLAGS)" +endif + +# --------------------------------------------------------------------------------------------------------------------- +# Targets all: build -setup: $(DEPS) ## Setup development pre-requisites. - $(MAKE) symlinks RELEASE=$(RELEASE) +dependency-packages: ## Print the suite of dependencies to install for this OS. +ifeq ($(OS),Darwin) + @printf "$(MACOS_PKGS)" +else + @printf "$(LINUX_PKGS)" +endif -symlinks: - @echo "Mounting native layer (mode '$(BUILD_MODE)')..." - $(CMD)rm -f $(ELIDE_ROOT)/target/lib $(ELIDE_ROOT)/target/include - $(CMD)ln -s $(TARGET_ROOT)/lib $(ELIDE_ROOT)/target/lib - $(CMD)ln -s $(TARGET_ROOT)/include $(ELIDE_ROOT)/target/include +setup: $(DEPS) ## Setup development pre-requisites. -build: $(DEPS) symlinks ## Build the main library, and code-samples if SAMPLES=yes. +build: $(DEPS) ## Build the main library, and code-samples if SAMPLES=yes. $(info Building Elide $(VERSION)...) ifeq ($(BUILD_MODE),release) $(CMD)$(CARGO) build --release @@ -326,7 +407,7 @@ else endif $(CMD)$(GRADLE_PREFIX) $(GRADLE) build $(CLI_TASKS) $(GRADLE_OMIT) $(_ARGS) -native: ## Build Elide's native image target; use BUILD_MODE=release for a release binary. +native: $(DEPS) ## Build Elide's native image target; use BUILD_MODE=release for a release binary. $(info Building Elide native $(VERSION) ($(BUILD_MODE))...) ifeq ($(BUILD_MODE),release) $(CMD)$(GRADLE_PREFIX) $(GRADLE) :packages:cli:nativeOptimizedCompile $(_ARGS) @@ -334,10 +415,51 @@ else $(CMD)$(GRADLE_PREFIX) $(GRADLE) :packages:cli:nativeCompile $(_ARGS) endif -test: ## Run the library testsuite, and code-sample tests if SAMPLES=yes. +natives-test: $(DEPS) ## Run Cargo and native tests, optionally buildin coverage if COVERAGE=yes. +ifeq ($(COVERAGE),yes) + $(info Running native tests (+coverage)...) + $(CMD)$(BASH) ./tools/scripts/cargo-test-coverage.sh \ + && $(BASH) ./tools/scripts/cargo-coverage-report.sh +else + $(info Running native tests...) + $(CMD)$(CARGO) test +endif + +natives-coverage: ## Show the current native coverage report; only run if `natives-test` is run first. + $(info Opening coverage report...) + $(CMD)$(BASH) ./tools/scripts/cargo-coverage-show.sh + +test: $(DEPS) ## Run the library testsuite, and code-sample tests if SAMPLES=yes. $(info Running testsuite...) - $(CMD)$(GRADLE_PREFIX) $(GRADLE) test check $(_ARGS) - $(CMD)$(GRADLE_PREFIX) $(GRADLE) :packages:cli:optimizedRun --args="selftest" + $(CMD)$(MAKE) natives-test + @#we need the debug libs for the tests, which do not produce them; so we re-build them here, but with flags aligned to + @#what coverage would add, to avoid a significant invalidation and re-build. + $(CMD)RUSTFLAGS="-C instrument-coverage" $(CARGO) build -p sqlite + $(CMD)$(GRADLE_PREFIX) $(GRADLE) test $(_ARGS) -x detekt -x spotlessCheck -x apiCheck + @#since we are running using instrumented code, profiles may be written; delete them after running tests + $(CMD)-$(FIND) ./packages -name "*.profraw" -delete + +check: $(DEPS) ## Build all targets, run all tests, run all checks. + $(info Running testsuite...) + $(CMD)$(MAKE) natives-test + $(CMD)RUSTFLAGS="-C instrument-coverage" $(CARGO) build -p sqlite + $(CMD)$(GRADLE_PREFIX) $(GRADLE) build test check $(_ARGS) + $(CMD)$(CARGO) clippy + $(CMD)$(PNPM) run prettier --check . + $(CMD)$(PNPM) biome format . + $(CMD)$(PNPM) biome check . + $(CMD)$(CARGO) fmt -- --check + $(CMD)$(RUFF) check packages + +format: ## Alias for `make fmt`. + $(CMD)$(MAKE) fmt + +fmt: ## Run all formatter tools. + $(info Running formatters...) + $(CMD)$(CARGO) fmt + $(CMD)$(PNPM) run prettier --write . + $(CMD)$(PNPM) biome format --write . + $(CMD)$(RUFF) format packages gvm: .graalvm-home ## Build a custom copy of GraalVM for use locally. @echo "GraalVM is ready (profile: $(GVM_PROFILE))." @@ -471,9 +593,9 @@ endif UMBRELLA_TARGET_PATH = target/$(UMBRELLA_TARGET) -umbrella: $(UMBRELLA_TARGET_PATH) ## Build the native umbrella tooling library. +umbrella: third-party $(UMBRELLA_TARGET_PATH) ## Build the native umbrella tooling library. -$(UMBRELLA_TARGET_PATH): +$(UMBRELLA_TARGET_PATH): third_party/lib $(info Building tools/umbrella...) ifeq ($(BUILD_MODE),release) $(CMD)$(CARGO) build --release @@ -509,15 +631,12 @@ clean-natives: ## Clean local native targets. $(CMD)rm -fr target $(CMD)$(MAKE) -C third_party clean -natives: ## Rebuild natives (C/C++ and Rust). - $(CMD)$(MAKE) -C third_party clean - @echo "" && echo "Building natives (mode: $(BUILD_MODE), native: $(NATIVE))..." - $(CMD)make -C third_party RELEASE=$(RELEASE) NATIVE=$(NATIVE) - $(CMD)$(MAKE) symlinks RELEASE=$(RELEASE) - @echo "" && echo "Building Rust stdlib (mode: $(BUILD_MODE), native: $(NATIVE))..." +natives: $(DEPS) ## Rebuild natives (C/C++ and Rust). ifeq ($(BUILD_STDLIB),yes) + @echo "" && echo "Building Rust stdlib (mode: $(BUILD_MODE), native: $(NATIVE))..." $(CMD)$(CARGO) run +nightly -Zbuild-std --target $(RUSTC_TARGET) endif + @echo "" && echo "Building Elide crates..." $(CMD)$(CARGO) build $(CARGO_FLAGS) third-party: third_party/sqlite third_party/lib ## Build all third-party embedded projects. @@ -530,7 +649,7 @@ third_party/sqlite: third_party/lib: @echo "Building third-party projects..." $(CMD)mkdir -p $(TARGET_ROOT) - $(CMD)$(MAKE) RELOCK=$(RELOCK) -C third_party -j`nproc` && mkdir -p third_party/lib + $(CMD)$(MAKE) RELOCK=$(RELOCK) -C third_party && mkdir -p third_party/lib @echo "" cli-release-artifacts: @@ -584,7 +703,7 @@ cli-install-local: @echo ""; echo "Done. Testing CLI tool..." $(CMD)elide --version -clean: clean-docs ## Clean build outputs and caches. +clean: clean-docs clean-natives ## Clean build outputs and caches. @echo "Cleaning targets..." $(CMD)$(RM) -fr$(strip $(POSIX_FLAGS)) $(TARGET) $(CMD)$(FIND) . -name .DS_Store -delete @@ -781,15 +900,25 @@ info: ## Show info about the current codebase and toolchain. @echo "JVM target: $(JVM)" @echo "Java Home: $(JAVA_HOME)" @echo "GraalVM Home: $(GRAALVM_HOME)" + @echo "" && echo "---- OS Info ----------------------------------------------" + @echo "- System: $(SYSTEM)" + @echo "- Kernel: $(shell uname -r)" + @echo "- Hostname: $(shell hostname)" @echo "" && echo "---- Toolchain --------------------------------------------" @echo "- Java: $(JAVA)" @echo "- Native Image: $(NATIVE_IMAGE)" - @echo "- Rust: $(RUSTUP)" + @echo "- Python: $(PYTHON)" + @echo "- Ruby: $(RUBY)" + @echo "- Bun: $(BUN)" + @echo "- Node: $(NODE)" + @echo "- Rust: $(RUSTC)" @echo "- Cargo: $(CARGO)" + @echo "- Clang: $(CLANG)" + @echo "- LLD: $(LLD)" + @echo "- Bolt: $(BOLT)" @echo "- Yarn: $(YARN)" @echo "- Bazel: $(BAZEL)" @echo "- Buf: $(BUF)" - @echo "- Node: $(NODE)" @echo "- PNPM: $(PNPM)" @echo "" && echo "---- Toolchain Versions -----------------------------------" @echo "Java:" @@ -798,17 +927,36 @@ info: ## Show info about the current codebase and toolchain. @echo "Native Image:" $(CMD)$(NATIVE_IMAGE) --version @echo "" - @echo "Rustup:" - $(CMD)$(RUSTUP) --version + @echo "Python:" + $(CMD)-$(PYTHON) --version + @echo "" + @echo "Ruby:" + $(CMD)-$(RUBY) --version + @echo "" + @echo "Rust:" + $(CMD)-$(RUSTC) --version @echo "" @echo "Cargo:" - $(CMD)$(CARGO) --version + $(CMD)-$(CARGO) --version @echo "" + @echo "Clang:" + $(CMD)-$(CLANG) --version + @echo "" + @echo "LLD:" + $(CMD)-$(LLD) --version + @echo "" + @echo "Bolt:" + $(CMD)-$(BOLT) --version @echo "Yarn:" - $(CMD)$(YARN) --version + $(CMD)-$(YARN) --version @echo "" @echo "Bazel:" - $(CMD)$(BAZEL) --version + $(CMD)-$(BAZEL) --version +ifneq ($(BUN),) + @echo "" + @echo "Bun:" + $(CMD)$(BUN) --version +endif @echo "" @echo "Buf:" $(CMD)$(BUF) --version @@ -818,18 +966,30 @@ info: ## Show info about the current codebase and toolchain. @echo "" @echo "PNPM:" $(CMD)$(PNPM) --version - @echo "" && echo "---- OS Info ----------------------------------------------" - @echo "- System: $(SYSTEM)" - @echo "- Kernel: $(shell uname -r)" - @echo "- Hostname: $(shell hostname)" + @echo "" && echo "---- Utilities --------------------------------------------" + @echo "- BASH: $(BASH)" + @echo "- BUF: $(BUF)" + @echo "- GPG2: $(GPG2)" + @echo "- JQ: $(JQ)" + @echo "- LLVM_COV: $(LLVM_COV)" + @echo "- LLVM_PROFDATA: $(LLVM_PROFDATA)" + @echo "- LLVM_CONFIG: $(LLVM_CONFIG)" + @echo "- TAR: $(TAR)" + @echo "- UNZIP: $(UNZIP)" + @echo "- XZ: $(XZ)" + @echo "- ZIP: $(ZIP)" + @echo "- ZSTD: $(ZSTD)" @echo "" && echo "---- Environment ------------------------------------------" - @echo "- PATH: $(shell echo $$PATH)" @echo "- CC: $(shell echo $$CC)" + @echo "- CXX: $(shell echo $$CXX)" + @echo "- LD: $(shell echo $$LD)" @echo "- CFLAGS: $(shell echo $$CFLAGS)" @echo "- LDFLAGS: $(shell echo $$LDFLAGS)" @echo "- CPPFLAGS: $(shell echo $$CPPFLAGS)" @echo "- JAVA_HOME: $(shell echo $$JAVA_HOME)" @echo "- GRAALVM_HOME: $(shell echo $$GRAALVM_HOME)" + @echo "- RUSTFLAGS: $(shell echo $$RUSTFLAGS)" + @echo "- PATH: $(shell echo $$PATH)" # ---- Runtime submodule ---- # # Note: make sure the Git submodule is up to date by running `git submodule update [--init] runtime` diff --git a/biome.jsonc b/biome.jsonc index 1d6330d18e..657a189d14 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,7 +1,7 @@ { "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", "organizeImports": { - "enabled": true, + "enabled": true }, "files": { "ignore": [ @@ -21,26 +21,26 @@ "packages/*/src/*/resources/META-INF/native-image/dev/elide/*/*.json", "packages/*/src/*/resources/META-INF/native-image/dev.elide/*/*.json", "packages/server/src/test/resources/manifests/app.assets.pb.json", - "packages/graalvm/src/test/resources/META-INF/elide/embedded/harness.js", - ], + "packages/graalvm/src/test/resources/META-INF/elide/embedded/harness.js" + ] }, "linter": { "enabled": true, "rules": { - "recommended": true, - }, + "recommended": true + } }, "formatter": { "indentStyle": "space", "indentWidth": 2, - "lineWidth": 120, + "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "double", "trailingCommas": "all", "semicolons": "asNeeded", - "arrowParentheses": "asNeeded", - }, - }, + "arrowParentheses": "asNeeded" + } + } } diff --git a/buf.work.yaml b/buf.work.yaml index 83ba607810..1878b341be 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -1,4 +1,3 @@ version: v1 directories: - proto - - crates/model diff --git a/build.gradle.kts b/build.gradle.kts index 33595c6309..779062a0fb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,12 +15,6 @@ * Elide Runtime + Framework */ -@file:Suppress( - "UnstableApiUsage", - "unused", - "DSL_SCOPE_VIOLATION", -) - import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.report.ReportMergeTask import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel @@ -37,9 +31,11 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension import org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension -import org.owasp.dependencycheck.reporting.ReportGenerator.Format.* +import org.owasp.dependencycheck.reporting.ReportGenerator.Format.HTML +import org.owasp.dependencycheck.reporting.ReportGenerator.Format.SARIF import java.util.Properties -import kotlinx.kover.gradle.plugin.dsl.* +import kotlinx.kover.gradle.plugin.dsl.GroupingEntityType +import kotlinx.kover.gradle.plugin.dsl.MetricType import kotlinx.validation.KotlinApiCompareTask import elide.internal.conventions.project.Projects @@ -250,19 +246,21 @@ spotless { // sonar { properties { + property("sonar.verbose", "true") property("sonar.projectKey", "elide-dev_v3") property("sonar.organization", "elide-dev") property("sonar.host.url", "https://sonarcloud.io") property("sonar.dynamicAnalysis", "reuseReports") property("sonar.junit.reportsPath", "build/reports/") property("sonar.java.coveragePlugin", "jacoco") + property("sonar.java.enablePreview", "true") property("sonar.sourceEncoding", "UTF-8") property("sonar.coverage.jacoco.xmlReportPaths", "build/reports/kover/report.xml") listOf( "sonar.java.checkstyle.reportPaths" to "build/reports/checkstyle/main.xml", "sonar.java.pmd.reportPaths" to "build/reports/pmd/main.xml", - "sonar.kotlin.detekt.reportPaths" to "build/reports/detekt/detekt.xml", + "sonar.sarifReportPaths" to "reports/detekt/detekt.sarif", "sonar.kotlin.ktlint.reportPaths" to "", "sonar.kotlin.diktat.reportPaths" to "", ).filter { it.second.isNotBlank() }.forEach { @@ -350,7 +348,6 @@ apiValidation { ignoredProjects += listOf( "cli", - "cli-bridge", "sqlite", "transport", "transport-common", @@ -429,7 +426,7 @@ plugins.withType(YarnPlugin::class.java) { // configure { // Top-level settings - format = listOf(HTML).joinToString(",") { it.toString() } + format = listOf(HTML, SARIF).joinToString(",") { it.toString() } scanBuildEnv = true scanDependencies = true autoUpdate = true @@ -690,7 +687,7 @@ tasks { // --- Task: Sonar // sonar.configure { - dependsOn( + mustRunAfter( detekt, koverBinaryReport, koverXmlReport, diff --git a/buildscript-gradle.lockfile b/buildscript-gradle.lockfile index 18243f7ee9..c9db57854d 100644 --- a/buildscript-gradle.lockfile +++ b/buildscript-gradle.lockfile @@ -46,7 +46,7 @@ io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.grad io.github.gradle-nexus:publish-plugin:1.3.0=classpath io.github.java-diff-utils:java-diff-utils:4.12=classpath io.github.jeremylong:jcs3-slf4j:1.0.5=classpath -io.github.jeremylong:open-vulnerability-clients:6.1.1=classpath +io.github.jeremylong:open-vulnerability-clients:6.1.2=classpath jakarta.transaction:jakarta.transaction-api:1.3.3=classpath javax.activation:javax.activation-api:1.2.0=classpath javax.inject:javax.inject:1=classpath @@ -107,9 +107,9 @@ org.ow2.asm:asm-commons:9.6=classpath org.ow2.asm:asm-tree:9.6=classpath org.ow2.asm:asm-util:9.6=classpath org.ow2.asm:asm:9.6=classpath -org.owasp:dependency-check-core:10.0.1=classpath -org.owasp:dependency-check-gradle:10.0.1=classpath -org.owasp:dependency-check-utils:10.0.1=classpath +org.owasp:dependency-check-core:10.0.2=classpath +org.owasp:dependency-check-gradle:10.0.2=classpath +org.owasp:dependency-check-utils:10.0.2=classpath org.semver4j:semver4j:5.3.0=classpath org.slf4j:jcl-over-slf4j:1.7.28=classpath org.slf4j:slf4j-api:2.0.7=classpath diff --git a/crates/base/Cargo.toml b/crates/base/Cargo.toml new file mode 100644 index 0000000000..6be01d9e31 --- /dev/null +++ b/crates/base/Cargo.toml @@ -0,0 +1,43 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +[package] +name = "base" +edition = "2021" +license = "MIT" +workspace = "../.." +version = "1.0.0-alpha11-SNAPSHOT" + +[lib] +crate-type = ["lib"] + +[features] +default = ["simd", "alloc", "unsafe"] +alloc = ["base64/alloc", "base64-simd/alloc"] +simd = ["base64-simd/alloc"] +unstable = ["base64-simd/unstable"] +unsafe = [] + +[dependencies] +arbitrary = { workspace = true } +base64 = { workspace = true } +base64-simd = { workspace = true } +const_fn = { workspace = true } +const_panic = { workspace = true } +crc32fast = { workspace = true } +crc64fast = { workspace = true } +libabort = { workspace = true } +panic-abort = { workspace = true } +simdutf = { workspace = true } +smartstring = { workspace = true, default-features = false, features = ["arbitrary", "serde"] } +uuid = { workspace = true } diff --git a/crates/core/src/lib.rs b/crates/base/build.rs similarity index 73% rename from crates/core/src/lib.rs rename to crates/base/build.rs index 1518aba8f0..fecf0ceb7d 100644 --- a/crates/core/src/lib.rs +++ b/crates/base/build.rs @@ -11,17 +11,6 @@ * License for the specific language governing permissions and limitations under the License. */ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } +fn main() { + // Nothing at this time. } diff --git a/crates/base/src/b64.rs b/crates/base/src/b64.rs new file mode 100644 index 0000000000..7876f61a95 --- /dev/null +++ b/crates/base/src/b64.rs @@ -0,0 +1,564 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +use base64::{ + engine::general_purpose::STANDARD as BASE64_STANDARD, + engine::general_purpose::STANDARD_NO_PAD as BASE64_STANDARD_NOPAD, + engine::general_purpose::URL_SAFE as BASE64_URLSAFE, + engine::general_purpose::URL_SAFE_NO_PAD as BASE64_URLSAFE_NOPAD, + Engine as B64Engine, +}; + +#[cfg(feature = "alloc")] +extern crate alloc; + +#[cfg(feature = "alloc")] +use {crate::prelude::*, alloc::string::String as StdString, alloc::vec::Vec}; + +#[cfg(feature = "simd")] +use base64_simd::{ + Out as Base64Out, + STANDARD as BASE64_STANDARD_SIMD, + STANDARD_NO_PAD as BASE64_STANDARD_NOPAD_SIMD, + URL_SAFE as BASE64_URLSAFE_SIMD, + URL_SAFE_NO_PAD as BASE64_URLSAFE_NOPAD_SIMD, +}; + +/// Estimate the length of a base64 encoded string. +/// +/// This method is provided publicly so that callers can estimate the size of a stack-allocated output buffer. +/// +/// # Arguments +/// +/// * `input` - The length of the input byte-slice to encode. +/// * `padding` - Whether to account for padding in the output with `=` characters. +/// +/// Returns the estimated length of the base64 encoded string. +#[inline] +pub const fn base64_estimate_encoded_len(input: usize, padding: bool) -> usize { + base64::encoded_len(input, padding) + .expect("integer overflow while estimating base64 encoded length") +} + +/// Estimate the length of a base64 string, once decoded. +/// +/// This method is provided publicly so that callers can estimate the size of a stack-allocated output buffer. +/// +/// # Arguments +/// +/// * `input` - The length of the subject byte-slice. +/// +/// Returns the estimated length of the string once decoded. +#[inline] +pub fn base64_estimate_decoded_len(input: usize) -> usize { + base64::decoded_len_estimate(input) +} + +/// Encode a byte slice to a base64 output vector. +/// +/// This method only allocates for `output` if necessary; `output` may be truncated if the output size is expected to be +/// smaller than the available space. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - The output vector to write the base64 encoded data to. +/// * `padding` - Whether to pad the output with `=` characters. +/// * `urlsafe` - Whether to use the URL-safe base64 alphabet. +#[inline] +pub(crate) fn base64_encode_sync(input: &[u8], output: &mut Vec, padding: bool, urlsafe: bool) { + let base64 = if urlsafe { + if padding { + BASE64_URLSAFE + } else { + BASE64_URLSAFE_NOPAD + } + } else if padding { + BASE64_STANDARD + } else { + BASE64_STANDARD_NOPAD + }; + let expected_len = base64::encoded_len(input.len(), padding) + .expect("integer overflow while estimating base64 encoded length"); + output.resize(expected_len, 0); + base64 + .encode_slice(input, output) + .expect("base64 encoding failed"); +} + +/// Encode a byte slice to a base64 output vector. +/// +/// This method only allocates for `output` if necessary; `output` may be truncated if the output size is expected to be +/// smaller than the available space. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - The output vector to write the base64 encoded data to. +/// * `padding` - Whether to pad the output with `=` characters. +/// * `urlsafe` - Whether to use the URL-safe base64 alphabet. +#[inline] +pub(crate) fn base64_encode_sync_str<'a>( + input: &'a [u8], + output: &'a mut [u8], + padding: bool, + urlsafe: bool, +) { + if urlsafe { + if padding { + BASE64_URLSAFE + } else { + BASE64_URLSAFE_NOPAD + } + } else if padding { + BASE64_STANDARD + } else { + BASE64_STANDARD_NOPAD + } + .encode_slice(input, output) + .expect("base64 encoding failed"); +} + +/// Encode a byte slice to a base64 output string; this variant uses standard Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `padding` - Whether to pad the output with `=` characters. +/// +/// Returns a `String` containing the base64 encoded data. +#[cfg(feature = "alloc")] +#[inline] +pub fn base64_std_encode_string_sync(input: &[u8], padding: bool) -> String { + let mut outvec = Vec::new(); + base64_encode_sync(input, &mut outvec, padding, false); + #[cfg(not(feature = "unsafe"))] + let out = StdString::from_utf8(outvec).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { StdString::from_utf8_unchecked(outvec) }; + out.into() +} + +/// Encode a byte slice to a base64 output string; this variant uses standard Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output`- Pre-allocated output byte array. +/// * `padding` - Whether to pad the output with `=` characters. +/// +/// Returns a `&str` containing the base64 encoded data. +#[inline] +pub fn base64_std_encode_str_sync<'a>( + input: &'a [u8], + output: &'a mut [u8], + padding: bool, +) -> &'a str { + base64_encode_sync_str(input, output, padding, false); + #[cfg(not(feature = "unsafe"))] + let out = core::str::from_utf8_mut(output).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { core::str::from_utf8_unchecked_mut(output) }; + out +} + +/// Encode a byte slice to a base64 output string; this variant uses URL-safe Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `padding` - Whether to pad the output with `=` characters. +/// * Returns a `String` containing the base64 encoded data. +#[cfg(feature = "alloc")] +#[inline] +pub fn base64_url_encode_string_sync(input: &[u8], padding: bool) -> String { + let mut outvec = Vec::new(); + base64_encode_sync(input, &mut outvec, padding, true); + #[cfg(not(feature = "unsafe"))] + let out = StdString::from_utf8(outvec).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { StdString::from_utf8_unchecked(outvec) }; + out.into() +} + +/// Encode a byte slice to a base64 output string; this variant uses URL-safe Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - Pre-allocated output byte array. +/// * `padding` - Whether to pad the output with `=` characters. +/// +/// Returns a `&str` containing the base64 encoded data. +#[inline] +pub fn base64_url_encode_str_sync<'a>( + input: &'a [u8], + output: &'a mut [u8], + padding: bool, +) -> &'a str { + base64_encode_sync_str(input, output, padding, true); + #[cfg(not(feature = "unsafe"))] + let out = core::str::from_utf8_mut(output).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { core::str::from_utf8_unchecked_mut(output) }; + out +} + +/// Encode a byte slice to a base64 output vector, using SIMD instructions if available. +/// +/// This method only allocates for `output` if necessary; `output` may be truncated if the output size is expected to be +/// smaller than the available space. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - The output vector to write the base64 encoded data to. +/// * `padding` - Whether to pad the output with `=` characters. +/// * `urlsafe` - Whether to use the URL-safe base64 alphabet. +#[cfg(feature = "simd")] +#[inline] +pub(crate) fn base64_encode_simd<'a>( + input: &'a [u8], + output: Base64Out<'a, [u8]>, + padding: bool, + urlsafe: bool, +) -> &'a mut [u8] { + if urlsafe { + if padding { + BASE64_URLSAFE_SIMD + } else { + BASE64_URLSAFE_NOPAD_SIMD + } + } else if padding { + BASE64_STANDARD_SIMD + } else { + BASE64_STANDARD_NOPAD_SIMD + } + .encode(input, output) +} + +/// Encode a byte slice to a base64 output string using SIMD instructions, if available; this variant uses standard +/// Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `padding` - Whether to pad the output with `=` characters. +/// * Returns a `String` containing the base64 encoded data. +#[cfg(all(feature = "simd", feature = "alloc",))] +#[inline] +pub fn base64_std_encode_string_simd(input: &[u8], padding: bool) -> String { + let mut outvec = Vec::new(); + let size = base64_estimate_encoded_len(input.len(), padding); + outvec.resize(size, 0); + let b64out = Base64Out::from_slice(&mut outvec); + base64_encode_simd(input, b64out, padding, false); + #[cfg(not(feature = "unsafe"))] + let out = StdString::from_utf8(outvec).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { StdString::from_utf8_unchecked(outvec) }; + out.into() +} + +/// Encode a byte slice to a base64 output string using SIMD instructions, if available; this variant uses standard +/// Base64, with optional padding. +/// +/// This method uses `base64_encode_simd` without allocating. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - Pre-allocated output byte array. +/// * `padding` - Whether to pad the output with `=` characters. +#[cfg(feature = "simd")] +#[inline] +pub fn base64_std_encode_str_simd<'a>( + input: &'a [u8], + output: &'a mut [u8], + padding: bool, +) -> &'a str { + let b64out = Base64Out::from_slice(output); + base64_encode_simd(input, b64out, padding, false); + #[cfg(not(feature = "unsafe"))] + let out = core::str::from_utf8_mut(output).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { core::str::from_utf8_unchecked_mut(output) }; + out +} + +/// Encode a byte slice to a base64 output string using SIMD instructions, if available; this variant uses URL-safe +/// Base64, with optional padding. +/// +/// This method uses `base64_encode_simd` without allocating. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `output` - Pre-allocated output byte array. +/// * `padding` - Whether to pad the output with `=` characters. +#[cfg(feature = "simd")] +#[inline] +pub fn base64_url_encode_str_simd<'a>( + input: &'a [u8], + output: &'a mut [u8], + padding: bool, +) -> &'a str { + let b64out = Base64Out::from_slice(output); + base64_encode_simd(input, b64out, padding, true); + #[cfg(not(feature = "unsafe"))] + let out = core::str::from_utf8_mut(output).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { core::str::from_utf8_unchecked_mut(output) }; + out +} + +/// Encode a byte slice to a base64 output string using SIMD instructions, if available; this variant uses URL-safe +/// Base64, with optional padding. +/// +/// This method uses `base64_encode_sync` and then allocates into a `String`. +/// +/// # Arguments +/// +/// * `input` - The input byte-slice to encode. +/// * `padding` - Whether to pad the output with `=` characters. +/// * Returns a `String` containing the base64 encoded data. +#[cfg(all(feature = "simd", feature = "alloc",))] +#[inline] +pub fn base64_url_encode_string_simd(input: &[u8], padding: bool) -> String { + let mut outvec = Vec::new(); + let size = base64_estimate_encoded_len(input.len(), padding); + outvec.resize(size, 0); + let b64out = Base64Out::from_slice(&mut outvec); + base64_encode_simd(input, b64out, padding, true); + #[cfg(not(feature = "unsafe"))] + let out = StdString::from_utf8(outvec).expect("base64 encoding failed"); + #[cfg(feature = "unsafe")] + let out = unsafe { StdString::from_utf8_unchecked(outvec) }; + out.into() +} + +#[cfg(test)] +mod tests { + extern crate test; + use super::*; + use test::Bencher; + + const HELLO_WORLD: &[u8] = b"Hello, world!"; + const HELLO_WORLD_B64_STD_PAD: &str = "SGVsbG8sIHdvcmxkIQ=="; + const HELLO_WORLD_B64_STD_NOPAD: &str = "SGVsbG8sIHdvcmxkIQ"; + const MEDIUM_RANDOM_TEXT_ENCODED_LENGTH: usize = 164; + const MEDIUM_RANDOM_TEXT: &[u8] = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; + const LONG_RANDOM_TEXT_ENCODED_LENGTH: usize = 592; + const LONG_RANDOM_TEXT: &[u8] = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + + #[test] + #[cfg(feature = "alloc")] + fn b64_std_encode_string_sync() { + assert_eq!(base64_std_encode_string_sync(b"", true), ""); + assert_eq!(base64_std_encode_string_sync(b"f", true), "Zg=="); + assert_eq!(base64_std_encode_string_sync(b"f", false), "Zg"); + assert_eq!(base64_std_encode_string_sync(b"fo", true), "Zm8="); + assert_eq!(base64_std_encode_string_sync(b"fo", false), "Zm8"); + assert_eq!(base64_std_encode_string_sync(b"foo", true), "Zm9v"); + assert_eq!( + base64_std_encode_string_sync(HELLO_WORLD, true), + HELLO_WORLD_B64_STD_PAD + ); + assert_eq!( + base64_std_encode_string_sync(HELLO_WORLD, false), + HELLO_WORLD_B64_STD_NOPAD + ); + } + + #[test] + fn b64_std_encode_str_sync() { + let input = b"foo"; + let mut output = [0u8; 4]; + assert_eq!(base64_std_encode_str_sync(input, &mut output, true), "Zm9v"); + } + + #[test] + #[cfg(feature = "alloc")] + fn b64_url_encode_string_sync() { + assert_eq!(base64_std_encode_string_sync(b"", true), ""); + assert_eq!(base64_std_encode_string_sync(b"f", true), "Zg=="); + assert_eq!(base64_std_encode_string_sync(b"f", false), "Zg"); + assert_eq!(base64_std_encode_string_sync(b"fo", true), "Zm8="); + assert_eq!(base64_std_encode_string_sync(b"fo", false), "Zm8"); + assert_eq!(base64_std_encode_string_sync(b"foo", true), "Zm9v"); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_std_encode_padded_sync_string_short(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_sync(b"Hello, world!", true)); + } + + #[bench] + fn b64_std_encode_padded_sync_str_short(b: &mut Bencher) { + b.iter(|| { + let input = b"foo"; + let mut output = [0u8; 4]; + base64_std_encode_str_sync(input, &mut output, true); + }); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_std_encode_padded_sync_string_medium(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_sync(MEDIUM_RANDOM_TEXT, true)); + } + + #[bench] + fn b64_std_encode_padded_sync_str_medium(b: &mut Bencher) { + b.iter(|| { + let mut output = [0u8; MEDIUM_RANDOM_TEXT_ENCODED_LENGTH]; + base64_std_encode_str_sync(MEDIUM_RANDOM_TEXT, &mut output, true); + }); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_std_encode_padded_sync_string_long(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_sync(LONG_RANDOM_TEXT, true)); + } + + #[bench] + fn b64_std_encode_padded_sync_str_long(b: &mut Bencher) { + b.iter(|| { + let mut output = [0u8; LONG_RANDOM_TEXT_ENCODED_LENGTH]; + base64_std_encode_str_sync(LONG_RANDOM_TEXT, &mut output, true); + }); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_url_encode_padded_sync_string_short(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_sync(b"Hello, world!", true)); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_url_encode_padded_sync_string_medium(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_sync(MEDIUM_RANDOM_TEXT, true)); + } + + #[bench] + #[cfg(feature = "alloc")] + fn b64_url_encode_padded_sync_string_long(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_sync(LONG_RANDOM_TEXT, true)); + } + + #[test] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_std_encode_string_simd() { + assert_eq!(base64_std_encode_string_simd(b"", true), ""); + assert_eq!(base64_std_encode_string_simd(b"f", true), "Zg=="); + assert_eq!(base64_std_encode_string_simd(b"f", false), "Zg"); + assert_eq!(base64_std_encode_string_simd(b"fo", true), "Zm8="); + assert_eq!(base64_std_encode_string_simd(b"fo", false), "Zm8"); + assert_eq!(base64_std_encode_string_simd(b"foo", true), "Zm9v"); + assert_eq!( + base64_std_encode_string_sync(HELLO_WORLD, true), + HELLO_WORLD_B64_STD_PAD + ); + assert_eq!( + base64_std_encode_string_sync(HELLO_WORLD, false), + HELLO_WORLD_B64_STD_NOPAD + ); + } + + #[test] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_url_encode_string_simd() { + assert_eq!(base64_std_encode_string_simd(b"", true), ""); + assert_eq!(base64_std_encode_string_simd(b"f", true), "Zg=="); + assert_eq!(base64_std_encode_string_simd(b"f", false), "Zg"); + assert_eq!(base64_std_encode_string_simd(b"fo", true), "Zm8="); + assert_eq!(base64_std_encode_string_simd(b"fo", false), "Zm8"); + assert_eq!(base64_std_encode_string_simd(b"foo", true), "Zm9v"); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_std_encode_padded_simd_string_short(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_simd(b"Hello, world!", true)); + } + + #[bench] + fn b64_std_encode_padded_simd_str_short(b: &mut Bencher) { + b.iter(|| { + let input = b"foo"; + let mut output = [0u8; 4]; + base64_std_encode_str_simd(input, &mut output, true); + }); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_std_encode_padded_simd_string_medium(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_simd(MEDIUM_RANDOM_TEXT, true)); + } + + #[bench] + fn b64_std_encode_padded_simd_str_medium(b: &mut Bencher) { + b.iter(|| { + let mut output = [0u8; MEDIUM_RANDOM_TEXT_ENCODED_LENGTH]; + base64_std_encode_str_simd(MEDIUM_RANDOM_TEXT, &mut output, true); + }); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_std_encode_padded_simd_string_long(b: &mut Bencher) { + b.iter(|| base64_std_encode_string_simd(LONG_RANDOM_TEXT, true)); + } + + #[bench] + fn b64_std_encode_padded_simd_str_long(b: &mut Bencher) { + b.iter(|| { + let mut output = [0u8; LONG_RANDOM_TEXT_ENCODED_LENGTH]; + base64_std_encode_str_simd(LONG_RANDOM_TEXT, &mut output, true); + }); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_url_encode_padded_simd_string_short(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_simd(b"Hello, world!", true)); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_url_encode_padded_simd_string_medium(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_simd(MEDIUM_RANDOM_TEXT, true)); + } + + #[bench] + #[cfg(all(feature = "simd", feature = "alloc"))] + fn b64_url_encode_padded_simd_string_long(b: &mut Bencher) { + b.iter(|| base64_url_encode_string_simd(LONG_RANDOM_TEXT, true)); + } +} diff --git a/crates/base/src/crc.rs b/crates/base/src/crc.rs new file mode 100644 index 0000000000..dfa25701bf --- /dev/null +++ b/crates/base/src/crc.rs @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +use crc32fast::Hasher as CRC32; +use crc64fast::Digest as CRC64; + +/// Compute the CRC32 checksum of the given data. +/// +/// This function is a wrapper around the `crc32fast` crate. +/// +/// # Arguments +/// * `data` - The data to compute the checksum of. +/// +/// # Returns +/// The CRC32 checksum of the data. +/// +/// # Examples +/// +/// ``` +/// use base::crc::crc32; +/// let data = b"hello, world!"; +/// let checksum = crc32(data); +/// assert_eq!(checksum, 1486392595); +/// ``` +#[inline] +pub fn crc32(data: &[u8]) -> u32 { + let mut hasher = CRC32::new(); + hasher.update(data); + hasher.finalize() +} + +/// Compute the CRC64 checksum of the given data. +/// +/// This function is a wrapper around the `crc64fast` crate. +/// +/// # Arguments +/// * `data` - The data to compute the checksum of. +/// +/// # Returns +/// The CRC64 checksum of the data. +/// +/// # Examples +/// +/// ``` +/// use base::crc::crc64; +/// let data = b"hello, world!"; +/// let checksum = crc64(data); +/// assert_eq!(checksum, 11638617936805349819); +/// ``` +#[inline] +pub fn crc64(data: &[u8]) -> u64 { + let mut hasher = CRC64::new(); + hasher.write(data); + hasher.sum64() +} + +#[cfg(test)] +mod tests { + extern crate test; + use super::*; + use test::Bencher; + + #[test] + fn crc32_basic() { + assert_eq!(crc32(b"hello, world!"), 1486392595); + assert_ne!(crc32(b"more data as an example"), 1486392595); + } + + #[test] + fn crc64_basic() { + assert_eq!(crc64(b"hello, world!"), 11638617936805349819); + } + + #[bench] + fn crc32_bench_u8(b: &mut Bencher) { + b.iter(|| { + crc32(b"hello, world!"); + }); + } + + #[bench] + fn crc64_bench_u8(b: &mut Bencher) { + b.iter(|| { + crc64(b"hello, world!"); + }); + } +} diff --git a/crates/base/src/hex.rs b/crates/base/src/hex.rs new file mode 100644 index 0000000000..295f23af16 --- /dev/null +++ b/crates/base/src/hex.rs @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/base/src/lib.rs b/crates/base/src/lib.rs new file mode 100644 index 0000000000..036f84f2db --- /dev/null +++ b/crates/base/src/lib.rs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![no_std] +#![feature(test)] +#![feature(const_option)] +#![feature(const_trait_impl)] +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +extern crate alloc; + +/// Base64 encoding and decoding. +pub mod b64; + +/// CRC32 checksums. +pub mod crc; + +/// SHA-type hashing. +pub mod sha; + +/// UTF-N operations. +pub mod utf; + +/// Hexadecimal encoding and decoding. +pub mod hex; + +/// UUID generation and parsing. +pub mod uuid; + +/// Random number generation. +pub mod rng; + +/// Rust module prelude. +pub mod prelude; diff --git a/crates/base/src/prelude.rs b/crates/base/src/prelude.rs new file mode 100644 index 0000000000..c5838b57f8 --- /dev/null +++ b/crates/base/src/prelude.rs @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +use smartstring::alias::String as SmartString; + +/// Alias main standard `String` to `SmartString`. +pub type String = SmartString; diff --git a/crates/base/src/rng.rs b/crates/base/src/rng.rs new file mode 100644 index 0000000000..295f23af16 --- /dev/null +++ b/crates/base/src/rng.rs @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/base/src/sha.rs b/crates/base/src/sha.rs new file mode 100644 index 0000000000..295f23af16 --- /dev/null +++ b/crates/base/src/sha.rs @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/base/src/utf.rs b/crates/base/src/utf.rs new file mode 100644 index 0000000000..295f23af16 --- /dev/null +++ b/crates/base/src/utf.rs @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/base/src/uuid.rs b/crates/base/src/uuid.rs new file mode 100644 index 0000000000..295f23af16 --- /dev/null +++ b/crates/base/src/uuid.rs @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/builder/Cargo.toml b/crates/builder/Cargo.toml index 29b92ebbca..4e58f486bb 100644 --- a/crates/builder/Cargo.toml +++ b/crates/builder/Cargo.toml @@ -22,5 +22,7 @@ version = "1.0.0-alpha11-SNAPSHOT" crate-type = ["lib"] [dependencies] -cc = { workspace = true } +base = { workspace = true } +model = { workspace = true } +cc = { workspace = true, features = ["parallel"] } bindgen = { workspace = true } diff --git a/crates/builder/src/lib.rs b/crates/builder/src/lib.rs index ab96f8baab..cf9001d6da 100644 --- a/crates/builder/src/lib.rs +++ b/crates/builder/src/lib.rs @@ -12,13 +12,16 @@ */ #![allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - improper_ctypes + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + improper_ctypes )] +#![feature(const_trait_impl)] #![forbid(unsafe_code, dead_code)] +pub use model::{Architecture as TargetArch, OperatingSystem as TargetOs}; + use bindgen::Builder; use cc::Build; use std::env; @@ -27,86 +30,155 @@ use std::env::var_os; use std::path::{Path, PathBuf}; use std::process::Command; -/// Internal function which runs a Makefile command, possibly against a sub-directory. -fn do_makefile_run(subdir: Option<&str>, command_line: &str) { - let env_make = var("MAKE").unwrap_or_else(|_| "make".to_string()); - let mut command = Command::new(env_make); - let root_project_path = root_project_path("Makefile"); - let root_subpath = match subdir { - Some(subdir) => format!("{}/{}", root_project_path, subdir), - None => root_project_path, - }; - command.arg("-f").arg("Makefile"); +/// Internal function which runs a Makefile command, possibly against a subdirectory. +/// +/// # Arguments +/// +/// * `subdir` - The subdirectory to run the command in. +/// * `command_line` - The command line to run. +/// +/// # Examples +/// +/// ``` +/// use builder::do_makefile_run; +/// do_makefile_run(None, "help"); +/// ``` +pub fn do_makefile_run(subdir: Option<&str>, command_line: &str) { + let env_make = var("MAKE").unwrap_or_else(|_| "make".to_string()); + let mut command = Command::new(env_make); + let root_project_path = var("ELIDE_ROOT").unwrap(); + command.current_dir(root_project_path.clone()); + if let Some(subpath) = subdir { + let root_subpath = format!("{}/{}", root_project_path, subpath); command.arg("-C").arg(root_subpath); - command.arg(command_line); - let status = command.status().expect("Failed to execute make"); - assert!(status.success()); + } + command.arg(command_line); + println!("Running make: {:?}", command); + let status = command.status().expect("Failed to execute make"); + assert!(status.success()); } /// Run a Makefile command in the project root. +/// +/// # Arguments +/// +/// * `command_line` - The command line to run. +/// +/// # Examples +/// +/// ``` +/// use builder::makefile_run; +/// makefile_run("help"); +/// ``` pub fn makefile_run(command_line: &str) { - do_makefile_run(None, command_line); + do_makefile_run(None, command_line); } /// Run a Makefile command in the project root. +/// +/// # Arguments +/// +/// * `subdir` - The subdirectory to run the command in. +/// * `command_line` - The command line to run. +/// +/// # Examples +/// +/// ``` +/// use builder::makefile_sub_run; +/// makefile_sub_run("third_party", "help"); +/// ``` pub fn makefile_sub_run(subdir: &str, command_line: &str) { - do_makefile_run(Some(subdir), command_line); + do_makefile_run(Some(subdir), command_line); } /// Run a closure if the provided path exists. +/// +/// # Arguments +/// +/// * `path` - The path to check for existence. +/// * `closure` - The closure to run if the path exists. +/// +/// # Examples +/// +/// ``` +/// use builder::{if_exists, root_project_path}; +/// if_exists(root_project_path("README.md").as_str(), || { +/// println!("README.md exists!"); +/// }); pub fn if_exists(path: &str, closure: impl FnOnce()) { - if Path::new(path).exists() { - closure(); - } + if Path::new(path).exists() { + closure(); + } } /// Run a closure if the provided path does not exist. +/// +/// # Arguments +/// +/// * `path` - The path to check for existence. +/// * `closure` - The closure to run if the path does not exist. +/// +/// # Examples +/// +/// ``` +/// use builder::{if_not_exists, root_project_path}; +/// if_not_exists(root_project_path("some-other-non-readme-file-that-does-not-exist.md").as_str(), || { +/// println!("bunk example file does not exist, as expected!"); +/// }); pub fn if_not_exists(path: &str, closure: impl FnOnce()) { - if !Path::new(path).exists() { - closure(); - } + if !Path::new(path).exists() { + closure(); + } } /// Run a command in the project root. +/// +/// # Arguments +/// +/// * `command` - The command to run. +/// * `command_line` - The command line to run. +/// +/// # Examples +/// +/// ``` +/// use builder::root_project_run; +/// root_project_run("ls", "-la", "Listing files in the project root"); +/// ``` pub fn root_project_run(command: &str, command_line: &str, message: &str) { - let status = Command::new(command) - .arg(command_line) - .status() - .expect(message); - assert!(status.success()); + let status = Command::new(command) + .arg(command_line) + .status() + .expect(message); + assert!(status.success()); } -/// Make sure the Elide codebase and build environment is setup properly. +/// Make sure the Elide codebase and build environment is set up properly. +/// +/// # Arguments +/// +/// * `closure` - The closure to run after setup; this is where project-specific setup tasks should be run. pub fn setup(closure: impl FnOnce()) { - let profile = var("PROFILE").unwrap(); - let profile_val = profile.as_str(); - let cmd_args = match profile_val { - "release" => "RELEASE=yes", - _ => "RELEASE=no", - }; - - // we need to update submodules if they cannot be found on-disk - if_not_exists(&root_project_path("third_party/sqlite/Makefile"), || { - root_project_run("git", "submodule update --init --recursive", "Updating submodules"); - }); - - // we need to install node modules if they are not present - if_not_exists(&root_project_path("node_modules"), || { - root_project_run("pnpm", "install", "Installing Node modules"); - }); - - // we need to build third-party libs if they are not built - if_not_exists(&root_project_path("target/lib"), || { - makefile_run(format!("third-party {}", cmd_args).as_str()); - }); - - // run project-specific setup tasks - closure(); + // we need to update submodules if they cannot be found on-disk + if_not_exists(&root_project_path("third_party/sqlite/Makefile"), || { + root_project_run( + "git", + "submodule update --init --recursive", + "Updating submodules", + ); + }); + + // we need to install node modules if they are not present + if_not_exists(&root_project_path("node_modules"), || { + root_project_run("pnpm", "install", "Installing Node modules"); + }); + + // run project-specific setup tasks + closure(); } /// Make sure the Elide codebase and build environment is setup properly; this variant uses no callback. pub fn ensure_setup() { - setup(|| {}); + setup(|| {}); } /// Build a path to a root project resource. @@ -123,9 +195,9 @@ pub fn ensure_setup() { /// // `path` should be: `/README.md` /// ``` pub fn root_project_path(path: &str) -> String { - let manifest_dir = var_os("PWD").unwrap(); - let folder_path = Path::new(&manifest_dir); - folder_path.join(path).to_str().unwrap().to_string() + let manifest_dir = var_os("ELIDE_ROOT").expect("No ELIDE_ROOT variable set"); + let folder_path = Path::new(&manifest_dir); + folder_path.join(path).to_str().unwrap().to_string() } /// Build a path to a third-party project. @@ -133,8 +205,16 @@ pub fn root_project_path(path: &str) -> String { /// # Arguments /// /// * `name` - The name of the project. +/// +/// # Examples +/// +/// ``` +/// use builder::third_party_project; +/// let path = third_party_project("sqlite"); +/// // `path` should be: `/third_party/sqlite` +/// ``` pub fn third_party_project(name: &str) -> String { - root_project_path(format!("third_party/{}", name).as_str()) + root_project_path(format!("third_party/{}", name).as_str()) } /// Build a path to a third-party source file. @@ -143,8 +223,16 @@ pub fn third_party_project(name: &str) -> String { /// /// * `project` - The name of the project. /// * `path` - The path to the source file. +/// +/// # Examples +/// +/// ``` +/// use builder::third_party_src_file; +/// let path = third_party_src_file("sqlite", "sqlite3.c"); +/// // `path` should be: `/third_party/sqlite/sqlite3.c` +/// ``` pub fn third_party_src_file(project: &str, path: &str) -> String { - root_project_path(format!("third_party/{}/{}", project, path).as_str()) + root_project_path(format!("third_party/{}/{}", project, path).as_str()) } /// Build a path to a project resource. @@ -158,12 +246,12 @@ pub fn third_party_src_file(project: &str, path: &str) -> String { /// ``` /// use builder::project_path; /// let path = project_path("src/main.rs"); -/// // `path` should be: `crates/example/src/main.rs` +/// // `path` should be: `/crates//src/main.rs` /// ``` pub fn project_path(path: &str) -> String { - let manifest_dir = var_os("CARGO_MANIFEST_DIR").unwrap(); - let folder_path = Path::new(&manifest_dir); - folder_path.join(path).to_str().unwrap().to_string() + let manifest_dir = var_os("CARGO_MANIFEST_DIR").expect("No CARGO_MANIFEST_DIR variable set"); + let folder_path = Path::new(&manifest_dir); + folder_path.join(path).to_str().unwrap().to_string() } /// Build a path to a project source file resource. @@ -180,7 +268,7 @@ pub fn project_path(path: &str) -> String { /// // `path` should be: `crates/example/src/main.rs` /// ``` pub fn src_file(path: &str) -> String { - project_path(format!("src/{}", path).as_str()) + project_path(format!("src/{}", path).as_str()) } /// Build a path to a project header file resource. @@ -197,194 +285,147 @@ pub fn src_file(path: &str) -> String { /// // `path` should be: `crates/example/headers/example.h` /// ``` pub fn header_file(path: &str) -> String { - project_path(format!("headers/{}", path).as_str()) + project_path(format!("headers/{}", path).as_str()) } /// Return the base include paths which should always be included in native builds. pub fn base_include_paths() -> Vec { - // get base folders and build profile - let gvm_home = gvm_home(); - let target_base = root_project_path("target"); - let profile = var("PROFILE").unwrap(); - let project_root = var("CARGO_MANIFEST_DIR").unwrap(); - let project_root_path = Path::new(&project_root); - let project_root_headers = project_root_path - .join("headers") - .to_str() - .unwrap() - .to_string(); - - // resolve os/arch from target - let target = var("TARGET").unwrap(); - let os = if target.contains("darwin") { - "darwin" - } else { - "linux" - }; - - vec![ - format!("{}/include", gvm_home), - format!("{}/include/{}", gvm_home, os), - format!("{}/{}/include", target_base, profile), - format!("{}/{}/include/apr-2", target_base, profile), - project_root_headers, - ] + // get base folders and build profile + let gvm_home = gvm_home(); + let target_base = root_project_path("target"); + let profile = var("PROFILE").expect("No PROFILE variable set"); + let project_root = var("CARGO_MANIFEST_DIR").expect("No CARGO_MANIFEST_DIR variable set"); + let project_root_path = Path::new(&project_root); + let project_headers = project_root_path + .join("headers") + .to_str() + .unwrap() + .to_string(); + let apr_headers = root_project_path("third_party/apache/apr/include"); + let sqlite_headers = root_project_path("third_party/sqlite/install/include"); + let boringssl_headers = root_project_path("third_party/google/boringssl/include"); + + // resolve os/arch from target + let target = var("TARGET").unwrap(); + let os = if target.contains("darwin") { + "darwin" + } else { + "linux" + }; + + vec![ + format!("{}/include", gvm_home), + format!("{}/include/{}", gvm_home, os), + format!("{}/{}/include", target_base, profile), + project_headers, + apr_headers, + sqlite_headers, + boringssl_headers, + ] } /// Resolve the path to the current Java home (`JAVA_HOME`). -pub fn java_home() -> String { - let java_home = var("JAVA_HOME"); - if java_home.is_err() { - panic!("Please set the JAVA_HOME environment variable"); - } - java_home.unwrap() +pub const fn java_home() -> &'static str { + let java_home = env!("JAVA_HOME"); + java_home } /// Resolve the path to the current GraalVM home (`GRAALVM_HOME`). -pub fn gvm_home() -> String { - let gvm_home_var = var("GRAALVM_HOME"); - let java_home = var("JAVA_HOME"); - - if gvm_home_var.is_err() && java_home.is_err() { - panic!("Please set the GRAALVM_HOME or JAVA_HOME environment variable"); - } - - let gvm_home_val = gvm_home_var.unwrap_or_default(); - let java_home = java_home.unwrap_or_default(); - if gvm_home_val.is_empty() { - java_home - } else { - gvm_home_val - } +#[allow(clippy::if_same_then_else)] +pub const fn gvm_home() -> &'static str { + let gvm_home_var = option_env!("GRAALVM_HOME"); + let java_home = option_env!("JAVA_HOME"); + + if gvm_home_var.is_none() && java_home.is_none() { + panic!("Please set the GRAALVM_HOME or JAVA_HOME environment variable"); + } else if let Some(gvm_home) = gvm_home_var { + gvm_home + } else { + env!("JAVA_HOME") + } } /// Return a full suite of include paths for native builds, including any extras. pub fn include_paths(extras: Option>) -> Vec { - let mut paths = base_include_paths(); - if extras.is_some() { - paths.extend(extras.unwrap()); - } - paths + let mut paths = base_include_paths(); + if let Some(addl) = extras { + paths.extend(addl); + } + paths } /// Return the base library paths which should always be included in native builds. pub fn base_lib_paths() -> Vec { - // get base folders and build profile - let gvm_home = gvm_home(); - let target_base = root_project_path("target"); - let profile = var("PROFILE").unwrap(); - - // resolve os/arch from target - let target = var("TARGET").unwrap(); - let os = if target.contains("darwin") { - "darwin" - } else { - "linux" - }; - let arch = if target.contains("x86_64") { - "amd64" - } else { - "aarch64" - }; - - vec![ - format!("{}/lib", gvm_home), - format!("{}/lib/server", gvm_home), - format!("{}/lib/svm/clibraries/{}-{}", gvm_home, os, arch), - format!("{}/{}", target_base, profile), - format!("{}/{}/lib", target_base, profile), - ] + // get base folders and build profile + let gvm_home = gvm_home(); + let target_base = root_project_path("target"); + let profile = var("PROFILE").unwrap(); + let sqlite_libs = root_project_path("third_party/sqlite/install/lib"); + + // resolve os/arch from target + let target = var("TARGET").unwrap(); + let os = if target.contains("darwin") { + "darwin" + } else { + "linux" + }; + let arch = if target.contains("x86_64") { + "amd64" + } else { + "aarch64" + }; + + vec![ + format!("{}/lib", gvm_home), + format!("{}/lib/server", gvm_home), + format!("{}/lib/svm/clibraries/{}-{}", gvm_home, os, arch), + format!("{}/{}", target_base, profile), + format!("{}/{}/lib", target_base, profile), + sqlite_libs, + ] } /// Return a full suite of library paths for native builds, including any extras. pub fn lib_paths(extras: Option>) -> Vec { - let mut paths = base_lib_paths(); - if extras.is_some() { - paths.extend(extras.unwrap()); - } - paths + let mut paths = base_lib_paths(); + if let Some(addl) = extras { + paths.extend(addl); + } + paths } /// Emit Cargo metadata for all built-in link paths, plus `extra_lib_paths`; the resulting `Vec` contains the /// sum of all library search paths. pub fn cargo_lib_metadata(extra_lib_paths: Option>) -> Vec { - let paths = lib_paths(extra_lib_paths); - for path in paths.iter() { - println!("cargo:rustc-link-search=native={}", path); - } - paths -} - -/// Enumerates supported operating systems. -pub enum TargetOs { - Darwin, - Linux, - Windows, -} - -impl TargetOs { - pub fn as_str(&self) -> &'static str { - match self { - TargetOs::Darwin => "darwin", - TargetOs::Linux => "linux", - TargetOs::Windows => "windows", - } - } -} - -/// Enumerates supported target architectures. -pub enum TargetArch { - Amd64, - Arm64, // alias for aarch64 on applicable platforms -} - -impl TargetArch { - pub fn as_str(&self) -> &'static str { - match self { - TargetArch::Amd64 => "amd64", - TargetArch::Arm64 => "aarch64", - } - } + let paths = lib_paths(extra_lib_paths); + for path in paths.iter() { + println!("cargo:rustc-link-search=native={}", path); + } + paths } /// Obtain a consistent value identifying the target operating system. pub fn target_os() -> TargetOs { - let target = env::var("TARGET").unwrap(); - if target.contains("darwin") { - TargetOs::Darwin - } else if target.contains("linux") { - TargetOs::Linux - } else if target.contains("windows") { - TargetOs::Windows - } else { - panic!("Unsupported target: {}", target); - } + TargetOs::current() } /// Obtain a consistent value identifying the target CPU architecture. pub fn target_arch() -> TargetArch { - let target = env::var("TARGET").unwrap(); - if target.contains("x86_64") { - TargetArch::Amd64 - } else if target.contains("aarch64") { - TargetArch::Arm64 - } else if target.contains("arm64") { - TargetArch::Arm64 - } else { - panic!("Unsupported target: {}", target); - } + TargetArch::current() } /// Common C flags applied to all builds which use this builder interface. -const common_c_flags: [&str; 8] = [ - "-O3", - "-fno-omit-frame-pointer", - "-fstack-protector-strong", - "-fstack-clash-protection", - "-fno-delete-null-pointer-checks", - "-fno-strict-overflow", - "-fno-strict-aliasing", - "-fexceptions", +const common_c_flags: [&str; 10] = [ + "-O3", + "-fPIC", + "-fPIE", + "-fno-omit-frame-pointer", + "-fstack-protector-strong", + "-fstack-clash-protection", + "-fno-delete-null-pointer-checks", + "-fno-strict-overflow", + "-fno-strict-aliasing", + "-fexceptions", ]; /// Common ASM flags applied to all builds which use this builder interface. @@ -392,191 +433,193 @@ const common_asm_flags: [&str; 1] = ["--noexecstack"]; /// Setup a consistent C compiler build environment. pub fn setup_cc() -> Build { - let profile = var("PROFILE").unwrap(); - let os = target_os(); - let arch = target_arch(); - let mut build = Build::new(); - - build - // Defines & Compiler Settings - .pic(true) - .static_flag(true) - .shared_flag(true) - .use_plt(false); - - build - // Global Defines - .define("ELIDE", "1") - .define("ELIDE_GVM_STATIC", "1") - .define("HAVE_OPENSSL", "1") - .define("HAVE_USLEEP", "1"); - - // add base includes - build.includes(include_paths(None).iter().map(|s| s.as_str())); - - // add cflags - for flag in common_c_flags.iter() { - build.flag(flag); - } - - // add asm flags - for flag in common_asm_flags.iter() { - build.asm_flag(flag); - } - - // add profile-specific flags - match profile.as_str() { - "debug" => build - // Debug-only Flags - .define("ELIDE_DEBUG", "1") - .flag("-g"), - "release" => build - // Release-only Flags - .define("ELIDE_RELEASE", "1") - .flag("-flto"), - - _ => &mut build, - }; - - // add os-specific flags - match os { - TargetOs::Darwin => match arch { - TargetArch::Amd64 => build - // C Flags: macOS - .flag("-mmacosx-version-min=12.3"), - - TargetArch::Arm64 => build - // C Flags: macOS - .flag("-mmacosx-version-min=12.3") - .flag("-march=armv8-a+crypto+crc+simd") - .flag("-mbranch-protection=standard") - .define("__ARM_NEON", "1") - .define("__ARM_FEATURE_AES", "1") - .define("__ARM_FEATURE_SHA2", "1"), - }, - - TargetOs::Linux => &mut build, - - TargetOs::Windows => &mut build, - }; - - // always generate cargo metadata - cargo_lib_metadata(None); - - // always link against jvm for jni - println!("cargo:rustc-link-lib=jvm"); - build + let profile = var("PROFILE").unwrap(); + let os = target_os(); + let arch = target_arch(); + let mut build = Build::new(); + + build + // Defines & Compiler Settings + .pic(true) + .static_flag(true) + .shared_flag(true) + .use_plt(false); + + build + // Global Defines + .define("ELIDE", "1") + .define("ELIDE_GVM_STATIC", "1") + .define("HAVE_OPENSSL", "1") + .define("HAVE_USLEEP", "1"); + + build + // Include Paths + .includes(include_paths(None).iter().map(|s| s.as_str())); + + build + // General Hardening + .flag_if_supported("-fhardened") + .flag_if_supported("-fstrict-flex-arrays=3") + .flag_if_supported("-fno-delete-null-pointer-checks") + .flag_if_supported("-fno-strict-overflow") + .flag_if_supported("-fno-strict-aliasing"); + + // add cflags + for flag in common_c_flags.iter() { + build.flag(flag); + } + + // add asm flags + for flag in common_asm_flags.iter() { + build.asm_flag(flag); + } + + // add profile-specific flags + match profile.as_str() { + "debug" => build + // Debug-only Flags + .define("ELIDE_DEBUG", "1") + .flag("-g"), + "release" => build + // Release-only Flags + .define("ELIDE_RELEASE", "1") + .flag("-flto"), + + _ => &mut build, + }; + + // add os-specific flags + match os { + TargetOs::Darwin => match arch { + TargetArch::Amd64 => build + // C Flags: macOS + .flag("-mmacosx-version-min=12.3"), + + TargetArch::Arm64 => build + // C Flags: macOS + .flag("-mmacosx-version-min=12.3") + .flag("-march=armv8-a+crypto+crc+simd") + .flag("-mbranch-protection=standard") + .define("__ARM_NEON", "1") + .define("__ARM_FEATURE_AES", "1") + .define("__ARM_FEATURE_SHA2", "1"), + }, + + TargetOs::Linux => &mut build, + + TargetOs::Windows => &mut build, + }; + + // always generate cargo metadata + cargo_lib_metadata(None); + build } /// Execute a prepared `Build` environment, creating both a static library and shared library; for this function to work /// properly, `cdylib` must be removed from the crate's own targets. pub fn build_dual_cc( - mut build: Build, - static_name: &str, - shared_lib_name: &str, - extra_static_cflags: Option>, - extra_shared_cflags: Option>, + mut build: Build, + static_name: &str, + shared_lib_name: &str, + extra_static_cflags: Option>, + extra_shared_cflags: Option>, ) { - let os = target_os(); - let link_paths = base_lib_paths(); - - // add link paths to both builds - for path in link_paths { - build.flag(format!("-L{}", path)); - } - - let mut static_lib = build.clone(); - let mut shared_lib = build.clone(); - - static_lib - // Sources: Native DB - .static_flag(true) - .shared_flag(false); - - for flag in extra_static_cflags.unwrap_or_default() { - static_lib.flag(flag); - } - - // manually force compilation of a shared object as well - let objects = shared_lib.compile_intermediates(); - - // compile static lib - static_lib.compile(static_name); - - let profile = var("PROFILE").unwrap(); - let elide_root_var = var("ELIDE_ROOT").unwrap(); - let target_dir = format!("{}/target/{}", elide_root_var, profile); - let out_dir = Path::new(&target_dir); - let lib_tail = match os { - TargetOs::Darwin => "dylib", - TargetOs::Linux => "so", - TargetOs::Windows => "dll", - }; - let shared_flag = match os { - TargetOs::Darwin => "-dynamiclib", - TargetOs::Linux => "-shared", - TargetOs::Windows => "-shared", - }; - - let outpath = out_dir.join(format!("lib{}.{}", shared_lib_name, lib_tail)); - - shared_lib.static_flag(false).shared_flag(true); - - // add extra shared c_cflags, if any - for flag in extra_shared_cflags.unwrap_or_default() { - shared_lib.flag(flag); + let os = target_os(); + let link_paths = base_lib_paths(); + + // add link paths to both builds + for path in link_paths { + build.flag(format!("-L{}", path)); + } + + let mut static_lib = build.clone(); + let mut shared_lib = build.clone(); + + static_lib + // Sources: Native DB + .static_flag(true) + .shared_flag(false); + + for flag in extra_static_cflags.unwrap_or_default() { + static_lib.flag(flag); + } + + // manually force compilation of a shared object as well + let objects = shared_lib.compile_intermediates(); + + // compile static lib + static_lib.compile(static_name); + + let profile = var("PROFILE").unwrap(); + let elide_root_var = var("ELIDE_ROOT").unwrap(); + let target_dir = format!("{}/target/{}", elide_root_var, profile); + let out_dir = Path::new(&target_dir); + let lib_tail = match os { + TargetOs::Darwin => "dylib", + TargetOs::Linux => "so", + TargetOs::Windows => "dll", + }; + + let outpath = out_dir.join(format!("lib{}.{}", shared_lib_name, lib_tail)); + + shared_lib.static_flag(false).shared_flag(true); + + // add extra shared c_cflags, if any + for flag in extra_shared_cflags.unwrap_or_default() { + shared_lib.flag(flag); + } + + match shared_lib + .get_compiler() + .to_command() + .arg("-o") + .arg(outpath) + .args(&objects) + .status() + { + Ok(_) => { + // nothing to do } - match shared_lib - .get_compiler() - .to_command() - .args([shared_flag, "-o"]) - .arg(outpath) - .args(&objects) - .status() - { - Ok(_) => { - // nothing to do - } - - Err(e) => { - // crash - panic!( - "Failed to compile shared library {}; error: {}", - shared_lib_name, e - ); - } + Err(e) => { + // crash + panic!( + "Failed to compile shared library {}; error: {}", + shared_lib_name, e + ); } + } } /// Execute a consistent C bind-gen environment. -pub fn build_bindings(lib_name: &str, builder: Builder) { - // formulate include paths - let gvm_home = gvm_home(); - let os = target_os(); - let jvm_include = format!("{}/include", gvm_home); - let jvm_include_native = format!("{}/include/{}", gvm_home, os.as_str()); - let profile = var("PROFILE").unwrap(); - let target_headers_gen = root_project_path(format!("target/{}/include", profile).as_str()); - let target_headers_profile = root_project_path(format!("target/{}/include", profile).as_str()); - let target_headers_apr = root_project_path(format!("target/{}/include/apr-2", profile).as_str()); - let project_headers = project_path("headers"); - - let bindings = builder - // Generate Bindings - .clang_arg(format!("-I{}", jvm_include)) - .clang_arg(format!("-I{}", jvm_include_native)) - .clang_arg(format!("-I{}", project_headers)) - .clang_arg(format!("-I{}", target_headers_gen)) - .clang_arg(format!("-I{}", target_headers_profile)) - .clang_arg(format!("-I{}", target_headers_apr)) - .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) - .generate() - .expect("Unable to generate bindings"); - - let out_path = PathBuf::from(var("OUT_DIR").unwrap()); - - bindings - .write_to_file(out_path.join(lib_name)) - .expect("Couldn't write bindings!"); +pub fn build_bindings(lib_name: &str, gen_name: &str, builder: Builder) { + // formulate include paths + println!("Building bindings for {}", lib_name); + let gvm_home = gvm_home(); + let os = target_os(); + let jvm_include = format!("{}/include", gvm_home); + let jvm_include_native = format!("{}/include/{}", gvm_home, os.as_str()); + let profile = var("PROFILE").unwrap(); + let target_headers_gen = root_project_path(format!("target/{}/include", profile).as_str()); + let target_headers_profile = root_project_path(format!("target/{}/include", profile).as_str()); + let target_headers_apr = root_project_path("third_party/apache/apr/include"); + let project_headers = project_path("headers"); + + let bindings = builder + // Generate Bindings + .clang_arg(format!("-I{}", jvm_include)) + .clang_arg(format!("-I{}", jvm_include_native)) + .clang_arg(format!("-I{}", project_headers)) + .clang_arg(format!("-I{}", target_headers_gen)) + .clang_arg(format!("-I{}", target_headers_profile)) + .clang_arg(format!("-I{}", target_headers_apr)) + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) + .generate() + .expect("Unable to generate bindings"); + + let out_path = PathBuf::from(var("OUT_DIR").unwrap()); + + bindings + .write_to_file(out_path.join(gen_name)) + .expect("Couldn't write bindings!"); } diff --git a/crates/deps/Cargo.toml b/crates/deps/Cargo.toml index 1f7ce5f420..5bbe4c05ed 100644 --- a/crates/deps/Cargo.toml +++ b/crates/deps/Cargo.toml @@ -19,5 +19,18 @@ workspace = "../.." version = "1.0.0-alpha11-SNAPSHOT" [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["lib"] +[dependencies] +## Local +base = { workspace = true } +model = { workspace = true } + +## Crates +pubgrub = { workspace = true } +purl = { workspace = true } +semver = { workspace = true } +serde = { workspace = true } +toml = { workspace = true } +toml_edit = { workspace = true } +typeshare = { workspace = true } diff --git a/crates/deps/src/catalog.rs b/crates/deps/src/catalog.rs new file mode 100644 index 0000000000..68a98f6859 --- /dev/null +++ b/crates/deps/src/catalog.rs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use base::prelude::*; +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +/// Defines version information for a declaration within a Gradle-style version catalog. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct GradleVersionInfo { + /// Describes a literal version specified as part of a mapping. + pub version: Option, + + /// Describes a reference to a declared version within the versions block of the catalog. + pub reference: Option, +} + +/// Defines plugin dependencies within a Gradle-style version catalog. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct GradlePluginDefinition {} + +/// Defines library dependencies within a Gradle-style version catalog. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct GradleLibraryDefinition { + /// Describes a full Maven coordinate. + pub module: Option, + + /// Describes the group portion of a Maven coordinate. + pub group: Option, + + /// Describes the name portion of a Maven coordinate. + pub name: Option, + + /// Describes the declared version info for the dependency. + pub version: Option, +} + +/// Describes the top-level structure of a Gradle-style dependency catalog. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct GradleDependencyCatalog { + /// Maps version constants to dot-nested names. + pub versions: std::collections::HashMap, + + /// Maps plugin definitions to dot-nested names. + pub plugins: std::collections::HashMap, + + /// Maps library definitions to dot-nested names. + pub libraries: std::collections::HashMap, + + /// Maps bundle definitions to dot-nested names. + pub bundles: std::collections::HashMap>, +} diff --git a/crates/deps/src/lib.rs b/crates/deps/src/lib.rs index 1518aba8f0..514cb27d6a 100644 --- a/crates/deps/src/lib.rs +++ b/crates/deps/src/lib.rs @@ -11,17 +11,13 @@ * License for the specific language governing permissions and limitations under the License. */ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} +#![feature(test)] +#![feature(const_option)] +#![feature(const_trait_impl)] +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] -#[cfg(test)] -mod tests { - use super::*; +/// Provides structural definitions for handling dependencies. +pub mod model; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +/// Provides structural definitions for dependency catalogs. +pub mod catalog; diff --git a/crates/deps/src/model.rs b/crates/deps/src/model.rs new file mode 100644 index 0000000000..3c1146a0e2 --- /dev/null +++ b/crates/deps/src/model.rs @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +/// Enumerates recognized scopes for dependency mappings. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub enum DependencyScope { + /// The dependency is required for compiling the project. + Compile, + + /// The dependency is required for running the project. + Runtime, + + /// The dependency is required for development only. + Development, + + /// The dependency is required for testing only. + Test, + + /// The dependency is provided by the runtime environment. + Provided, + + /// The dependency is provided by the host system. + System, + + /// The dependency is a constraint or suite of constraints. + Import, + + /// The dependency provides a catalog of dependencies. + Catalog, +} + +/// Enumerates recognized scopes for dependency mappings. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub enum DependencyEcosystemType { + /// The dependency originates from Maven Central or a Maven-style repository. + Maven, + + /// The dependency originates from NPM or a NPM-style repository. + Npm, + + /// The dependency originates from JSR or a JSR-style repository. + Jsr, + + /// The dependency originates from PyPI or a PyPI-style repository. + PyPi, + + /// The dependency originates from RubyGems or a RubyGems-style repository. + RubyGems, + + /// The dependency originates from HuggingFace. + HuggingFace, + + /// The dependency originates from Git. + Git, +} + +/// Describes a single dependency lockfile within the context of a given Elide project or dependency graph. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct Lockfile { + /// The local identifier for the lockfile. + pub id: u8, + + /// The name of the lockfile. + pub path: Option, + + /// Whether this lockfile is virtual. + pub synthetic: bool, + + /// The ecosystem type for this lockfile. + pub ecosystem: DependencyEcosystemType, + + /// CRC64 fingerprint of this lock file's content. + pub fingerprint: u64, + + /// Last modification time of this lockfile. + pub modtime: u64, +} + +/// Enumerates recognized protocols for accessing dependency repositories. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub enum RepositoryAccessProtocol { + /// The repository is accessed via HTTP. + Https, + + /// The repository is accessed via Git+HTTP. + GitHttps, + + /// The repository is accessed via SSH. + GitSsh, + + /// The repository is accessed via S3-style storage. + S3, + + /// The repository is located on-disk. + Disk, +} + +/// Describes top-level configuration for a single dependency repository. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct RepositoryConfig { + /// Whether this repository is a "default" repository for a given ecosystem. + pub is_default: bool, + + /// Whether this repository is "built-in." + pub is_builtin: bool, + + /// Whether this repository is local to the user's machine. + pub is_local: bool, +} + +/// Describes a single dependency repository. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct Repository { + /// The local identifier for the repository. + pub id: u16, + + /// The name of the repository. + pub name: String, + + /// The layout type employed by the repository. + pub layout: DependencyEcosystemType, + + /// The protocol used to access the repository. + pub protocol: RepositoryAccessProtocol, + + /// The URI of the repository. + pub uri: String, + + /// The configuration for the repository. + pub config: RepositoryConfig, +} + +/// Describes how a given repository is employed by a dependency graph. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct RepositoryAttachment { + /// The local identifier for the repository. + pub id: u16, +} + +/// Describes a unique dependency version within the context of a dependency graph. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct DependencyVersion { + /// The local identifier for the repository. + pub id: u32, + + /// The owning dependency ID. + pub owner: u32, + + /// The formatted `purl` for this dependency version. + pub purl: String, +} + +/// Models the information provided within a declaration of a dependency version against a project. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct DependencyVersionRequest { + /// User is requesting the latest released dependency. + pub latest: bool, + + /// User is requesting the latest stable dependency. + pub stable: bool, + + /// User is requesting the latest snapshot dependency. + pub snapshot: bool, + + /// Specific semver pin requested. + pub semver: Option, +} + +/// Describes a dependency declared within a project. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct DependencyRequest { + /// The local identifier assigned to the dependency. + pub id: u32, + + /// The semver pin declared for this dependency declaration. + pub version: DependencyVersionRequest, +} + +/// Describes a single dependency within the context of a dependency graph, ignorant of version information. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct Dependency { + /// The local identifier for the repository. + pub id: u32, + + /// The formatted `purl` for this dependency. + pub purl: String, +} + +/// Describes how a given dependency is employed by a dependency graph. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct DependencyAttachment { + /// The local identifier for the dependency. + pub id: u32, +} + +/// Declares dependency information for a project; can be structured as a universal catalog recognizable by Elide, or a +/// file in conventional form for a given language ecosystem. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +pub struct DependencyManifest { + /// Unique ID assigned to this manifest. + pub id: u8, + + /// The name declared within the manifest, as applicable; generated or provided. + pub name: Option, + + /// The version declared within the manifest, as applicable. + pub version: Option, + + /// Path on-disk to this manifest. + pub path: Option, + + /// Whether this manifest is virtual. + pub synthetic: bool, + + /// The ecosystem type for this manifest. + pub ecosystem: DependencyEcosystemType, + + /// Resolved lockfile which matches this manifest, if applicable/if found. + pub lockfile: Option, + + /// CRC64 fingerprint of this manifest's content. + pub fingerprint: u64, + + /// Last modification time of this manifest. + pub modtime: u64, + + /// Dependencies attached to this manifest. + pub dependencies: Vec, +} diff --git a/crates/entry/Cargo.toml b/crates/entry/Cargo.toml index 6d39d81989..cba566a8d7 100644 --- a/crates/entry/Cargo.toml +++ b/crates/entry/Cargo.toml @@ -18,5 +18,8 @@ license = "MIT" workspace = "../.." version = "1.0.0-alpha11-SNAPSHOT" +[lib] +crate-type = ["lib"] + [[bin]] name = "elide" diff --git a/crates/entry/src/bin/elide.rs b/crates/entry/src/bin/elide.rs index 21a297f393..5295aaef2a 100644 --- a/crates/entry/src/bin/elide.rs +++ b/crates/entry/src/bin/elide.rs @@ -12,20 +12,20 @@ */ pub fn add(left: u64, right: u64) -> u64 { - left + right + left + right } pub fn main() { - println!("Hello, world!"); + println!("Hello, world!"); } #[cfg(test)] mod tests { - use super::*; + use super::*; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } } diff --git a/crates/entry/src/lib.rs b/crates/entry/src/lib.rs new file mode 100644 index 0000000000..57157c0ed5 --- /dev/null +++ b/crates/entry/src/lib.rs @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ diff --git a/crates/model/Cargo.toml b/crates/model/Cargo.toml index b75b8c473d..1b1bc04d49 100644 --- a/crates/model/Cargo.toml +++ b/crates/model/Cargo.toml @@ -1,3 +1,16 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + [package] name = "model" edition = "2021" @@ -6,7 +19,13 @@ workspace = "../.." version = "1.0.0-alpha11-SNAPSHOT" [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["lib"] [dependencies] +const-crc32-nostd = { workspace = true } serde = { workspace = true } +typeshare = { workspace = true } + +[build-dependencies] +build_const = { workspace = true, default-features = false } +rustc_version = { workspace = true } diff --git a/crates/model/build.rs b/crates/model/build.rs new file mode 100644 index 0000000000..c763093dd8 --- /dev/null +++ b/crates/model/build.rs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use std::env::var; + +extern crate rustc_version; +use rustc_version::{version as rustc_version, version_meta, Channel}; + +fn main() { + // Define environment variables for build context. + let version = var("CARGO_PKG_VERSION").expect("variable `CARGO_PKG_VERSION` is not defined"); + let target = var("TARGET").expect("variable `TARGET` is not defined"); + let profile = var("PROFILE").expect("variable `PROFILE` is not defined"); + let rustc_version = rustc_version().expect("failed to resolve rustc version"); + + println!("cargo:rustc-env=ELIDE_VERSION={}", version); + println!("cargo:rustc-env=ELIDE_TARGET={}", target); + println!("cargo:rustc-env=ELIDE_PROFILE={}", profile); + println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); + + match version_meta().unwrap().channel { + Channel::Stable => { + println!("cargo:rustc-env=RUSTC_CHANNEL=stable"); + } + Channel::Beta => { + println!("cargo:rustc-env=RUSTC_CHANNEL=beta"); + } + Channel::Nightly => { + println!("cargo:rustc-env=RUSTC_CHANNEL=nightly"); + } + Channel::Dev => { + println!("cargo:rustc-env=RUSTC_CHANNEL=dev"); + } + } +} diff --git a/crates/model/src/features.rs b/crates/model/src/features.rs new file mode 100644 index 0000000000..efc5872ec8 --- /dev/null +++ b/crates/model/src/features.rs @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +/// Enumerates known Elide features which can be controlled at build-time. +#[derive(Debug, Serialize, Deserialize, PartialEq, Ord, PartialOrd, Eq)] +#[typeshare] +pub enum Feature { + /// Baseline feature set which is always active. + Baseline, +} + +/// Describes metadata relating to a specific `Feature`. +#[derive(Debug, Serialize, Deserialize, PartialEq, Ord, PartialOrd, Eq)] +#[typeshare] +pub struct FeatureInfo { + /// CRC32 of the feature's name; used as its ID. + pub id: u32, + + /// The name of the feature. + pub name: &'static str, + + /// A brief description of the feature. + pub description: &'static str, + + /// Whether the feature is enabled. + pub enabled: bool, +} + +/// The baseline feature set which is always enabled. +const BASELINE: FeatureInfo = FeatureInfo { + id: 0x00000000, + name: "baseline", + description: "The baseline feature set which is always enabled.", + enabled: true, +}; + +/// All known features. +const ALL_FEATURES: &[Feature] = &[Feature::Baseline]; + +/// All known feature info records. +const ALL_FEATURE_INFOS: &[FeatureInfo] = &[BASELINE]; + +impl Feature { + /// Returns the metadata for all known `Feature`s. + pub const fn all() -> &'static [Feature] { + ALL_FEATURES + } + + /// Returns the metadata for all known `Feature`s. + pub const fn infos() -> &'static [FeatureInfo] { + ALL_FEATURE_INFOS + } + + /// Returns the metadata for a specific `Feature`. + pub const fn info(&self) -> &'static FeatureInfo { + match self { + Feature::Baseline => &BASELINE, + } + } + + /// Returns the name for a specific `Feature`. + pub const fn name(&self) -> &'static str { + self.info().name + } + + /// Returns the description for a specific `Feature`. + pub const fn description(&self) -> &'static str { + self.info().description + } + + /// Indicates whether this feature is enabled. + pub const fn enabled(&self) -> bool { + self.info().enabled + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_feature_info() { + assert_eq!(Feature::Baseline.info().name, "baseline"); + assert_eq!( + Feature::Baseline.info().description, + "The baseline feature set which is always enabled." + ); + assert!(Feature::Baseline.info().enabled); + } + + #[test] + fn test_feature_name() { + assert_eq!(Feature::Baseline.name(), "baseline"); + } + + #[test] + fn test_feature_description() { + assert_eq!( + Feature::Baseline.description(), + "The baseline feature set which is always enabled." + ); + } + + #[test] + fn test_feature_enabled() { + assert!(Feature::Baseline.enabled()); + } +} diff --git a/crates/model/src/lang.rs b/crates/model/src/lang.rs new file mode 100644 index 0000000000..f8abe9259c --- /dev/null +++ b/crates/model/src/lang.rs @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +/// Enumerates Elide's supported language runtimes. +#[derive(Debug, Serialize, Deserialize, PartialEq, PartialOrd, Ord, Eq)] +#[typeshare] +pub enum LanguageEngine { + /// Elide's JavaScript engine, powered by GraalJs. + JavaScript, + + /// Elide's Python engine, powered by GraalPython. + Python, + + /// Elide's Ruby engine, powered by TruffleRuby. + Ruby, + + /// Elide's JVM engine, powered by Espresso. + JVM, + + /// Elide's WASM engine, powered by GraalWasm. + WASM, + + /// Elide's LLVM engine, powered by Sulong. + LLVM, +} + +/// Enumerates Elide's supported language dialects; dialects each map to a single `LanguageEngine`. +#[derive(Debug, Serialize, Deserialize, PartialEq, PartialOrd, Ord, Eq)] +#[typeshare] +pub enum LanguageDialect { + /// ECMA-compliant JavaScript. + JavaScript, + + /// Standard TypeScript. + TypeScript, + + /// Standard Python. + Python, + + /// Standard Ruby. + Ruby, + + /// WASI-compliant WebAssembly. + WASM, + + /// Standard Java. + Java, + + /// Standard Kotlin. + Kotlin, +} + +impl LanguageDialect { + /// Returns the `LanguageEngine` which corresponds to this `LanguageDialect`. + pub const fn engine(&self) -> LanguageEngine { + match self { + LanguageDialect::JavaScript => LanguageEngine::JavaScript, + LanguageDialect::TypeScript => LanguageEngine::JavaScript, + LanguageDialect::Python => LanguageEngine::Python, + LanguageDialect::Ruby => LanguageEngine::Ruby, + LanguageDialect::WASM => LanguageEngine::WASM, + LanguageDialect::Java => LanguageEngine::JVM, + LanguageDialect::Kotlin => LanguageEngine::JVM, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_language_dialect_engine() { + assert_eq!( + LanguageDialect::JavaScript.engine(), + LanguageEngine::JavaScript + ); + assert_eq!( + LanguageDialect::TypeScript.engine(), + LanguageEngine::JavaScript + ); + assert_eq!(LanguageDialect::Python.engine(), LanguageEngine::Python); + assert_eq!(LanguageDialect::Ruby.engine(), LanguageEngine::Ruby); + assert_eq!(LanguageDialect::WASM.engine(), LanguageEngine::WASM); + assert_eq!(LanguageDialect::Java.engine(), LanguageEngine::JVM); + assert_eq!(LanguageDialect::Kotlin.engine(), LanguageEngine::JVM); + } +} diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rs index 1518aba8f0..89f3dbb045 100644 --- a/crates/model/src/lib.rs +++ b/crates/model/src/lib.rs @@ -11,17 +11,246 @@ * License for the specific language governing permissions and limitations under the License. */ -pub fn add(left: u64, right: u64) -> u64 { - left + right +#![feature(test)] +#![feature(const_option)] +#![feature(const_trait_impl)] +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +/// Build-time constants describing active Elide features. +pub mod features; + +/// Build-time constants and configurations for Elide's language engines. +pub mod lang; + +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +// Constants used for OS identification. +const DARWIN: &str = "darwin"; +const LINUX: &str = "linux"; +const WINDOWS: &str = "windows"; + +// Constants used for architecture identification. +const AMD64: &str = "amd64"; +const ARM64: &str = "aarch64"; + +// Constants used for build profiles. +const DEBUG: &str = "debug"; +const RELEASE: &str = "release"; + +/// Enumerates the types of build profiles which Elide supports. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub enum BuildMode { + Debug, + Release, +} + +impl BuildMode { + pub const fn as_str(&self) -> &'static str { + match self { + BuildMode::Debug => DEBUG, + BuildMode::Release => RELEASE, + } + } + + pub const fn current() -> Self { + if cfg!(debug_assertions) { + BuildMode::Debug + } else { + BuildMode::Release + } + } +} + +/// Enumerates supported operating systems. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub enum OperatingSystem { + Darwin, + Linux, + Windows, +} + +impl OperatingSystem { + pub const fn as_str(&self) -> &'static str { + match self { + OperatingSystem::Darwin => DARWIN, + OperatingSystem::Linux => LINUX, + OperatingSystem::Windows => WINDOWS, + } + } + + pub const fn current() -> Self { + if cfg!(windows) { + OperatingSystem::Windows + } else if cfg!(target_os = "macos") { + OperatingSystem::Darwin + } else { + OperatingSystem::Linux + } + } +} + +/// Enumerates supported target architectures. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub enum Architecture { + Amd64, + Arm64, // alias for aarch64 on applicable platforms +} + +impl Architecture { + pub const fn as_str(&self) -> &'static str { + match self { + Architecture::Amd64 => AMD64, + Architecture::Arm64 => ARM64, + } + } + + pub const fn current() -> Self { + if cfg!(target_arch = "x86_64") { + Architecture::Amd64 + } else { + Architecture::Arm64 + } + } } +/// Host Info. +/// +/// Describes information about the host which Elide was built for; this information is assembled at compile-time. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct HostInfo { + /// Operating system of the host. + pub os: OperatingSystem, + + /// Architecture of the host. + pub arch: Architecture, +} + +/// Rust Info. +/// +/// Describes information about the Rust compiler used to build Elide; this information is assembled at compile-time. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct RustInfo { + /// Version of the Rust compiler used to build Elide. + pub version: &'static str, + + /// Channel of the Rust compiler used to build Elide. + pub channel: &'static str, +} + +/// Elide Info. +/// +/// Compile-time information about the current build of Elide, including the active version, target, engines, build +/// profile, and so on. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[typeshare] +pub struct ElideInfo { + /// Current version string for Elide. + pub version: &'static str, + + /// Current target being built. + pub target: &'static str, + + /// Current build profile. + pub profile: &'static str, + + /// Information about the host OS and architecture which this build of Elide targets. + pub host: HostInfo, + + /// Information about the Rust toolchain used to build Elide. + pub rust: RustInfo, +} + +impl ElideInfo { + /// Create a new instance of ElideInfo. + const fn new() -> Self { + Self { + version: env!("ELIDE_TARGET"), + target: env!("ELIDE_TARGET"), + profile: env!("ELIDE_PROFILE"), + host: HostInfo { + os: OperatingSystem::current(), + arch: Architecture::current(), + }, + rust: RustInfo { + version: env!("RUSTC_VERSION"), + channel: env!("RUSTC_CHANNEL"), + }, + } + } + + /// Retrieve the current static info about this build of Elide. + pub const fn current() -> Self { + ELIDE_INFO + } +} + +/// Info about the current build of Elide. +pub const ELIDE_INFO: ElideInfo = ElideInfo::new(); + #[cfg(test)] mod tests { - use super::*; + use super::*; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } + #[test] + fn test_build_mode() { + assert_eq!(BuildMode::Debug.as_str(), DEBUG); + assert_eq!(BuildMode::Release.as_str(), RELEASE); + assert_eq!(BuildMode::current(), BuildMode::current()); + } + + #[test] + fn test_operating_system() { + assert_eq!(OperatingSystem::Darwin.as_str(), DARWIN); + assert_eq!(OperatingSystem::Linux.as_str(), LINUX); + assert_eq!(OperatingSystem::Windows.as_str(), WINDOWS); + assert_eq!(OperatingSystem::current(), OperatingSystem::current()); + } + + #[test] + fn test_architecture() { + assert_eq!(Architecture::Amd64.as_str(), AMD64); + assert_eq!(Architecture::Arm64.as_str(), ARM64); + assert_eq!(Architecture::current(), Architecture::current()); + } + + #[test] + fn test_host_info() { + let host = HostInfo { + os: OperatingSystem::current(), + arch: Architecture::current(), + }; + + assert_eq!(host.os, OperatingSystem::current()); + assert_eq!(host.arch, Architecture::current()); + } + + #[test] + fn test_rust_info() { + let rust = RustInfo { + version: env!("RUSTC_VERSION"), + channel: env!("RUSTC_CHANNEL"), + }; + + assert_eq!(rust.version, env!("RUSTC_VERSION")); + assert_eq!(rust.channel, env!("RUSTC_CHANNEL")); + } + + #[test] + fn test_elide_info() { + let elide = ElideInfo::new(); + + assert_eq!(elide.version, env!("ELIDE_TARGET")); + assert_eq!(elide.target, env!("ELIDE_TARGET")); + assert_eq!(elide.profile, env!("ELIDE_PROFILE")); + assert_eq!(elide.host.os, OperatingSystem::current()); + assert_eq!(elide.host.arch, Architecture::current()); + assert_eq!(elide.rust.version, env!("RUSTC_VERSION")); + assert_eq!(elide.rust.channel, env!("RUSTC_CHANNEL")); + } } diff --git a/crates/core/Cargo.toml b/crates/project/Cargo.toml similarity index 72% rename from crates/core/Cargo.toml rename to crates/project/Cargo.toml index 6764cee6f4..ac5e962942 100644 --- a/crates/core/Cargo.toml +++ b/crates/project/Cargo.toml @@ -12,11 +12,21 @@ # [package] -name = "core" +name = "project" edition = "2021" license = "MIT" workspace = "../.." version = "1.0.0-alpha11-SNAPSHOT" [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["lib"] + +[dependencies] +model = { workspace = true } +serde = { workspace = true } +toml = { workspace = true } +toml_edit = { workspace = true } +typeshare = { workspace = true } + +[build-dependencies] +builder = { workspace = true } diff --git a/crates/project/src/config.rs b/crates/project/src/config.rs new file mode 100644 index 0000000000..03ef6ecbad --- /dev/null +++ b/crates/project/src/config.rs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +use serde::{Deserialize, Serialize}; +use typeshare::typeshare; + +/// Versions of project config structure. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd)] +#[typeshare] +#[derive(Default)] +pub enum ProjectConfigVersion { + /// Version 1: Initial version. + #[default] + V1, +} + +/// Basic information about a project. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd, Default)] +#[typeshare] +pub struct ProjectInfo { + /// Name of the project. + pub name: Option, + + /// Declared version of the project. + pub version: Option, + + /// License token/expression for this project. + pub license: Option, +} + +/// Project configuration top-level structure. +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd, Default)] +#[typeshare] +pub struct ProjectConfig { + /// Structural version of the project configuration; defaults to latest. + pub version: ProjectConfigVersion, + + /// Basic information about the project. + pub project: ProjectInfo, +} diff --git a/crates/project/src/current.rs b/crates/project/src/current.rs new file mode 100644 index 0000000000..a5ccc20c49 --- /dev/null +++ b/crates/project/src/current.rs @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +pub use crate::config::ProjectConfig; +use std::path::PathBuf; +use std::sync::Arc; + +/// Primary name of Elide's project configuration file. +pub const CONFIG_FILE_NAME: &str = "elide.toml"; + +/// Secondary name of Elide's project configuration file. +pub const CONFIG_FILE_NAME_ALT: &str = ".elide.toml"; + +/// Implements error codes which can surface when parsing or locating project configuration. +#[derive(Debug)] +pub enum ConfigErr { + IoErr(std::io::Error), + ParseErr, +} + +/// Parse the project configuration file at the provided `path`. +/// +/// # Arguments +/// * `path` - Path to the project configuration file. +/// +/// # Returns +/// The parsed project configuration as a `Result`. +pub fn parse_config_file(path: Arc) -> Result { + let buf = path.to_path_buf(); + + // read file contents + let contents = std::fs::read_to_string(&buf).map_err(ConfigErr::IoErr)?; + let parsed: ProjectConfig = toml::from_str(&contents).map_err(|_| ConfigErr::ParseErr)?; + Ok(parsed) +} + +/// Parse the project configuration file at the provided `path`. +/// +/// # Arguments +/// * `seed` - Optional path where we should start looking; defaults to current working directory. +/// +/// # Returns +/// The located configuration file path, or `None`. +pub fn locate_config_file(seed: Option>) -> Option { + // locate the nearest `CONFIG_FILE_NAME` or `CONFIG_FILE_NAME_ALT`, starting at current working + // directory, and moving up the tree until we hit the root. + let mut start = seed + .unwrap_or_else(|| Arc::new(PathBuf::from("."))) + .to_path_buf(); + loop { + let path = start.join(CONFIG_FILE_NAME); + if path.exists() { + return Some(path); + } + let path = start.join(CONFIG_FILE_NAME_ALT); + if path.exists() { + return Some(path); + } + if !start.pop() { + return None; // could not locate + } + } +} + +/// Locate and parse the project config file, or return an empty `Option`. +/// +/// # Arguments +/// * `seed` - Optional path where we should start looking; defaults to current working directory. +/// +/// # Returns +/// The parsed project configuration as a `Result`. +pub fn resolve_config(seed: Option>) -> Result, ConfigErr> { + match locate_config_file(seed) { + Some(path) => parse_config_file(Arc::new(path)).map(Some), + None => Ok(None), + } +} diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs new file mode 100644 index 0000000000..a40c98aa12 --- /dev/null +++ b/crates/project/src/lib.rs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![feature(test)] +#![feature(const_option)] +#![feature(const_trait_impl)] +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] + +/// Structural representation of Elide project configuration. +pub mod config; + +/// Routines for parsing and manipulating current project configuration. +pub mod current; diff --git a/crates/protocol/Cargo.toml b/crates/protocol/Cargo.toml new file mode 100644 index 0000000000..ef72661331 --- /dev/null +++ b/crates/protocol/Cargo.toml @@ -0,0 +1,34 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +[package] +name = "protocol" +edition = "2021" +license = "MIT" +workspace = "../.." +version = "1.0.0-alpha11-SNAPSHOT" + +[lib] +crate-type = ["lib"] + +[dependencies] +bytes = { workspace = true } +capnp = { version = "0.19.6" } +prost = { workspace = true } + +[build-dependencies] +builder = { workspace = true } +capnpc = { workspace = true } +const_format = { workspace = true } +model = { workspace = true } +prost-build = { workspace = true } diff --git a/crates/protocol/build.rs b/crates/protocol/build.rs new file mode 100644 index 0000000000..f328e4d9d0 --- /dev/null +++ b/crates/protocol/build.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs new file mode 100644 index 0000000000..fa6ab6a9d5 --- /dev/null +++ b/crates/protocol/src/lib.rs @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ + +#![feature(test)] +#![feature(const_option)] +#![feature(const_trait_impl)] +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, dead_code)] diff --git a/crates/sqlite/Cargo.toml b/crates/sqlite/Cargo.toml index 229406398d..58780a0e4e 100644 --- a/crates/sqlite/Cargo.toml +++ b/crates/sqlite/Cargo.toml @@ -20,7 +20,7 @@ version = "1.0.0-alpha11-SNAPSHOT" [lib] name = "sqlitejdbc" -crate-type = ["lib", "staticlib"] +crate-type = ["lib", "staticlib", "cdylib"] [dependencies] java_native = { workspace = true } @@ -32,4 +32,4 @@ builder = { workspace = true } bindgen = { workspace = true } pkg-config = { workspace = true } vcpkg = { workspace = true } -cc = { workspace = true } +cc = { workspace = true, features = ["parallel"] } diff --git a/crates/sqlite/build.rs b/crates/sqlite/build.rs index 2e19015f51..f593f5b5f4 100644 --- a/crates/sqlite/build.rs +++ b/crates/sqlite/build.rs @@ -12,93 +12,105 @@ */ use bindgen::Builder; -use builder::{build_bindings, build_dual_cc, header_file, if_not_exists, makefile_sub_run, setup, setup_cc, src_file, third_party_project, third_party_src_file}; +use builder::{ + build_bindings, + build_dual_cc, + header_file, + if_not_exists, + makefile_sub_run, + setup, + setup_cc, + src_file, + third_party_project, + third_party_src_file, +}; fn main() { - let profile = std::env::var("PROFILE").unwrap(); - let profile_val = profile.as_str(); - let cmd_args = match profile_val { - "release" => "RELEASE=yes", - _ => "RELEASE=no", - }; + let profile = std::env::var("PROFILE").expect("No profile variable set"); + let profile_val = profile.as_str(); + let cmd_args = match profile_val { + "release" => "RELEASE=yes", + _ => "RELEASE=no", + }; - setup(|| { - // we need to build the sqlite amalgamation if it is not present - if_not_exists(third_party_src_file("sqlite", "sqlite3.c").as_str(), || { - makefile_sub_run("third_party", format!("sqlite {}", cmd_args).as_str()); - }); + setup(|| { + // we need to build the sqlite amalgamation if it is not present + if_not_exists(third_party_src_file("sqlite", "sqlite3.c").as_str(), || { + makefile_sub_run("third_party", format!("sqlite {}", cmd_args).as_str()); }); + }); - let mut build = setup_cc(); + let mut build = setup_cc(); - let sqlite_path = third_party_project("sqlite"); - let sqlite_include = format!("-I{}", sqlite_path); - let binding = sqlite_include.clone(); - let extra_args = vec![ - binding.as_str(), - ]; + let sqlite_path = third_party_project("sqlite/install"); + let sqlite_include = format!("-I{}/include", sqlite_path); + let sqlite_libpath = format!("-L{}/lib", sqlite_path); + let libpath_binding = sqlite_libpath.clone(); + let include_binding = sqlite_include.clone(); + let extra_args = vec![include_binding.as_str(), libpath_binding.as_str()]; - build - // Build Hardening & Warning Suppression - .flag("-w") - .flag("-fPIC") - .flag("-fstack-protector-strong") - .flag_if_supported("-fstack-clash-protection") - .flag_if_supported("-fhardened") - .flag_if_supported("-Wl,-z,relro,-z,now") - .flag_if_supported("-Wl,-z,noexecstack") - .flag_if_supported("-Wl,-z,separate-code") - .flag_if_supported("-Wa,--noexecstack"); + build + // Build Hardening & Warning Suppression + .flag("-w") + .flag("-fPIC") + .flag("-fstack-protector-strong") + .flag_if_supported("-fstack-clash-protection") + .flag_if_supported("-fhardened") + .flag_if_supported("-Wl,-z,relro,-z,now") + .flag_if_supported("-Wl,-z,noexecstack") + .flag_if_supported("-Wl,-z,separate-code") + .flag_if_supported("-Wa,--noexecstack"); - build - .flag(sqlite_include.clone()); + build.flag(sqlite_include.clone()); - build - // Defines & Compiler Settings - .define("SQLITE_GVM_STATIC", "1") - .define("SQLITE_CORE", "1") - .define("SQLITE_DEFAULT_FILE_PERMISSIONS", "0666") - .define("SQLITE_DEFAULT_MEMSTATUS", "0") - .define("SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS", "1") - .define("SQLITE_ENABLE_API_ARMOR", "1") - .define("SQLITE_ENABLE_COLUMN_METADATA", "1") - .define("SQLITE_ENABLE_DBSTAT_VTAB", "1") - .define("SQLITE_ENABLE_FTS3", "1") - .define("SQLITE_ENABLE_FTS3_PARENTHESIS", "1") - .define("SQLITE_ENABLE_FTS5", "1") - .define("SQLITE_ENABLE_LOAD_EXTENSION", "1") - .define("SQLITE_ENABLE_MATH_FUNCTIONS", "1") - .define("SQLITE_ENABLE_RTREE", "1") - .define("SQLITE_ENABLE_STAT4", "1") - .define("SQLITE_HAVE_ISNAN", "1") - .define("SQLITE_MAX_ATTACHED", "125") - .define("SQLITE_MAX_COLUMN", "32767") - .define("SQLITE_MAX_FUNCTION_ARG", "127") - .define("SQLITE_MAX_LENGTH", "2147483647") - .define("SQLITE_MAX_MMAP_SIZE", "1099511627776") - .define("SQLITE_MAX_PAGE_COUNT", "4294967294") - .define("SQLITE_MAX_SQL_LENGTH", "1073741824") - .define("SQLITE_MAX_VARIABLE_NUMBER", "250000") - .define("SQLITE_THREADSAFE", "1"); + build + // Defines & Compiler Settings + .define("SQLITE_GVM_STATIC", "1") + .define("SQLITE_CORE", "1") + .define("SQLITE_DEFAULT_FILE_PERMISSIONS", "0666") + .define("SQLITE_DEFAULT_MEMSTATUS", "0") + .define("SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS", "1") + .define("SQLITE_ENABLE_API_ARMOR", "1") + .define("SQLITE_ENABLE_COLUMN_METADATA", "1") + .define("SQLITE_ENABLE_DBSTAT_VTAB", "1") + .define("SQLITE_ENABLE_FTS3", "1") + .define("SQLITE_ENABLE_FTS3_PARENTHESIS", "1") + .define("SQLITE_ENABLE_FTS5", "1") + .define("SQLITE_ENABLE_LOAD_EXTENSION", "1") + .define("SQLITE_ENABLE_MATH_FUNCTIONS", "1") + .define("SQLITE_ENABLE_RTREE", "1") + .define("SQLITE_ENABLE_STAT4", "1") + .define("SQLITE_HAVE_ISNAN", "1") + .define("SQLITE_MAX_ATTACHED", "125") + .define("SQLITE_MAX_COLUMN", "32767") + .define("SQLITE_MAX_FUNCTION_ARG", "127") + .define("SQLITE_MAX_LENGTH", "2147483647") + .define("SQLITE_MAX_MMAP_SIZE", "1099511627776") + .define("SQLITE_MAX_PAGE_COUNT", "4294967294") + .define("SQLITE_MAX_SQL_LENGTH", "1073741824") + .define("SQLITE_MAX_VARIABLE_NUMBER", "250000") + .define("SQLITE_THREADSAFE", "1"); - build - // Source Files - .file(src_file("NativeDB.c")) - .file(third_party_src_file("sqlite", "sqlite3.c")); + build + // Source Files + .file(src_file("NativeDB.c")); + build_dual_cc( + build, + "sqlitejdbccore", + "sqlitejdbc", + Some(extra_args.clone()), + Some(extra_args.clone()), + ); - build_dual_cc( - build, - "sqlitejdbccore", - "sqlitejdbc", - Some(extra_args.clone()), - Some(extra_args.clone()), - ); + build_bindings( + "sqlite", + "libsqlitejdbc.rs", + Builder::default() + .clang_arg(sqlite_include.clone()) + .header(header_file("NativeDB.h")), + ); - build_bindings( - "libsqlitejdbc.rs", - Builder::default() - .clang_arg(sqlite_include.clone()) - .header(header_file("NativeDB.h")), - ) + println!("cargo::rustc-link-lib=static=sqlite3"); + println!("cargo::rustc-link-lib=dylib=sqlite3"); } diff --git a/crates/sqlite/headers/NativeDB.h b/crates/sqlite/headers/NativeDB.h index 045c9a3a45..d0432480d5 100644 --- a/crates/sqlite/headers/NativeDB.h +++ b/crates/sqlite/headers/NativeDB.h @@ -42,12 +42,35 @@ extern "C" { #define org_sqlite_core_NativeDB_DEFAULT_BACKUP_NUM_BUSY_BEFORE_FAIL 3L #undef org_sqlite_core_NativeDB_DEFAULT_PAGES_PER_BACKUP_STEP #define org_sqlite_core_NativeDB_DEFAULT_PAGES_PER_BACKUP_STEP 100L + +JNIEXPORT jint JNICALL sqlite_on_load + (JavaVM *vm, void *reserved); + +JNIEXPORT void JNICALL sqlite_on_unload + (JavaVM *vm, void *reserved); + +/** + * Class: org_sqlite_core_NativeDB + * Method: isStatic + * Signature: ()I + */ +JNIEXPORT jint JNICALL sqlite_isStatic + (JNIEnv *env, void *reserved); + +/** + * Class: org_sqlite_core_NativeDB + * Method: initializeStatic + * Signature: ()I + */ +JNIEXPORT jint JNICALL sqlite_initializeStatic + (JNIEnv *env, void *reserved); + /* * Class: org_sqlite_core_NativeDB * Method: _open_utf8 * Signature: ([BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1open_1utf8 +JNIEXPORT void JNICALL sqlite__1open_1utf8 (JNIEnv *, jobject, jbyteArray, jint); /* @@ -55,7 +78,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1open_1utf8 * Method: _close * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1close +JNIEXPORT void JNICALL sqlite__1close (JNIEnv *, jobject); /* @@ -63,7 +86,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1close * Method: _exec_utf8 * Signature: ([B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB__1exec_1utf8 +JNIEXPORT jint JNICALL sqlite__1exec_1utf8 (JNIEnv *, jobject, jbyteArray); /* @@ -71,7 +94,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB__1exec_1utf8 * Method: shared_cache * Signature: (Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_shared_1cache +JNIEXPORT jint JNICALL sqlite_shared_1cache (JNIEnv *, jobject, jboolean); /* @@ -79,7 +102,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_shared_1cache * Method: enable_load_extension * Signature: (Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_enable_1load_1extension +JNIEXPORT jint JNICALL sqlite_enable_1load_1extension (JNIEnv *, jobject, jboolean); /* @@ -87,7 +110,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_enable_1load_1extension * Method: interrupt * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_interrupt +JNIEXPORT void JNICALL sqlite_interrupt (JNIEnv *, jobject); /* @@ -95,7 +118,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_interrupt * Method: busy_timeout * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1timeout +JNIEXPORT void JNICALL sqlite_busy_1timeout (JNIEnv *, jobject, jint); /* @@ -103,7 +126,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1timeout * Method: busy_handler * Signature: (Lorg/sqlite/BusyHandler;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1handler +JNIEXPORT void JNICALL sqlite_busy_1handler (JNIEnv *, jobject, jobject); /* @@ -111,7 +134,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1handler * Method: prepare_utf8 * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_prepare_1utf8 +JNIEXPORT jlong JNICALL sqlite_prepare_1utf8 (JNIEnv *, jobject, jbyteArray); /* @@ -119,7 +142,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_prepare_1utf8 * Method: errmsg_utf8 * Signature: ()Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_errmsg_1utf8 +JNIEXPORT jobject JNICALL sqlite_errmsg_1utf8 (JNIEnv *, jobject); /* @@ -127,7 +150,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_errmsg_1utf8 * Method: libversion_utf8 * Signature: ()Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_libversion_1utf8 +JNIEXPORT jobject JNICALL sqlite_libversion_1utf8 (JNIEnv *, jobject); /* @@ -135,7 +158,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_libversion_1utf8 * Method: changes * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_changes +JNIEXPORT jlong JNICALL sqlite_changes (JNIEnv *, jobject); /* @@ -143,7 +166,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_changes * Method: total_changes * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_total_1changes +JNIEXPORT jlong JNICALL sqlite_total_1changes (JNIEnv *, jobject); /* @@ -151,7 +174,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_total_1changes * Method: finalize * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_finalize +JNIEXPORT jint JNICALL sqlite_finalize (JNIEnv *, jobject, jlong); /* @@ -159,7 +182,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_finalize * Method: step * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_step +JNIEXPORT jint JNICALL sqlite_step (JNIEnv *, jobject, jlong); /* @@ -167,7 +190,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_step * Method: reset * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_reset +JNIEXPORT jint JNICALL sqlite_reset (JNIEnv *, jobject, jlong); /* @@ -175,7 +198,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_reset * Method: clear_bindings * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_clear_1bindings +JNIEXPORT jint JNICALL sqlite_clear_1bindings (JNIEnv *, jobject, jlong); /* @@ -183,7 +206,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_clear_1bindings * Method: bind_parameter_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1parameter_1count +JNIEXPORT jint JNICALL sqlite_bind_1parameter_1count (JNIEnv *, jobject, jlong); /* @@ -191,7 +214,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1parameter_1count * Method: column_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1count +JNIEXPORT jint JNICALL sqlite_column_1count (JNIEnv *, jobject, jlong); /* @@ -199,7 +222,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1count * Method: column_type * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1type +JNIEXPORT jint JNICALL sqlite_column_1type (JNIEnv *, jobject, jlong, jint); /* @@ -207,7 +230,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1type * Method: column_decltype_utf8 * Signature: (JI)Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1decltype_1utf8 +JNIEXPORT jobject JNICALL sqlite_column_1decltype_1utf8 (JNIEnv *, jobject, jlong, jint); /* @@ -215,7 +238,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1decltype_1utf8 * Method: column_table_name_utf8 * Signature: (JI)Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1table_1name_1utf8 +JNIEXPORT jobject JNICALL sqlite_column_1table_1name_1utf8 (JNIEnv *, jobject, jlong, jint); /* @@ -223,7 +246,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1table_1name_1utf * Method: column_name_utf8 * Signature: (JI)Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1name_1utf8 +JNIEXPORT jobject JNICALL sqlite_column_1name_1utf8 (JNIEnv *, jobject, jlong, jint); /* @@ -231,7 +254,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1name_1utf8 * Method: column_text_utf8 * Signature: (JI)Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1text_1utf8 +JNIEXPORT jobject JNICALL sqlite_column_1text_1utf8 (JNIEnv *, jobject, jlong, jint); /* @@ -239,7 +262,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1text_1utf8 * Method: column_blob * Signature: (JI)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_column_1blob +JNIEXPORT jbyteArray JNICALL sqlite_column_1blob (JNIEnv *, jobject, jlong, jint); /* @@ -247,7 +270,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_column_1blob * Method: column_double * Signature: (JI)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_column_1double +JNIEXPORT jdouble JNICALL sqlite_column_1double (JNIEnv *, jobject, jlong, jint); /* @@ -255,7 +278,7 @@ JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_column_1double * Method: column_long * Signature: (JI)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_column_1long +JNIEXPORT jlong JNICALL sqlite_column_1long (JNIEnv *, jobject, jlong, jint); /* @@ -263,7 +286,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_column_1long * Method: column_int * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1int +JNIEXPORT jint JNICALL sqlite_column_1int (JNIEnv *, jobject, jlong, jint); /* @@ -271,7 +294,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1int * Method: bind_null * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1null +JNIEXPORT jint JNICALL sqlite_bind_1null (JNIEnv *, jobject, jlong, jint); /* @@ -279,7 +302,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1null * Method: bind_int * Signature: (JII)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1int +JNIEXPORT jint JNICALL sqlite_bind_1int (JNIEnv *, jobject, jlong, jint, jint); /* @@ -287,7 +310,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1int * Method: bind_long * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1long +JNIEXPORT jint JNICALL sqlite_bind_1long (JNIEnv *, jobject, jlong, jint, jlong); /* @@ -295,7 +318,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1long * Method: bind_double * Signature: (JID)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1double +JNIEXPORT jint JNICALL sqlite_bind_1double (JNIEnv *, jobject, jlong, jint, jdouble); /* @@ -303,7 +326,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1double * Method: bind_text_utf8 * Signature: (JI[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1text_1utf8 +JNIEXPORT jint JNICALL sqlite_bind_1text_1utf8 (JNIEnv *, jobject, jlong, jint, jbyteArray); /* @@ -311,7 +334,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1text_1utf8 * Method: bind_blob * Signature: (JI[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1blob +JNIEXPORT jint JNICALL sqlite_bind_1blob (JNIEnv *, jobject, jlong, jint, jbyteArray); /* @@ -319,7 +342,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1blob * Method: result_null * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1null +JNIEXPORT void JNICALL sqlite_result_1null (JNIEnv *, jobject, jlong); /* @@ -327,7 +350,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1null * Method: result_text_utf8 * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1text_1utf8 +JNIEXPORT void JNICALL sqlite_result_1text_1utf8 (JNIEnv *, jobject, jlong, jbyteArray); /* @@ -335,7 +358,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1text_1utf8 * Method: result_blob * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1blob +JNIEXPORT void JNICALL sqlite_result_1blob (JNIEnv *, jobject, jlong, jbyteArray); /* @@ -343,7 +366,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1blob * Method: result_double * Signature: (JD)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1double +JNIEXPORT void JNICALL sqlite_result_1double (JNIEnv *, jobject, jlong, jdouble); /* @@ -351,7 +374,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1double * Method: result_long * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1long +JNIEXPORT void JNICALL sqlite_result_1long (JNIEnv *, jobject, jlong, jlong); /* @@ -359,7 +382,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1long * Method: result_int * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1int +JNIEXPORT void JNICALL sqlite_result_1int (JNIEnv *, jobject, jlong, jint); /* @@ -367,7 +390,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1int * Method: result_error_utf8 * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1error_1utf8 +JNIEXPORT void JNICALL sqlite_result_1error_1utf8 (JNIEnv *, jobject, jlong, jbyteArray); /* @@ -375,7 +398,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1error_1utf8 * Method: value_text_utf8 * Signature: (Lorg/sqlite/Function;I)Ljava/nio/ByteBuffer; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_value_1text_1utf8 +JNIEXPORT jobject JNICALL sqlite_value_1text_1utf8 (JNIEnv *, jobject, jobject, jint); /* @@ -383,7 +406,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_value_1text_1utf8 * Method: value_blob * Signature: (Lorg/sqlite/Function;I)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_value_1blob +JNIEXPORT jbyteArray JNICALL sqlite_value_1blob (JNIEnv *, jobject, jobject, jint); /* @@ -391,7 +414,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_value_1blob * Method: value_double * Signature: (Lorg/sqlite/Function;I)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_value_1double +JNIEXPORT jdouble JNICALL sqlite_value_1double (JNIEnv *, jobject, jobject, jint); /* @@ -399,7 +422,7 @@ JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_value_1double * Method: value_long * Signature: (Lorg/sqlite/Function;I)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_value_1long +JNIEXPORT jlong JNICALL sqlite_value_1long (JNIEnv *, jobject, jobject, jint); /* @@ -407,7 +430,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_value_1long * Method: value_int * Signature: (Lorg/sqlite/Function;I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1int +JNIEXPORT jint JNICALL sqlite_value_1int (JNIEnv *, jobject, jobject, jint); /* @@ -415,7 +438,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1int * Method: value_type * Signature: (Lorg/sqlite/Function;I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1type +JNIEXPORT jint JNICALL sqlite_value_1type (JNIEnv *, jobject, jobject, jint); /* @@ -423,7 +446,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1type * Method: create_function_utf8 * Signature: ([BLorg/sqlite/Function;II)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1function_1utf8 +JNIEXPORT jint JNICALL sqlite_create_1function_1utf8 (JNIEnv *, jobject, jbyteArray, jobject, jint, jint); /* @@ -431,7 +454,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1function_1utf8 * Method: destroy_function_utf8 * Signature: ([B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1function_1utf8 +JNIEXPORT jint JNICALL sqlite_destroy_1function_1utf8 (JNIEnv *, jobject, jbyteArray); /* @@ -439,7 +462,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1function_1utf8 * Method: create_collation_utf8 * Signature: ([BLorg/sqlite/Collation;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1collation_1utf8 +JNIEXPORT jint JNICALL sqlite_create_1collation_1utf8 (JNIEnv *, jobject, jbyteArray, jobject); /* @@ -447,7 +470,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1collation_1utf8 * Method: destroy_collation_utf8 * Signature: ([B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1collation_1utf8 +JNIEXPORT jint JNICALL sqlite_destroy_1collation_1utf8 (JNIEnv *, jobject, jbyteArray); /* @@ -455,7 +478,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1collation_1utf8 * Method: limit * Signature: (II)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_limit +JNIEXPORT jint JNICALL sqlite_limit (JNIEnv *, jobject, jint, jint); /* @@ -463,7 +486,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_limit * Method: backup * Signature: ([B[BLorg/sqlite/core/DB/ProgressObserver;III)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup +JNIEXPORT jint JNICALL sqlite_backup (JNIEnv *, jobject, jbyteArray, jbyteArray, jobject, jint, jint, jint); /* @@ -471,7 +494,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup * Method: restore * Signature: ([B[BLorg/sqlite/core/DB/ProgressObserver;III)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore +JNIEXPORT jint JNICALL sqlite_restore (JNIEnv *, jobject, jbyteArray, jbyteArray, jobject, jint, jint, jint); /* @@ -479,7 +502,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore * Method: column_metadata * Signature: (J)[[Z */ -JNIEXPORT jobjectArray JNICALL Java_org_sqlite_core_NativeDB_column_1metadata +JNIEXPORT jobjectArray JNICALL sqlite_column_1metadata (JNIEnv *, jobject, jlong); /* @@ -487,7 +510,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_sqlite_core_NativeDB_column_1metadata * Method: set_commit_listener * Signature: (Z)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1commit_1listener +JNIEXPORT void JNICALL sqlite_set_1commit_1listener (JNIEnv *, jobject, jboolean); /* @@ -495,7 +518,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1commit_1listener * Method: set_update_listener * Signature: (Z)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1update_1listener +JNIEXPORT void JNICALL sqlite_set_1update_1listener (JNIEnv *, jobject, jboolean); /* @@ -503,7 +526,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1update_1listener * Method: register_progress_handler * Signature: (ILorg/sqlite/ProgressHandler;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_register_1progress_1handler +JNIEXPORT void JNICALL sqlite_register_1progress_1handler (JNIEnv *, jobject, jint, jobject); /* @@ -511,7 +534,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_register_1progress_1handler * Method: clear_progress_handler * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_clear_1progress_1handler +JNIEXPORT void JNICALL sqlite_clear_1progress_1handler (JNIEnv *, jobject); /* @@ -519,7 +542,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_clear_1progress_1handler * Method: serialize * Signature: (Ljava/lang/String;)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_serialize +jbyteArray JNICALL sqlite_serialize (JNIEnv *, jobject, jstring); /* @@ -527,7 +550,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_serialize * Method: deserialize * Signature: (Ljava/lang/String;[B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_deserialize +void JNICALL sqlite_deserialize (JNIEnv *, jobject, jstring, jbyteArray); #ifdef __cplusplus diff --git a/crates/sqlite/src/NativeDB.c b/crates/sqlite/src/NativeDB.c index cb2bf1eac7..23696b52c5 100644 --- a/crates/sqlite/src/NativeDB.c +++ b/crates/sqlite/src/NativeDB.c @@ -555,11 +555,7 @@ int xCompare(void* context, int len1, const void* str1, int len2, const void* st // INITIALISATION /////////////////////////////////////////////////// -#ifdef SQLITE_GVM_STATIC -JNIEXPORT jint JNICALL JNI_OnLoad_sqlitejdbc(JavaVM *vm, void *reserved) -#else -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) -#endif +JNIEXPORT jint JNICALL sqlite_on_load(JavaVM *vm, void *reserved) { JNIEnv* env = 0; @@ -574,7 +570,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) return loadStaticSqliteLib(env); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_isStatic(JNIEnv *env, void *reserved) { +JNIEXPORT jint JNICALL sqlite_isStatic(JNIEnv *env, void *reserved) { #ifdef SQLITE_GVM_STATIC return JNI_TRUE; #else @@ -582,18 +578,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_isStatic(JNIEnv *env, void #endif } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_initializeStatic(JNIEnv *env, void *reserved) { +JNIEXPORT jint JNICALL sqlite_initializeStatic(JNIEnv *env, void *reserved) { debugLog("SQLITE3: initializing static"); return loadStaticSqliteLib(env); } // FINALIZATION -#ifdef SQLITE_GVM_STATIC -JNIEXPORT void JNICALL JNI_OnUnload_sqlitejdbc(JavaVM *vm, void *reserved) -#else -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) -#endif +JNIEXPORT void JNICALL sqlite_on_unload(JavaVM *vm, void *reserved) { JNIEnv* env = 0; @@ -623,22 +615,15 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) did_initialize = false; } -#ifdef SQLITE_GVM_STATIC -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_unload(JavaVM *vm, void *reserved) { - JNI_OnUnload_sqlitejdbc(vm, reserved); -} -#endif - // WRAPPERS for sqlite_* functions ////////////////////////////////// -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_shared_1cache( +JNIEXPORT jint JNICALL sqlite_shared_1cache( JNIEnv *env, jobject this, jboolean enable) { return sqlite3_enable_shared_cache(enable ? 1 : 0); } - -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_enable_1load_1extension( +JNIEXPORT jint JNICALL sqlite_enable_1load_1extension( JNIEnv *env, jobject this, jboolean enable) { sqlite3 *db = gethandle(env, this); @@ -651,8 +636,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_enable_1load_1extension( return sqlite3_enable_load_extension(db, enable ? 1 : 0); } - -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_openUtf8( +JNIEXPORT void JNICALL sqlite__1open_1utf8( JNIEnv *env, jobject this, jbyteArray file, jint flags) { sqlite3 *db; @@ -685,7 +669,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_openUtf8( (void) sqlite3_extended_result_codes(db, 1); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_interrupt(JNIEnv *env, jobject this) +JNIEXPORT void JNICALL sqlite_interrupt(JNIEnv *env, jobject this) { sqlite3 *db = gethandle(env, this); if (!db) @@ -697,7 +681,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_interrupt(JNIEnv *env, jobj sqlite3_interrupt(db); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1timeout( +JNIEXPORT void JNICALL sqlite_busy_1timeout( JNIEnv *env, jobject this, jint ms) { sqlite3 *db = gethandle(env, this); @@ -750,12 +734,12 @@ void change_busy_handler(JNIEnv *env, jobject nativeDB, jobject busyHandler) set_new_handler(env, nativeDB, db_busyHandler, busyHandlerContext, &free_busy_handler); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_busy_1handler( +JNIEXPORT void JNICALL sqlite_busy_1handler( JNIEnv *env, jobject nativeDB, jobject busyHandler) { change_busy_handler(env, nativeDB, busyHandler); } -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_prepare_1utf8( +JNIEXPORT jlong JNICALL sqlite_prepare_1utf8( JNIEnv *env, jobject this, jbyteArray sql) { sqlite3* db; @@ -785,7 +769,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_prepare_1utf8( } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB__1exec_1utf8( +JNIEXPORT jint JNICALL sqlite__1exec_1utf8( JNIEnv *env, jobject this, jbyteArray sql) { sqlite3* db; @@ -816,7 +800,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB__1exec_1utf8( } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_errmsg_1utf8(JNIEnv *env, jobject this) +JNIEXPORT jobject JNICALL sqlite_errmsg_1utf8(JNIEnv *env, jobject this) { sqlite3 *db; const char *str; @@ -833,14 +817,14 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_errmsg_1utf8(JNIEnv *env return utf8BytesToDirectByteBuffer(env, str, strlen(str)); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_libversion_1utf8( +JNIEXPORT jobject JNICALL sqlite_libversion_1utf8( JNIEnv *env, jobject this) { const char* version = sqlite3_libversion(); return utf8BytesToDirectByteBuffer(env, version, strlen(version)); } -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_changes( +JNIEXPORT jlong JNICALL sqlite_changes( JNIEnv *env, jobject this) { sqlite3 *db = gethandle(env, this); @@ -853,7 +837,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_changes( return sqlite3_changes64(db); } -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_total_1changes( +JNIEXPORT jlong JNICALL sqlite_total_1changes( JNIEnv *env, jobject this) { sqlite3 *db = gethandle(env, this); @@ -866,7 +850,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_total_1changes( return sqlite3_total_changes64(db); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_finalize( +JNIEXPORT jint JNICALL sqlite_finalize( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -878,7 +862,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_finalize( return sqlite3_finalize(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_step( +JNIEXPORT jint JNICALL sqlite_step( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -890,7 +874,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_step( return sqlite3_step(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_reset( +JNIEXPORT jint JNICALL sqlite_reset( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -902,7 +886,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_reset( return sqlite3_reset(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_clear_1bindings( +JNIEXPORT jint JNICALL sqlite_clear_1bindings( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -914,7 +898,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_clear_1bindings( return sqlite3_clear_bindings(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1parameter_1count( +JNIEXPORT jint JNICALL sqlite_bind_1parameter_1count( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -926,7 +910,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1parameter_1count( return sqlite3_bind_parameter_count(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1count( +JNIEXPORT jint JNICALL sqlite_column_1count( JNIEnv *env, jobject this, jlong stmt) { if (!stmt) @@ -938,7 +922,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1count( return sqlite3_column_count(toref(stmt)); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1type( +JNIEXPORT jint JNICALL sqlite_column_1type( JNIEnv *env, jobject this, jlong stmt, jint col) { if (!stmt) @@ -950,7 +934,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1type( return sqlite3_column_type(toref(stmt), col); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1decltype_1utf8( +JNIEXPORT jobject JNICALL sqlite_column_1decltype_1utf8( JNIEnv *env, jobject this, jlong stmt, jint col) { const char *str; @@ -966,7 +950,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1decltype_1utf8( return utf8BytesToDirectByteBuffer(env, str, strlen(str)); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1table_1name_1utf8( +JNIEXPORT jobject JNICALL sqlite_column_1table_1name_1utf8( JNIEnv *env, jobject this, jlong stmt, jint col) { const char *str; @@ -982,7 +966,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1table_1name_1utf return utf8BytesToDirectByteBuffer(env, str, strlen(str)); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1name_1utf8( +JNIEXPORT jobject JNICALL sqlite_column_1name_1utf8( JNIEnv *env, jobject this, jlong stmt, jint col) { const char *str; @@ -999,7 +983,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1name_1utf8( return utf8BytesToDirectByteBuffer(env, str, strlen(str)); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1text_1utf8( +JNIEXPORT jobject JNICALL sqlite_column_1text_1utf8( JNIEnv *env, jobject this, jlong stmt, jint col) { sqlite3 *db; @@ -1031,7 +1015,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_column_1text_1utf8( return utf8BytesToDirectByteBuffer(env, bytes, nbytes); } -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_column_1blob( +JNIEXPORT jbyteArray JNICALL sqlite_column_1blob( JNIEnv *env, jobject this, jlong stmt, jint col) { sqlite3 *db; @@ -1082,7 +1066,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_column_1blob( return jBlob; } -JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_column_1double( +JNIEXPORT jdouble JNICALL sqlite_column_1double( JNIEnv *env, jobject this, jlong stmt, jint col) { if (!stmt) @@ -1094,7 +1078,7 @@ JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_column_1double( return sqlite3_column_double(toref(stmt), col); } -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_column_1long( +JNIEXPORT jlong JNICALL sqlite_column_1long( JNIEnv *env, jobject this, jlong stmt, jint col) { if (!stmt) @@ -1106,7 +1090,7 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_column_1long( return sqlite3_column_int64(toref(stmt), col); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1int( +JNIEXPORT jint JNICALL sqlite_column_1int( JNIEnv *env, jobject this, jlong stmt, jint col) { if (!stmt) @@ -1118,7 +1102,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_column_1int( return sqlite3_column_int(toref(stmt), col); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1null( +JNIEXPORT jint JNICALL sqlite_bind_1null( JNIEnv *env, jobject this, jlong stmt, jint pos) { if (!stmt) @@ -1130,7 +1114,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1null( return sqlite3_bind_null(toref(stmt), pos); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1int( +JNIEXPORT jint JNICALL sqlite_bind_1int( JNIEnv *env, jobject this, jlong stmt, jint pos, jint v) { if (!stmt) @@ -1142,7 +1126,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1int( return sqlite3_bind_int(toref(stmt), pos, v); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1long( +JNIEXPORT jint JNICALL sqlite_bind_1long( JNIEnv *env, jobject this, jlong stmt, jint pos, jlong v) { if (!stmt) @@ -1154,7 +1138,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1long( return sqlite3_bind_int64(toref(stmt), pos, v); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1double( +JNIEXPORT jint JNICALL sqlite_bind_1double( JNIEnv *env, jobject this, jlong stmt, jint pos, jdouble v) { if (!stmt) @@ -1166,7 +1150,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1double( return sqlite3_bind_double(toref(stmt), pos, v); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1text_1utf8( +JNIEXPORT jint JNICALL sqlite_bind_1text_1utf8( JNIEnv *env, jobject this, jlong stmt, jint pos, jbyteArray v) { int rc; @@ -1188,7 +1172,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1text_1utf8( return rc; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1blob( +JNIEXPORT jint JNICALL sqlite_bind_1blob( JNIEnv *env, jobject this, jlong stmt, jint pos, jbyteArray v) { jint rc; @@ -1209,14 +1193,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_bind_1blob( return rc; } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1null( +JNIEXPORT void JNICALL sqlite_result_1null( JNIEnv *env, jobject this, jlong context) { if (!context) return; sqlite3_result_null(toref(context)); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1text_1utf8( +JNIEXPORT void JNICALL sqlite_result_1text_1utf8( JNIEnv *env, jobject this, jlong context, jbyteArray value) { char* value_bytes; @@ -1236,7 +1220,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1text_1utf8( freeUtf8Bytes(value_bytes); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1blob( +JNIEXPORT void JNICALL sqlite_result_1blob( JNIEnv *env, jobject this, jlong context, jobject value) { jbyte *bytes; @@ -1252,28 +1236,28 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1blob( (*env)->ReleasePrimitiveArrayCritical(env, value, bytes, JNI_ABORT); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1double( +JNIEXPORT void JNICALL sqlite_result_1double( JNIEnv *env, jobject this, jlong context, jdouble value) { if (!context) return; sqlite3_result_double(toref(context), value); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1long( +JNIEXPORT void JNICALL sqlite_result_1long( JNIEnv *env, jobject this, jlong context, jlong value) { if (!context) return; sqlite3_result_int64(toref(context), value); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1int( +JNIEXPORT void JNICALL sqlite_result_1int( JNIEnv *env, jobject this, jlong context, jint value) { if (!context) return; sqlite3_result_int(toref(context), value); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1error_1utf8( +JNIEXPORT void JNICALL sqlite_result_1error_1utf8( JNIEnv *env, jobject this, jlong context, jbyteArray err) { char* err_bytes; @@ -1292,7 +1276,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_result_1error_1utf8( freeUtf8Bytes(err_bytes); } -JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_value_1text_1utf8( +JNIEXPORT jobject JNICALL sqlite_value_1text_1utf8( JNIEnv *env, jobject this, jobject f, jint arg) { const char* bytes; @@ -1307,7 +1291,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_core_NativeDB_value_1text_1utf8( return utf8BytesToDirectByteBuffer(env, bytes, nbytes); } -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_value_1blob( +JNIEXPORT jbyteArray JNICALL sqlite_value_1blob( JNIEnv *env, jobject this, jobject f, jint arg) { int length; @@ -1328,28 +1312,28 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_value_1blob( return jBlob; } -JNIEXPORT jdouble JNICALL Java_org_sqlite_core_NativeDB_value_1double( +JNIEXPORT jdouble JNICALL sqlite_value_1double( JNIEnv *env, jobject this, jobject f, jint arg) { sqlite3_value *value = tovalue(env, f, arg); return value ? sqlite3_value_double(value) : 0; } -JNIEXPORT jlong JNICALL Java_org_sqlite_core_NativeDB_value_1long( +JNIEXPORT jlong JNICALL sqlite_value_1long( JNIEnv *env, jobject this, jobject f, jint arg) { sqlite3_value *value = tovalue(env, f, arg); return value ? sqlite3_value_int64(value) : 0; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1int( +JNIEXPORT jint JNICALL sqlite_value_1int( JNIEnv *env, jobject this, jobject f, jint arg) { sqlite3_value *value = tovalue(env, f, arg); return value ? sqlite3_value_int(value) : 0; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_value_1type( +JNIEXPORT jint JNICALL sqlite_value_1type( JNIEnv *env, jobject this, jobject func, jint arg) { return sqlite3_value_type(tovalue(env, func, arg)); @@ -1373,7 +1357,7 @@ void free_udf_func(void *udfToFree) { free(udf); } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1function_1utf8( +JNIEXPORT jint JNICALL sqlite_create_1function_1utf8( JNIEnv *env, jobject nativeDB, jbyteArray name, jobject func, jint nArgs, jint flags) { jint ret = 0; @@ -1424,7 +1408,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1function_1utf8( return ret; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1function_1utf8( +JNIEXPORT jint JNICALL sqlite_destroy_1function_1utf8( JNIEnv *env, jobject nativeDB, jbyteArray name) { jint ret = 0; @@ -1441,7 +1425,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1function_1utf8( return ret; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1collation_1utf8( +JNIEXPORT jint JNICALL sqlite_create_1collation_1utf8( JNIEnv *env, jobject this, jbyteArray name, jobject func) { jint ret = 0; @@ -1471,7 +1455,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_create_1collation_1utf8( return ret; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1collation_1utf8( +JNIEXPORT jint JNICALL sqlite_destroy_1collation_1utf8( JNIEnv *env, jobject this, jbyteArray name) { jint ret = 0; @@ -1488,7 +1472,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_destroy_1collation_1utf8( return ret; } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_limit(JNIEnv *env, jobject this, jint id, jint value) +JNIEXPORT jint JNICALL sqlite_limit(JNIEnv *env, jobject this, jint id, jint value) { sqlite3* db; @@ -1505,7 +1489,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_limit(JNIEnv *env, jobject // COMPOUND FUNCTIONS /////////////////////////////////////////////// -JNIEXPORT jobjectArray JNICALL Java_org_sqlite_core_NativeDB_column_1metadata( +JNIEXPORT jobjectArray JNICALL sqlite_column_1metadata( JNIEnv *env, jobject this, jlong stmt) { const char *zTableName, *zColumnName; @@ -1633,7 +1617,7 @@ void copyLoop(JNIEnv *env, sqlite3_backup *pBackup, jobject progress, ** If the backup process is successfully completed, SQLITE_OK is returned. ** Otherwise, if an error occurs, an SQLite error code is returned. */ -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup( +JNIEXPORT jint JNICALL sqlite_backup( JNIEnv *env, jobject this, jbyteArray zDBName, jbyteArray zFilename, /* Name of file to back up to */ @@ -1704,7 +1688,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_backup( #endif } -JNIEXPORT jint JNICALL Java_org_sqlite_core_NativeDB_restore( +JNIEXPORT jint JNICALL sqlite_restore( JNIEnv *env, jobject this, jbyteArray zDBName, jbyteArray zFilename, /* Name of file to restore from */ @@ -1825,7 +1809,7 @@ static void change_progress_handler(JNIEnv *env, jobject nativeDB, jobject progr set_new_handler(env, nativeDB, db_progressHandler, progressHandlerContext, &free_progress_handler); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_register_1progress_1handler( +JNIEXPORT void JNICALL sqlite_register_1progress_1handler( JNIEnv *env, jobject nativeDB, jint vmCalls, @@ -1835,7 +1819,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_register_1progress_1handler change_progress_handler(env, nativeDB, progressHandler, vmCalls); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_clear_1progress_1handler( +JNIEXPORT void JNICALL sqlite_clear_1progress_1handler( JNIEnv *env, jobject nativeDB ) @@ -1876,7 +1860,7 @@ static void clear_update_listener(JNIEnv *env, jobject nativeDB){ set_new_handler(env, nativeDB, db_updateListener, NULL, &free_update_handler); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1update_1listener(JNIEnv *env, jobject nativeDB, jboolean enabled) { +JNIEXPORT void JNICALL sqlite_set_1update_1listener(JNIEnv *env, jobject nativeDB, jboolean enabled) { if (enabled) { struct UpdateHandlerContext* update_handler_context = (struct UpdateHandlerContext*) malloc(sizeof(struct UpdateHandlerContext)); update_handler_context->handler = (*env)->NewGlobalRef(env, nativeDB); @@ -1922,7 +1906,7 @@ void clear_commit_listener(JNIEnv *env, jobject nativeDB, sqlite3 *db) { set_new_handler(env, nativeDB, db_commitListener, NULL, freeCommitHandlerCtx); } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1commit_1listener(JNIEnv *env, jobject nativeDB, jboolean enabled) { +JNIEXPORT void JNICALL sqlite_set_1commit_1listener(JNIEnv *env, jobject nativeDB, jboolean enabled) { sqlite3 *db = gethandle(env, nativeDB); if (enabled) { struct CommitHandlerContext *commit_handler_context = (struct CommitHandlerContext*) malloc(sizeof(struct CommitHandlerContext)); @@ -1936,7 +1920,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_set_1commit_1listener(JNIEn } } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1close( +JNIEXPORT void JNICALL sqlite__1close( JNIEnv *env, jobject nativeDB) { sqlite3 *db = gethandle(env, nativeDB); @@ -1955,7 +1939,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB__1close( } } -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_serialize(JNIEnv *env, jobject this, jstring jschema) +JNIEXPORT jbyteArray JNICALL sqlite_serialize(JNIEnv *env, jobject this, jstring jschema) { sqlite3 *db = gethandle(env, this); @@ -2013,7 +1997,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_core_NativeDB_serialize(JNIEnv *env return jbuff; } -JNIEXPORT void JNICALL Java_org_sqlite_core_NativeDB_deserialize(JNIEnv *env, jobject this, jstring jschema, jbyteArray jbuff) +JNIEXPORT void JNICALL sqlite_deserialize(JNIEnv *env, jobject this, jstring jschema, jbyteArray jbuff) { sqlite3 *db = gethandle(env, this); if (!db) diff --git a/crates/sqlite/src/lib.rs b/crates/sqlite/src/lib.rs index 84c3d923ed..60fba42b6e 100644 --- a/crates/sqlite/src/lib.rs +++ b/crates/sqlite/src/lib.rs @@ -12,12 +12,905 @@ */ #![allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - improper_ctypes, - dead_code + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + improper_ctypes, + dead_code, + clippy::missing_safety_doc, + clippy::type_complexity )] -#![forbid(unsafe_code)] + +use core::ffi::c_void; +use java_native::{jni, on_load, on_unload}; include!(concat!(env!("OUT_DIR"), "/libsqlitejdbc.rs")); + +#[on_load("sqlitejdbc")] +pub unsafe fn on_load_static(vm: *mut JavaVM, reserved: *mut c_void) -> jint { + sqlite_on_load(vm, reserved) +} + +#[on_unload("sqlitejdbc")] +pub unsafe fn on_unload_static(vm: *mut JavaVM, reserved: *mut c_void) { + sqlite_on_unload(vm, reserved) +} + +/// Determine if the SQLite library is operating in static JNI mode. +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn isStatic(env: *mut JNIEnv, this: *mut c_void) -> jint { + sqlite_isStatic(env, this) +} + +/// Initialize the SQLite library. +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn initializeStatic(env: *mut JNIEnv, this: *mut c_void) -> jint { + sqlite_initializeStatic(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: _open_utf8 +// * Signature: ([BI)V +// */ +// JNIEXPORT void JNICALL sqlite__1open_1utf8 +// (JNIEnv *, jobject, jbyteArray, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn openUtf8(env: *mut JNIEnv, this: jobject, jfilename: jbyteArray, flags: jint) { + sqlite__1open_1utf8(env, this, jfilename, flags) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: _close +// * Signature: ()V +// */ +// JNIEXPORT void JNICALL sqlite__1close +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn _close(env: *mut JNIEnv, this: jobject) { + sqlite__1close(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: _exec_utf8 +// * Signature: ([B)I +// */ +// JNIEXPORT jint JNICALL sqlite__1exec_1utf8 +// (JNIEnv *, jobject, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn _exec_utf8(env: *mut JNIEnv, this: jobject, jsql: jbyteArray) -> jint { + sqlite__1exec_1utf8(env, this, jsql) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: shared_cache +// * Signature: (Z)I +// */ +// JNIEXPORT jint JNICALL sqlite_shared_1cache +// (JNIEnv *, jobject, jboolean); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn shared_cache(env: *mut JNIEnv, this: jobject, enable: jboolean) -> jint { + sqlite_shared_1cache(env, this, enable) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: enable_load_extension +// * Signature: (Z)I +// */ +// JNIEXPORT jint JNICALL sqlite_enable_1load_1extension +// (JNIEnv *, jobject, jboolean); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn enable_load_extension(env: *mut JNIEnv, this: jobject, enable: jboolean) -> jint { + sqlite_enable_1load_1extension(env, this, enable) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: interrupt +// * Signature: ()V +// */ +// JNIEXPORT void JNICALL sqlite_interrupt +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn interrupt(env: *mut JNIEnv, this: jobject) { + sqlite_interrupt(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: busy_timeout +// * Signature: (I)V +// */ +// JNIEXPORT void JNICALL sqlite_busy_1timeout +// (JNIEnv *, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn busy_timeout(env: *mut JNIEnv, this: jobject, ms: jint) { + sqlite_busy_1timeout(env, this, ms) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: busy_handler +// * Signature: (Lorg/sqlite/BusyHandler;)V +// */ +// JNIEXPORT void JNICALL sqlite_busy_1handler +// (JNIEnv *, jobject, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn busy_handler(env: *mut JNIEnv, this: jobject, handler: jobject) { + sqlite_busy_1handler(env, this, handler) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: prepare_utf8 +// * Signature: ([B)J +// */ +// JNIEXPORT jlong JNICALL sqlite_prepare_1utf8 +// (JNIEnv *, jobject, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn prepare_utf8(env: *mut JNIEnv, this: jobject, jsql: jbyteArray) -> jlong { + sqlite_prepare_1utf8(env, this, jsql) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: errmsg_utf8 +// * Signature: ()Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_errmsg_1utf8 +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn errmsg_utf8(env: *mut JNIEnv, this: jobject) -> jobject { + sqlite_errmsg_1utf8(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: libversion_utf8 +// * Signature: ()Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_libversion_1utf8 +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn libversion_utf8(env: *mut JNIEnv, this: jobject) -> jobject { + sqlite_libversion_1utf8(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: changes +// * Signature: ()J +// */ +// JNIEXPORT jlong JNICALL sqlite_changes +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn changes(env: *mut JNIEnv, this: jobject) -> jlong { + sqlite_changes(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: total_changes +// * Signature: ()J +// */ +// JNIEXPORT jlong JNICALL sqlite_total_1changes +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn total_changes(env: *mut JNIEnv, this: jobject) -> jlong { + sqlite_total_1changes(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: finalize +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_finalize +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn finalize(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_finalize(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: step +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_step +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn step(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_step(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: reset +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_reset +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn reset(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_reset(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: clear_bindings +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_clear_1bindings +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn clear_bindings(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_clear_1bindings(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_parameter_count +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1parameter_1count +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_parameter_count(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_bind_1parameter_1count(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_count +// * Signature: (J)I +// */ +// JNIEXPORT jint JNICALL sqlite_column_1count +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_count(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jint { + sqlite_column_1count(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_type +// * Signature: (JI)I +// */ +// JNIEXPORT jint JNICALL sqlite_column_1type +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_type(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jint { + sqlite_column_1type(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_decltype_utf8 +// * Signature: (JI)Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_column_1decltype_1utf8 +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_decltype_utf8( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + col: jint, +) -> jobject { + sqlite_column_1decltype_1utf8(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_table_name_utf8 +// * Signature: (JI)Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_column_1table_1name_1utf8 +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_table_name_utf8( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + col: jint, +) -> jobject { + sqlite_column_1table_1name_1utf8(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_name_utf8 +// * Signature: (JI)Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_column_1name_1utf8 +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_name_utf8(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jobject { + sqlite_column_1name_1utf8(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_text_utf8 +// * Signature: (JI)Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_column_1text_1utf8 +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_text_utf8(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jobject { + sqlite_column_1text_1utf8(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_blob +// * Signature: (JI)[B +// */ +// JNIEXPORT jbyteArray JNICALL sqlite_column_1blob +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_blob(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jbyteArray { + sqlite_column_1blob(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_double +// * Signature: (JI)D +// */ +// JNIEXPORT jdouble JNICALL sqlite_column_1double +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_double(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jdouble { + sqlite_column_1double(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_long +// * Signature: (JI)J +// */ +// JNIEXPORT jlong JNICALL sqlite_column_1long +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_long(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jlong { + sqlite_column_1long(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_int +// * Signature: (JI)I +// */ +// JNIEXPORT jint JNICALL sqlite_column_1int +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_int(env: *mut JNIEnv, this: jobject, stmt: jlong, col: jint) -> jint { + sqlite_column_1int(env, this, stmt, col) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_null +// * Signature: (JI)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1null +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_null(env: *mut JNIEnv, this: jobject, stmt: jlong, pos: jint) -> jint { + sqlite_bind_1null(env, this, stmt, pos) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_int +// * Signature: (JII)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1int +// (JNIEnv *, jobject, jlong, jint, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_int(env: *mut JNIEnv, this: jobject, stmt: jlong, pos: jint, val: jint) -> jint { + sqlite_bind_1int(env, this, stmt, pos, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_long +// * Signature: (JIJ)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1long +// (JNIEnv *, jobject, jlong, jint, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_long( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + pos: jint, + val: jlong, +) -> jint { + sqlite_bind_1long(env, this, stmt, pos, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_double +// * Signature: (JID)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1double +// (JNIEnv *, jobject, jlong, jint, jdouble); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_double( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + pos: jint, + val: jdouble, +) -> jint { + sqlite_bind_1double(env, this, stmt, pos, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_text_utf8 +// * Signature: (JI[B)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1text_1utf8 +// (JNIEnv *, jobject, jlong, jint, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_text_utf8( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + pos: jint, + val: jbyteArray, +) -> jint { + sqlite_bind_1text_1utf8(env, this, stmt, pos, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: bind_blob +// * Signature: (JI[B)I +// */ +// JNIEXPORT jint JNICALL sqlite_bind_1blob +// (JNIEnv *, jobject, jlong, jint, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn bind_blob( + env: *mut JNIEnv, + this: jobject, + stmt: jlong, + pos: jint, + val: jbyteArray, +) -> jint { + sqlite_bind_1blob(env, this, stmt, pos, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_null +// * Signature: (J)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1null +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_null(env: *mut JNIEnv, this: jobject, stmt: jlong) { + sqlite_result_1null(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_text_utf8 +// * Signature: (J[B)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1text_1utf8 +// (JNIEnv *, jobject, jlong, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_text_utf8(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jbyteArray) { + sqlite_result_1text_1utf8(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_blob +// * Signature: (J[B)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1blob +// (JNIEnv *, jobject, jlong, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_blob(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jbyteArray) { + sqlite_result_1blob(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_double +// * Signature: (JD)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1double +// (JNIEnv *, jobject, jlong, jdouble); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_double(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jdouble) { + sqlite_result_1double(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_long +// * Signature: (JJ)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1long +// (JNIEnv *, jobject, jlong, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_long(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jlong) { + sqlite_result_1long(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_int +// * Signature: (JI)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1int +// (JNIEnv *, jobject, jlong, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_int(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jint) { + sqlite_result_1int(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: result_error_utf8 +// * Signature: (J[B)V +// */ +// JNIEXPORT void JNICALL sqlite_result_1error_1utf8 +// (JNIEnv *, jobject, jlong, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn result_error_utf8(env: *mut JNIEnv, this: jobject, stmt: jlong, val: jbyteArray) { + sqlite_result_1error_1utf8(env, this, stmt, val) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_text_utf8 +// * Signature: (Lorg/sqlite/Function;I)Ljava/nio/ByteBuffer; +// */ +// JNIEXPORT jobject JNICALL sqlite_value_1text_1utf8 +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_text_utf8( + env: *mut JNIEnv, + this: jobject, + func: jobject, + arg: jint, +) -> jobject { + sqlite_value_1text_1utf8(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_blob +// * Signature: (Lorg/sqlite/Function;I)[B +// */ +// JNIEXPORT jbyteArray JNICALL sqlite_value_1blob +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_blob(env: *mut JNIEnv, this: jobject, func: jobject, arg: jint) -> jbyteArray { + sqlite_value_1blob(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_double +// * Signature: (Lorg/sqlite/Function;I)D +// */ +// JNIEXPORT jdouble JNICALL sqlite_value_1double +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_double(env: *mut JNIEnv, this: jobject, func: jobject, arg: jint) -> jdouble { + sqlite_value_1double(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_long +// * Signature: (Lorg/sqlite/Function;I)J +// */ +// JNIEXPORT jlong JNICALL sqlite_value_1long +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_long(env: *mut JNIEnv, this: jobject, func: jobject, arg: jint) -> jlong { + sqlite_value_1long(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_int +// * Signature: (Lorg/sqlite/Function;I)I +// */ +// JNIEXPORT jint JNICALL sqlite_value_1int +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_int(env: *mut JNIEnv, this: jobject, func: jobject, arg: jint) -> jint { + sqlite_value_1int(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: value_type +// * Signature: (Lorg/sqlite/Function;I)I +// */ +// JNIEXPORT jint JNICALL sqlite_value_1type +// (JNIEnv *, jobject, jobject, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn value_type(env: *mut JNIEnv, this: jobject, func: jobject, arg: jint) -> jint { + sqlite_value_1type(env, this, func, arg) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: create_function_utf8 +// * Signature: ([BLorg/sqlite/Function;II)I +// */ +// JNIEXPORT jint JNICALL sqlite_create_1function_1utf8 +// (JNIEnv *, jobject, jbyteArray, jobject, jint, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn create_function_utf8( + env: *mut JNIEnv, + this: jobject, + jname: jbyteArray, + func: jobject, + nargs: jint, + flags: jint, +) -> jint { + sqlite_create_1function_1utf8(env, this, jname, func, nargs, flags) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: destroy_function_utf8 +// * Signature: ([B)I +// */ +// JNIEXPORT jint JNICALL sqlite_destroy_1function_1utf8 +// (JNIEnv *, jobject, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn destroy_function_utf8(env: *mut JNIEnv, this: jobject, jname: jbyteArray) -> jint { + sqlite_destroy_1function_1utf8(env, this, jname) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: create_collation_utf8 +// * Signature: ([BLorg/sqlite/Collation;)I +// */ +// JNIEXPORT jint JNICALL sqlite_create_1collation_1utf8 +// (JNIEnv *, jobject, jbyteArray, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn create_collation_utf8( + env: *mut JNIEnv, + this: jobject, + jname: jbyteArray, + collation: jobject, +) -> jint { + sqlite_create_1collation_1utf8(env, this, jname, collation) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: destroy_collation_utf8 +// * Signature: ([B)I +// */ +// JNIEXPORT jint JNICALL sqlite_destroy_1collation_1utf8 +// (JNIEnv *, jobject, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn destroy_collation_utf8(env: *mut JNIEnv, this: jobject, jname: jbyteArray) -> jint { + sqlite_destroy_1collation_1utf8(env, this, jname) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: limit +// * Signature: (II)I +// */ +// JNIEXPORT jint JNICALL sqlite_limit +// (JNIEnv *, jobject, jint, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn limit(env: *mut JNIEnv, this: jobject, id: jint, newVal: jint) -> jint { + sqlite_limit(env, this, id, newVal) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: backup +// * Signature: ([B[BLorg/sqlite/core/DB/ProgressObserver;III)I +// */ +// JNIEXPORT jint JNICALL sqlite_backup +// (JNIEnv *, jobject, jbyteArray, jbyteArray, jobject, jint, jint, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn backup( + env: *mut JNIEnv, + this: jobject, + jfilename: jbyteArray, + jdest: jbyteArray, + observer: jobject, + pages: jint, + sleep: jint, + step: jint, +) -> jint { + sqlite_backup(env, this, jfilename, jdest, observer, pages, sleep, step) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: restore +// * Signature: ([B[BLorg/sqlite/core/DB/ProgressObserver;III)I +// */ +// JNIEXPORT jint JNICALL sqlite_restore +// (JNIEnv *, jobject, jbyteArray, jbyteArray, jobject, jint, jint, jint); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn restore( + env: *mut JNIEnv, + this: jobject, + jfilename: jbyteArray, + jdest: jbyteArray, + observer: jobject, + pages: jint, + sleep: jint, + step: jint, +) -> jint { + sqlite_restore(env, this, jfilename, jdest, observer, pages, sleep, step) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: column_metadata +// * Signature: (J)[[Z +// */ +// JNIEXPORT jobjectArray JNICALL sqlite_column_1metadata +// (JNIEnv *, jobject, jlong); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn column_metadata(env: *mut JNIEnv, this: jobject, stmt: jlong) -> jobjectArray { + sqlite_column_1metadata(env, this, stmt) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: set_commit_listener +// * Signature: (Z)V +// */ +// JNIEXPORT void JNICALL sqlite_set_1commit_1listener +// (JNIEnv *, jobject, jboolean); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn set_commit_listener(env: *mut JNIEnv, this: jobject, enable: jboolean) { + sqlite_set_1commit_1listener(env, this, enable) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: set_update_listener +// * Signature: (Z)V +// */ +// JNIEXPORT void JNICALL sqlite_set_1update_1listener +// (JNIEnv *, jobject, jboolean); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn set_update_listener(env: *mut JNIEnv, this: jobject, enable: jboolean) { + sqlite_set_1update_1listener(env, this, enable) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: register_progress_handler +// * Signature: (ILorg/sqlite/ProgressHandler;)V +// */ +// JNIEXPORT void JNICALL sqlite_register_1progress_1handler +// (JNIEnv *, jobject, jint, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn register_progress_handler( + env: *mut JNIEnv, + this: jobject, + steps: jint, + handler: jobject, +) { + sqlite_register_1progress_1handler(env, this, steps, handler) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: clear_progress_handler +// * Signature: ()V +// */ +// JNIEXPORT void JNICALL sqlite_clear_1progress_1handler +// (JNIEnv *, jobject); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn clear_progress_handler(env: *mut JNIEnv, this: jobject) { + sqlite_clear_1progress_1handler(env, this) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: serialize +// * Signature: (Ljava/lang/String;)[B +// */ +// jbyteArray JNICALL sqlite_serialize +// (JNIEnv *, jobject, jstring); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn serialize(env: *mut JNIEnv, this: jobject, db: jstring) -> jbyteArray { + sqlite_serialize(env, this, db) +} + +// /* +// * Class: org_sqlite_core_NativeDB +// * Method: deserialize +// * Signature: (Ljava/lang/String;[B)V +// */ +// void JNICALL sqlite_deserialize +// (JNIEnv *, jobject, jstring, jbyteArray); + +#[jni("org.sqlite.core.NativeDB")] +pub unsafe fn deserialize(env: *mut JNIEnv, this: jobject, jschema: jstring, jbuff: jbyteArray) { + sqlite_deserialize(env, this, jschema, jbuff) +} diff --git a/crates/substrate/Cargo.toml b/crates/substrate/Cargo.toml index 5f177e2849..1847fcb1fc 100644 --- a/crates/substrate/Cargo.toml +++ b/crates/substrate/Cargo.toml @@ -26,6 +26,7 @@ crate-type = ["lib", "staticlib", "cdylib"] java_native = { workspace = true } jni = { workspace = true, default-features = false } jni-sys = { workspace = true } +libloading = { workspace = true } [build-dependencies] builder = { workspace = true } diff --git a/crates/substrate/build.rs b/crates/substrate/build.rs index 62f9f17a68..525cab4cec 100644 --- a/crates/substrate/build.rs +++ b/crates/substrate/build.rs @@ -14,12 +14,11 @@ use builder::{build_bindings, cargo_lib_metadata}; fn main() { - // link against lib jvm - cargo_lib_metadata(None); - println!("cargo:rustc-link-lib=jvm"); + // link against lib jvm + cargo_lib_metadata(None); - // generate rust bindings - let bindings = bindgen::Builder::default().header("headers/substrate.h"); + // generate rust bindings + let bindings = bindgen::Builder::default().header("headers/substrate.h"); - build_bindings("libjvm.rs", bindings); + build_bindings("libjvm", "libjvm.rs", bindings); } diff --git a/crates/substrate/src/lib.rs b/crates/substrate/src/lib.rs index 5a248dc90b..360657bb8a 100644 --- a/crates/substrate/src/lib.rs +++ b/crates/substrate/src/lib.rs @@ -12,11 +12,11 @@ */ #![allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - improper_ctypes + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + improper_ctypes )] -#![forbid(unsafe_code, dead_code)] +#![forbid(dead_code)] include!(concat!(env!("OUT_DIR"), "/libjvm.rs")); diff --git a/crates/terminal/build.rs b/crates/terminal/build.rs index df28fecc89..f6272b9de3 100644 --- a/crates/terminal/build.rs +++ b/crates/terminal/build.rs @@ -13,53 +13,58 @@ use bindgen::Builder; use builder::{ - build_bindings, build_dual_cc, header_file, setup_cc, src_file, target_os, TargetOs, + build_bindings, + build_dual_cc, + header_file, + setup_cc, + src_file, + target_os, + TargetOs, }; fn main() { - // decide if we are on darwin - let os = target_os(); - let mut build = setup_cc(); + // decide if we are on darwin + let os = target_os(); + let mut build = setup_cc(); - build - // Warnings - .flag("-Werror") - .flag("-Wno-unused-parameter") - .flag("-Wno-unused-command-line-argument") - .flag("-Wno-sign-compare") - // Sources: Jansi & JLine - .file(src_file("clibrary.c")) - .file(src_file("jansi.c")) - .file(src_file("jansi_isatty.c")) - .file(src_file("jansi_structs.c")) - .file(src_file("jansi_ttyname.c")) - .file(src_file("jlinenative.c")) - .file(src_file("terminaljni.c")); + build + // Warnings + .flag("-Werror") + .flag("-Wno-unused-parameter") + .flag("-Wno-unused-command-line-argument") + .flag("-Wno-sign-compare") + // Sources: Jansi & JLine + .file(src_file("clibrary.c")) + .file(src_file("jansi.c")) + .file(src_file("jansi_isatty.c")) + .file(src_file("jansi_structs.c")) + .file(src_file("jansi_ttyname.c")) + .file(src_file("jlinenative.c")) + .file(src_file("terminaljni.c")); - let bindings_builder: Builder = match os { - TargetOs::Darwin => Builder::default() - .header(header_file("jansi.h")) - .header(header_file("jansi_structs.h")) - .header(header_file("jlinenative.h")), + let bindings_builder: Builder = match os { + TargetOs::Darwin => Builder::default() + .header(header_file("jansi.h")) + .header(header_file("jansi_structs.h")) + .header(header_file("jlinenative.h")), - TargetOs::Linux => Builder::default() - .header(header_file("jansi.h")) - .header(header_file("jansi_structs.h")) - .header(header_file("jlinenative.h")), + TargetOs::Linux => Builder::default() + .header(header_file("jansi.h")) + .header(header_file("jansi_structs.h")) + .header(header_file("jlinenative.h")), - TargetOs::Windows => { - build - // Windows C Sources - .file(src_file("kernel32.c")); + TargetOs::Windows => { + build + // Windows C Sources + .file(src_file("kernel32.c")); - Builder::default() - .header(header_file("jansi.h")) - .header(header_file("jansi_structs.h")) - .header(header_file("jlinenative.h")) - } - }; + Builder::default() + .header(header_file("jansi.h")) + .header(header_file("jansi_structs.h")) + .header(header_file("jlinenative.h")) + } + }; - build_dual_cc(build, "terminalcore", "terminal", None, None); - - build_bindings("libterminal.rs", bindings_builder); + build_dual_cc(build, "terminalcore", "terminal", None, None); + build_bindings("terminal", "libterminal.rs", bindings_builder); } diff --git a/crates/terminal/src/lib.rs b/crates/terminal/src/lib.rs index b21debdc3c..647a6a7719 100644 --- a/crates/terminal/src/lib.rs +++ b/crates/terminal/src/lib.rs @@ -12,11 +12,9 @@ */ #![allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - improper_ctypes + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + improper_ctypes )] #![forbid(dead_code)] - -include!(concat!(env!("OUT_DIR"), "/libterminal.rs")); diff --git a/crates/transport/build.rs b/crates/transport/build.rs index 67523d374d..52b597c864 100644 --- a/crates/transport/build.rs +++ b/crates/transport/build.rs @@ -13,108 +13,100 @@ use bindgen::Builder; use builder::{ - build_bindings, build_dual_cc, header_file, setup_cc, src_file, target_os, TargetOs, + build_bindings, + build_dual_cc, + header_file, + setup_cc, + src_file, + target_os, + TargetOs, }; fn main() { - let os = target_os(); - let mut build = setup_cc(); - - build - // Compiler Settings - .std("gnu99") - // Warnings - .flag("-Wformat=2") - .flag("-Wformat-security") - .flag("-Wnull-dereference") - .flag("-Wstack-protector") - .flag("-Walloca") - .flag("-Warray-bounds") - .flag("-Wimplicit-fallthrough") - .flag("-Wstrict-overflow=4") - .flag("-Wswitch-enum") - .flag("-Wno-switch-default") - .flag("-Wno-unused-parameter") - .flag("-Wno-sign-compare") - .flag("-Wno-sign-conversion") - .flag("-Wno-strict-prototypes"); - - build - // Defines & Compiler Settings - .define("TCN_BUILD_STATIC", "1") - .define("NETTY_BUILD_STATIC", "1") - .define("NETTY_BUILD_GRAALVM", "1") - .define("NETTY_GVM_STATIC", "1"); - - let bindings_builder: Builder = match os { - TargetOs::Darwin => { - build - // C Flags: macOS - .flag("-mmacosx-version-min=12.3"); - - build - // Sources: Netty KQueue - .file(src_file("netty_kqueue_bsdsocket.c")) - .file(src_file("netty_kqueue_eventarray.c")) - .file(src_file("netty_kqueue_native.c")); - - Builder::default() - .header(header_file("netty_jni_util.h")) - .header(header_file("netty_kqueue_bsdsocket.h")) - .header(header_file("netty_kqueue_eventarray.h")) - .header(header_file("ssl.h")) - } - - TargetOs::Linux => { - build - // Sources: Netty EPoll - .file(src_file("netty_epoll_linuxsocket.c")) - .file(src_file("netty_epoll_native.c")); - - build - // Sources: Netty IOUring - .file(src_file("netty_io_uring_linuxsocket.c")) - .file(src_file("netty_io_uring_native.c")) - .file(src_file("syscall.c")); - - Builder::default().header("headers/netty_jni_util.h") - } - - TargetOs::Windows => Builder::default().header("headers/netty_jni_util.h"), - }; - - build - // Sources: Tomcat Native / APR - .file(src_file("bb.c")) - .file(src_file("cert_compress.c")) - .file(src_file("error.c")) - .file(src_file("jnilib.c")) - .file(src_file("native_constants.c")) - .file(src_file("ssl.c")) - .file(src_file("sslcontext.c")) - .file(src_file("sslsession.c")) - .file(src_file("sslutils.c")); - - build - // Sources: Netty JNI / Unix Commons - .file(src_file("netty_jni_util.c")) - .file(src_file("netty_unix.c")) - .file(src_file("netty_unix_buffer.c")) - .file(src_file("netty_unix_errors.c")) - .file(src_file("netty_unix_filedescriptor.c")) - .file(src_file("netty_unix_limits.c")) - .file(src_file("netty_unix_socket.c")) - .file(src_file("netty_unix_util.c")); - - let shared_cflags = vec!["-lssl", "-lcrypto", "-lapr-2", "-lz", "-lc++"]; - - build_dual_cc( - build, - "transportcore", - "transport", - None, - Some(shared_cflags), - ); - - build_bindings("libtransport.rs", bindings_builder); + let os = target_os(); + let mut build = setup_cc(); + + build + // Compiler Settings + .std("gnu99") + .flag("-w"); + + build + // Defines & Compiler Settings + .define("TCN_BUILD_STATIC", "1") + .define("NETTY_BUILD_STATIC", "1") + .define("NETTY_BUILD_GRAALVM", "1") + .define("NETTY_GVM_STATIC", "1"); + + let bindings_builder: Builder = match os { + TargetOs::Darwin => { + build + // C Flags: macOS + .flag("-mmacosx-version-min=12.3"); + + build + // Sources: Netty KQueue + .file(src_file("netty_kqueue_bsdsocket.c")) + .file(src_file("netty_kqueue_eventarray.c")) + .file(src_file("netty_kqueue_native.c")); + + Builder::default() + .header(header_file("netty_jni_util.h")) + .header(header_file("netty_kqueue_bsdsocket.h")) + .header(header_file("netty_kqueue_eventarray.h")) + .header(header_file("ssl.h")) + } + + TargetOs::Linux => { + build + // Sources: Netty EPoll + .file(src_file("netty_epoll_linuxsocket.c")) + .file(src_file("netty_epoll_native.c")); + + build + // Sources: Netty IOUring + .file(src_file("netty_io_uring_linuxsocket.c")) + .file(src_file("netty_io_uring_native.c")) + .file(src_file("syscall.c")); + + Builder::default().header("headers/netty_jni_util.h") + } + + TargetOs::Windows => Builder::default().header("headers/netty_jni_util.h"), + }; + + build + // Sources: Tomcat Native / APR + .file(src_file("bb.c")) + .file(src_file("cert_compress.c")) + .file(src_file("error.c")) + .file(src_file("jnilib.c")) + .file(src_file("native_constants.c")) + .file(src_file("ssl.c")) + .file(src_file("sslcontext.c")) + .file(src_file("sslsession.c")) + .file(src_file("sslutils.c")); + + build + // Sources: Netty JNI / Unix Commons + .file(src_file("netty_jni_util.c")) + .file(src_file("netty_unix.c")) + .file(src_file("netty_unix_buffer.c")) + .file(src_file("netty_unix_errors.c")) + .file(src_file("netty_unix_filedescriptor.c")) + .file(src_file("netty_unix_limits.c")) + .file(src_file("netty_unix_socket.c")) + .file(src_file("netty_unix_util.c")); + + let shared_cflags = vec!["-lssl", "-lcrypto", "-lapr-2", "-lz", "-lc++"]; + + build_dual_cc( + build, + "transportcore", + "transport", + None, + Some(shared_cflags), + ); + + build_bindings("transport", "libtransport.rs", bindings_builder); } diff --git a/crates/transport/src/lib.rs b/crates/transport/src/lib.rs index ff6351f629..c80f3835d8 100644 --- a/crates/transport/src/lib.rs +++ b/crates/transport/src/lib.rs @@ -12,11 +12,8 @@ */ #![allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - improper_ctypes + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + improper_ctypes )] -#![forbid(unsafe_code, dead_code)] - -include!(concat!(env!("OUT_DIR"), "/libtransport.rs")); diff --git a/elide.toml b/elide.toml new file mode 100644 index 0000000000..ae3ea3432f --- /dev/null +++ b/elide.toml @@ -0,0 +1,5 @@ +version = 1 + +[project] +name = "elide" +version = "1.0.0-alpha11-SNAPSHOT" diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 0000000000..1a45eee776 --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,4 @@ +target +corpus +artifacts +coverage diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000000..0ea9e9c6c6 --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "base-fuzz" +version = "0.0.0" +publish = false +edition = "2021" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" + +[dependencies.base] +path = ".." + +[[bin]] +name = "fuzz_target_1" +path = "fuzz_targets/fuzz_target_1.rs" +test = false +doc = false +bench = false diff --git a/fuzz/fuzz_targets/fuzz_target_1.rs b/fuzz/fuzz_targets/fuzz_target_1.rs new file mode 100644 index 0000000000..43a88c14f3 --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_target_1.rs @@ -0,0 +1,7 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + // fuzzed code goes here +}); diff --git a/gradle.properties b/gradle.properties index 6641028ec1..63d0a9639b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -101,9 +101,7 @@ nodeVersion = 22.0.0 # Settings: Kotlin kotlin.code.style = official -kotlin.js.compiler = ir kotlin.mpp.stability.nowarn = true -kotlin.wasm.stability.nowarn = true kotlin.js.yarn = false kotlin.js.generate.executable.default = false kotlin.js.ir.output.granularity = per-file @@ -111,7 +109,6 @@ kotlin.jvm.target.validation.mode = warning kotlin.parallel.tasks.in.project = true kotlin.build.report.output = build_scan kotlin.incremental = true -kotlin.incremental.useClasspathSnapshot = true kotlin.apple.xcodeCompatibility.nowarn = true kotlin.stdlib.default.dependency = true kotlin.native.ignoreDisabledTargets = true diff --git a/gradle/elide.versions.toml b/gradle/elide.versions.toml index ffd3d01edb..4bc7ccb136 100644 --- a/gradle/elide.versions.toml +++ b/gradle/elide.versions.toml @@ -17,7 +17,7 @@ [versions] aedile = "1.3.1" -androidx-compose = "1.5.13-dev-k2.0.0-RC1-50f08dfa4b4" +androidx-compose = "1.6.11" arrow = "1.2.0" asciidata = "1.4.0" assertk = "0.28.1" @@ -30,7 +30,7 @@ bouncycastle = "1.78.1" brotli4j = "1.16.0" buf = "1.28.1" buildTimeTracker = "4.3.0" -buildconfig-plugin = "5.3.5" +buildconfig-plugin = "5.4.0" byteunits = "0.9.1" caffeine = "3.1.8" capnproto = "0.1.18-elide" @@ -92,7 +92,7 @@ hikari = "4.0.3" hoplite = "2.7.5" inquirer = "0.1.0" j4rs = "0.19.0" -jackson = "2.17.1" +jackson = "2.17.2" jacoco = "0.8.11" jakarta = "2.0.1" jakarta-annotation-api = "2.1.1" @@ -113,7 +113,7 @@ jmh-plugin = "0.7.2" jna = "5.15.0-SNAPSHOT" jprofiler = "14.0.1" json = "20240303" -jsoup = "1.17.2" +jsoup = "1.18.1" jsr310 = "2.9.8" junit-jupiter = "5.10.2" junixsocket = "2.8.3" @@ -126,16 +126,16 @@ kotest-plugin = "0.8.18" kotlin-compile-testing = "1.5.0" kotlin-dataframe = "0.11.0" kotlin-language = "2.0" -kotlin-sdk = "2.0.20-Beta1" +kotlin-sdk = "2.0.10-RC" kotlinpoet = "1.18.0" kotlinx-abiValidator = "0.14.0" -kotlinx-benchmark = "0.4.10" +kotlinx-benchmark = "0.4.11" kotlinx-browser = "0.1" -kotlinx-collections = "0.4-wasm1" +kotlinx-collections = "0.3.7" kotlinx-coroutines = "1.9.0-RC" kotlinx-datetime = "0.6.0" kotlinx-html = "0.11.0" -kotlinx-io = "0.4.0" +kotlinx-io = "0.5.0" kotlinx-knit = "0.5.0" kotlinx-metadata = "0.9.0" kotlinx-metadata-jvm = "0.9.0" @@ -177,7 +177,7 @@ kotlinx-wrappers-web = "1.0.0-pre.754" kotlinxWrappers = "pre.754" kover = "0.7.5" kover-plugin = "0.7.5" -ksp = "2.0.0-1.0.21" +ksp = "2.0.10-RC-1.0.23" ktlint = "1.1.1" ktoml = "0.5.1" larray = "0.2.1" @@ -243,7 +243,7 @@ openrewrite-bom = "2.10.0" openrewrite-lib = "8.1.13" openrewrite-plugin = "6.12.0" oshi = "6.6.1" -owasp = "10.0.1" +owasp = "10.0.2" parallelGzip = "1.0.5" picnic = "0.7.0" picocli = "4.7.6" @@ -281,7 +281,7 @@ swagger = "2.2.15" testLoggerPlugin = "4.0.0" testcontainers = "1.17.6" tink = "1.13.0" -truth = "1.4.3" +truth = "1.4.4" turbine = "1.1.0" versionCatalogUpdate = "0.8.4" versionCheck = "0.51.0" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 292e3456d9..a27c144174 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -9,6 +9,7 @@ + @@ -428,6 +429,12 @@ + + + + + + @@ -438,6 +445,16 @@ + + + + + + + + + + @@ -494,6 +511,12 @@ + + + + + + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3d4ba8a0da8d277868979cfbc8ad796..2c3521197d7c4586c843d1d3e9090525f1898cde 100644 GIT binary patch delta 8703 zcmYLtRag{&)-BQ@Dc#cDDP2Q%r*wBHJ*0FE-92)X$3_b$L+F2Fa28UVeg>}yRjC}^a^+(Cdu_FTlV;w_x7ig{yd(NYi_;SHXEq`|Qa`qPMf1B~v#%<*D zn+KWJfX#=$FMopqZ>Cv7|0WiA^M(L@tZ=_Hi z*{?)#Cn^{TIzYD|H>J3dyXQCNy8f@~OAUfR*Y@C6r=~KMZ{X}q`t@Er8NRiCUcR=?Y+RMv`o0i{krhWT6XgmUt!&X=e_Q2=u@F=PXKpr9-FL@0 zfKigQcGHyPn{3vStLFk=`h@+Lh1XBNC-_nwNU{ytxZF$o}oyVfHMj|ZHWmEmZeNIlO5eLco<=RI&3=fYK*=kmv*75aqE~&GtAp(VJ z`VN#&v2&}|)s~*yQ)-V2@RmCG8lz5Ysu&I_N*G5njY`<@HOc*Bj)ZwC%2|2O<%W;M z+T{{_bHLh~n(rM|8SpGi8Whep9(cURNRVfCBQQ2VG<6*L$CkvquqJ~9WZ~!<6-EZ&L(TN zpSEGXrDiZNz)`CzG>5&_bxzBlXBVs|RTTQi5GX6s5^)a3{6l)Wzpnc|Cc~(5mO)6; z6gVO2Zf)srRQ&BSeg0)P2en#<)X30qXB{sujc3Ppm4*)}zOa)@YZ<%1oV9K%+(VzJ zk(|p>q-$v>lImtsB)`Mm;Z0LaU;4T1BX!wbnu-PSlH1%`)jZZJ(uvbmM^is*r=Y{B zI?(l;2n)Nx!goxrWfUnZ?y5$=*mVU$Lpc_vS2UyW>tD%i&YYXvcr1v7hL2zWkHf42 z_8q$Gvl>%468i#uV`RoLgrO+R1>xP8I^7~&3(=c-Z-#I`VDnL`6stnsRlYL zJNiI`4J_0fppF<(Ot3o2w?UT*8QQrk1{#n;FW@4M7kR}oW-}k6KNQaGPTs=$5{Oz} zUj0qo@;PTg#5moUF`+?5qBZ)<%-$qw(Z?_amW*X}KW4j*FmblWo@SiU16V>;nm`Eg zE0MjvGKN_eA%R0X&RDT!hSVkLbF`BFf;{8Nym#1?#5Fb?bAHY(?me2tww}5K9AV9y+T7YaqaVx8n{d=K`dxS|=))*KJn(~8u@^J% zj;8EM+=Dq^`HL~VPag9poTmeP$E`npJFh^|=}Mxs2El)bOyoimzw8(RQle(f$n#*v zzzG@VOO(xXiG8d?gcsp-Trn-36}+S^w$U(IaP`-5*OrmjB%Ozzd;jfaeRHAzc_#?- z`0&PVZANQIcb1sS_JNA2TFyN$*yFSvmZbqrRhfME3(PJ62u%KDeJ$ZeLYuiQMC2Sc z35+Vxg^@gSR6flp>mS|$p&IS7#fL@n20YbNE9(fH;n%C{w?Y0=N5?3GnQLIJLu{lm zV6h@UDB+23dQoS>>)p`xYe^IvcXD*6nDsR;xo?1aNTCMdbZ{uyF^zMyloFDiS~P7W>WuaH2+`xp0`!d_@>Fn<2GMt z&UTBc5QlWv1)K5CoShN@|0y1M?_^8$Y*U(9VrroVq6NwAJe zxxiTWHnD#cN0kEds(wN8YGEjK&5%|1pjwMH*81r^aXR*$qf~WiD2%J^=PHDUl|=+f zkB=@_7{K$Fo0%-WmFN_pyXBxl^+lLG+m8Bk1OxtFU}$fQU8gTYCK2hOC0sVEPCb5S z4jI07>MWhA%cA{R2M7O_ltorFkJ-BbmPc`{g&Keq!IvDeg8s^PI3a^FcF z@gZ2SB8$BPfenkFc*x#6&Z;7A5#mOR5qtgE}hjZ)b!MkOQ zEqmM3s>cI_v>MzM<2>U*eHoC69t`W`^9QBU^F$ z;nU4%0$)$ILukM6$6U+Xts8FhOFb|>J-*fOLsqVfB=vC0v2U&q8kYy~x@xKXS*b6i zy=HxwsDz%)!*T5Bj3DY1r`#@Tc%LKv`?V|g6Qv~iAnrqS+48TfuhmM)V_$F8#CJ1j4;L}TBZM~PX!88IT+lSza{BY#ER3TpyMqi# z#{nTi!IsLYt9cH?*y^bxWw4djrd!#)YaG3|3>|^1mzTuXW6SV4+X8sA2dUWcjH)a3 z&rXUMHbOO?Vcdf3H<_T-=DB0M4wsB;EL3lx?|T(}@)`*C5m`H%le54I{bfg7GHqYB z9p+30u+QXMt4z&iG%LSOk1uw7KqC2}ogMEFzc{;5x`hU(rh0%SvFCBQe}M#RSWJv;`KM zf7D&z0a)3285{R$ZW%+I@JFa^oZN)vx77y_;@p0(-gz6HEE!w&b}>0b)mqz-(lfh4 zGt}~Hl@{P63b#dc`trFkguB}6Flu!S;w7lp_>yt|3U=c|@>N~mMK_t#LO{n;_wp%E zQUm=z6?JMkuQHJ!1JV$gq)q)zeBg)g7yCrP=3ZA|wt9%_l#yPjsS#C7qngav8etSX+s?JJ1eX-n-%WvP!IH1%o9j!QH zeP<8aW}@S2w|qQ`=YNC}+hN+lxv-Wh1lMh?Y;LbIHDZqVvW^r;^i1O<9e z%)ukq=r=Sd{AKp;kj?YUpRcCr*6)<@Mnp-cx{rPayiJ0!7Jng}27Xl93WgthgVEn2 zQlvj!%Q#V#j#gRWx7((Y>;cC;AVbPoX*mhbqK*QnDQQ?qH+Q*$u6_2QISr!Fn;B-F@!E+`S9?+Jr zt`)cc(ZJ$9q^rFohZJoRbP&X3)sw9CLh#-?;TD}!i>`a;FkY6(1N8U-T;F#dGE&VI zm<*Tn>EGW(TioP@hqBg zn6nEolK5(}I*c;XjG!hcI0R=WPzT)auX-g4Znr;P`GfMa*!!KLiiTqOE*STX4C(PD z&}1K|kY#>~>sx6I0;0mUn8)=lV?o#Bcn3tn|M*AQ$FscYD$0H(UKzC0R588Mi}sFl z@hG4h^*;_;PVW#KW=?>N)4?&PJF&EO(X?BKOT)OCi+Iw)B$^uE)H>KQZ54R8_2z2_ z%d-F7nY_WQiSB5vWd0+>^;G^j{1A%-B359C(Eji{4oLT9wJ~80H`6oKa&{G- z)2n-~d8S0PIkTW_*Cu~nwVlE&Zd{?7QbsGKmwETa=m*RG>g??WkZ|_WH7q@ zfaxzTsOY2B3!Fu;rBIJ~aW^yqn{V;~4LS$xA zGHP@f>X^FPnSOxEbrnEOd*W7{c(c`b;RlOEQ*x!*Ek<^p*C#8L=Ty^S&hg zaV)g8<@!3p6(@zW$n7O8H$Zej+%gf^)WYc$WT{zp<8hmn!PR&#MMOLm^hcL2;$o=Q zXJ=9_0vO)ZpNxPjYs$nukEGK2bbL%kc2|o|zxYMqK8F?$YtXk9Owx&^tf`VvCCgUz zLNmDWtociY`(}KqT~qnVUkflu#9iVqXw7Qi7}YT@{K2Uk(Wx7Q-L}u^h+M(81;I*J ze^vW&-D&=aOQq0lF5nLd)OxY&duq#IdK?-r7En0MnL~W51UXJQFVVTgSl#85=q$+| zHI%I(T3G8ci9Ubq4(snkbQ*L&ksLCnX_I(xa1`&(Bp)|fW$kFot17I)jyIi06dDTTiI%gNR z8i*FpB0y0 zjzWln{UG1qk!{DEE5?0R5jsNkJ(IbGMjgeeNL4I9;cP&>qm%q7cHT}@l0v;TrsuY0 zUg;Z53O-rR*W!{Q*Gp26h`zJ^p&FmF0!EEt@R3aT4YFR0&uI%ko6U0jzEYk_xScP@ zyk%nw`+Ic4)gm4xvCS$)y;^)B9^}O0wYFEPas)!=ijoBCbF0DbVMP z`QI7N8;88x{*g=51AfHx+*hoW3hK(?kr(xVtKE&F-%Tb}Iz1Z8FW>usLnoCwr$iWv ztOVMNMV27l*fFE29x}veeYCJ&TUVuxsd`hV-8*SxX@UD6au5NDhCQ4Qs{{CJQHE#4 z#bg6dIGO2oUZQVY0iL1(Q>%-5)<7rhnenUjOV53*9Qq?aU$exS6>;BJqz2|#{We_| zX;Nsg$KS<+`*5=WA?idE6G~kF9oQPSSAs#Mh-|)@kh#pPCgp&?&=H@Xfnz`5G2(95 z`Gx2RfBV~`&Eyq2S9m1}T~LI6q*#xC^o*EeZ#`}Uw)@RD>~<_Kvgt2?bRbO&H3&h- zjB&3bBuWs|YZSkmcZvX|GJ5u7#PAF$wj0ULv;~$7a?_R%e%ST{al;=nqj-<0pZiEgNznHM;TVjCy5E#4f?hudTr0W8)a6o;H; zhnh6iNyI^F-l_Jz$F`!KZFTG$yWdioL=AhImGr!$AJihd{j(YwqVmqxMKlqFj<_Hlj@~4nmrd~&6#f~9>r2_e-^nca(nucjf z;(VFfBrd0?k--U9L*iey5GTc|Msnn6prtF*!5AW3_BZ9KRO2(q7mmJZ5kz-yms`04e; z=uvr2o^{lVBnAkB_~7b7?1#rDUh4>LI$CH1&QdEFN4J%Bz6I$1lFZjDz?dGjmNYlD zDt}f;+xn-iHYk~V-7Fx!EkS``+w`-f&Ow>**}c5I*^1tpFdJk>vG23PKw}FrW4J#x zBm1zcp^){Bf}M|l+0UjvJXRjP3~!#`I%q*E=>?HLZ>AvB5$;cqwSf_*jzEmxxscH; zcl>V3s>*IpK`Kz1vP#APs#|tV9~#yMnCm&FOllccilcNmAwFdaaY7GKg&(AKG3KFj zk@%9hYvfMO;Vvo#%8&H_OO~XHlwKd()gD36!_;o z*7pl*o>x9fbe?jaGUO25ZZ@#qqn@|$B+q49TvTQnasc$oy`i~*o}Ka*>Wg4csQOZR z|Fs_6-04vj-Dl|B2y{&mf!JlPJBf3qG~lY=a*I7SBno8rLRdid7*Kl@sG|JLCt60# zqMJ^1u^Gsb&pBPXh8m1@4;)}mx}m%P6V8$1oK?|tAk5V6yyd@Ez}AlRPGcz_b!c;; z%(uLm1Cp=NT(4Hcbk;m`oSeW5&c^lybx8+nAn&fT(!HOi@^&l1lDci*?L#*J7-u}} z%`-*V&`F1;4fWsvcHOlZF#SD&j+I-P(Mu$L;|2IjK*aGG3QXmN$e}7IIRko8{`0h9 z7JC2vi2Nm>g`D;QeN@^AhC0hKnvL(>GUqs|X8UD1r3iUc+-R4$=!U!y+?p6rHD@TL zI!&;6+LK_E*REZ2V`IeFP;qyS*&-EOu)3%3Q2Hw19hpM$3>v!!YABs?mG44{L=@rjD%X-%$ajTW7%t_$7to%9d3 z8>lk z?_e}(m&>emlIx3%7{ER?KOVXi>MG_)cDK}v3skwd%Vqn0WaKa1;e=bK$~Jy}p#~`B zGk-XGN9v)YX)K2FM{HNY-{mloSX|a?> z8Om9viiwL|vbVF~j%~hr;|1wlC0`PUGXdK12w;5Wubw}miQZ)nUguh?7asm90n>q= z;+x?3haT5#62bg^_?VozZ-=|h2NbG%+-pJ?CY(wdMiJ6!0ma2x{R{!ys=%in;;5@v z{-rpytg){PNbCGP4Ig>=nJV#^ie|N68J4D;C<1=$6&boh&ol~#A?F-{9sBL*1rlZshXm~6EvG!X9S zD5O{ZC{EEpHvmD5K}ck+3$E~{xrrg*ITiA}@ZCoIm`%kVqaX$|#ddV$bxA{jux^uRHkH)o6#}fT6XE|2BzU zJiNOAqcxdcQdrD=U7OVqer@p>30l|ke$8h;Mny-+PP&OM&AN z9)!bENg5Mr2g+GDIMyzQpS1RHE6ow;O*ye;(Qqej%JC?!D`u;<;Y}1qi5cL&jm6d9 za{plRJ0i|4?Q%(t)l_6f8An9e2<)bL3eULUVdWanGSP9mm?PqFbyOeeSs9{qLEO-) zTeH*<$kRyrHPr*li6p+K!HUCf$OQIqwIw^R#mTN>@bm^E=H=Ger_E=ztfGV9xTgh=}Hep!i97A;IMEC9nb5DBA5J#a8H_Daq~ z6^lZ=VT)7=y}H3=gm5&j!Q79#e%J>w(L?xBcj_RNj44r*6^~nCZZYtCrLG#Njm$$E z7wP?E?@mdLN~xyWosgwkCot8bEY-rUJLDo7gukwm@;TjXeQ>fr(wKP%7LnH4Xsv?o zUh6ta5qPx8a5)WO4 zK37@GE@?tG{!2_CGeq}M8VW(gU6QXSfadNDhZEZ}W2dwm)>Y7V1G^IaRI9ugWCP#sw1tPtU|13R!nwd1;Zw8VMx4hUJECJkocrIMbJI zS9k2|`0$SD%;g_d0cmE7^MXP_;_6`APcj1yOy_NXU22taG9Z;C2=Z1|?|5c^E}dR& zRfK2Eo=Y=sHm@O1`62ciS1iKv9BX=_l7PO9VUkWS7xlqo<@OxlR*tn$_WbrR8F?ha zBQ4Y!is^AIsq-46^uh;=9B`gE#Sh+4m>o@RMZFHHi=qb7QcUrgTos$e z^4-0Z?q<7XfCP~d#*7?hwdj%LyPj2}bsdWL6HctL)@!tU$ftMmV=miEvZ2KCJXP%q zLMG&%rVu8HaaM-tn4abcSE$88EYmK|5%_29B*L9NyO|~j3m>YGXf6fQL$(7>Bm9o zjHfJ+lmYu_`+}xUa^&i81%9UGQ6t|LV45I)^+m@Lz@jEeF;?_*y>-JbK`=ZVsSEWZ z$p^SK_v(0d02AyIv$}*8m)9kjef1-%H*_daPdSXD6mpc>TW`R$h9On=Z9n>+f4swL zBz^(d9uaQ_J&hjDvEP{&6pNz-bg;A===!Ac%}bu^>0}E)wdH1nc}?W*q^J2SX_A*d zBLF@n+=flfH96zs@2RlOz&;vJPiG6In>$&{D+`DNgzPYVu8<(N&0yPt?G|>D6COM# zVd)6v$i-VtYfYi1h)pXvO}8KO#wuF=F^WJXPC+;hqpv>{Z+FZTP1w&KaPl?D)*A=( z8$S{Fh;Ww&GqSvia6|MvKJg-RpNL<6MXTl(>1}XFfziRvPaLDT1y_tjLYSGS$N;8| zZC*Hcp!~u?v~ty3&dBm`1A&kUe6@`q!#>P>ZZZgGRYhNIxFU6B>@f@YL%hOV0=9s# z?@0~aR1|d9LFoSI+li~@?g({Y0_{~~E_MycHTXz`EZmR2$J$3QVoA25j$9pe?Ub)d z`jbm8v&V0JVfY-^1mG=a`70a_tjafgi}z-8$smw7Mc`-!*6y{rB-xN1l`G3PLBGk~ z{o(KCV0HEfj*rMAiluQuIZ1tevmU@m{adQQr3xgS!e_WXw&eE?GjlS+tL0@x%Hm{1 zzUF^qF*2KAxY0$~pzVRpg9dA*)^ z7&wu-V$7+Jgb<5g;U1z*ymus?oZi7&gr!_3zEttV`=5VlLtf!e&~zv~PdspA0JCRz zZi|bO5d)>E;q)?}OADAhGgey#6(>+36XVThP%b#8%|a9B_H^)Nps1md_lVv5~OO@(*IJO@;eqE@@(y}KA- z`zj@%6q#>hIgm9}*-)n(^Xbdp8`>w~3JCC`(H{NUh8Umm{NUntE+eMg^WvSyL+ilV zff54-b59jg&r_*;*#P~ON#I=gAW99hTD;}nh_j;)B6*tMgP_gz4?=2EJZg$8IU;Ly<(TTC?^)& zj@%V!4?DU&tE=8)BX6f~x0K+w$%=M3;Fpq$VhETRlJ8LEEe;aUcG;nBe|2Gw>+h7CuJ-^gYFhQzDg(`e=!2f7t0AXrl zAx`RQ1u1+}?EkEWSb|jQN)~wOg#Ss&1oHoFBvg{Z|4#g$)mNzjKLq+8rLR(jC(QUC Ojj7^59?Sdh$^Qpp*~F>< delta 8662 zcmYM1RaBhK(uL9BL4pT&ch}$qcL*As0R|^HFD`?-26qkaNwC3nu;A|Q0Yd)oJ7=x) z_f6HatE;=#>YLq{FoYf$!na@pfNwSyI%>|UMk5`vO(z@Ao)eZR(~D#FF?U$)+q)1q z9OVG^Ib0v?R8wYfQ*1H;5Oyixqnyt6cXR#u=LM~V7_GUu}N(b}1+x^JUL#_8Xj zB*(FInWvSPGo;K=k3}p&4`*)~)p`nX#}W&EpfKCcOf^7t zPUS81ov(mXS;$9To6q84I!tlP&+Z?lkctuIZ(SHN#^=JGZe^hr^(3d*40pYsjikBWME6IFf!!+kC*TBc!T)^&aJ#z0#4?OCUbNoa}pwh=_SFfMf|x$`-5~ zP%%u%QdWp#zY6PZUR8Mz1n$f44EpTEvKLTL;yiZrPCV=XEL09@qmQV#*Uu*$#-WMN zZ?rc(7}93z4iC~XHcatJev=ey*hnEzajfb|22BpwJ4jDi;m>Av|B?TqzdRm-YT(EV zCgl${%#nvi?ayAFYV7D_s#07}v&FI43BZz@`dRogK!k7Y!y6r=fvm~=F9QP{QTj>x z#Y)*j%`OZ~;rqP0L5@qYhR`qzh^)4JtE;*faTsB;dNHyGMT+fpyz~LDaMOO?c|6FD z{DYA+kzI4`aD;Ms|~h49UAvOfhMEFip&@&Tz>3O+MpC0s>`fl!T(;ZP*;Ux zr<2S-wo(Kq&wfD_Xn7XXQJ0E4u7GcC6pqe`3$fYZ5Eq4`H67T6lex_QP>Ca##n2zx z!tc=_Ukzf{p1%zUUkEO(0r~B=o5IoP1@#0A=uP{g6WnPnX&!1Z$UWjkc^~o^y^Kkn z%zCrr^*BPjcTA58ZR}?%q7A_<=d&<*mXpFSQU%eiOR`=78@}+8*X##KFb)r^zyfOTxvA@cbo65VbwoK0lAj3x8X)U5*w3(}5 z(Qfv5jl{^hk~j-n&J;kaK;fNhy9ZBYxrKQNCY4oevotO-|7X}r{fvYN+{sCFn2(40 zvCF7f_OdX*L`GrSf0U$C+I@>%+|wQv*}n2yT&ky;-`(%#^vF79p1 z>y`59E$f7!vGT}d)g)n}%T#-Wfm-DlGU6CX`>!y8#tm-Nc}uH50tG)dab*IVrt-TTEM8!)gIILu*PG_-fbnFjRA+LLd|_U3yas12Lro%>NEeG%IwN z{FWomsT{DqMjq{7l6ZECb1Hm@GQ`h=dcyApkoJ6CpK3n83o-YJnXxT9b2%TmBfKZ* zi~%`pvZ*;(I%lJEt9Bphs+j#)ws}IaxQYV6 zWBgVu#Kna>sJe;dBQ1?AO#AHecU~3cMCVD&G})JMkbkF80a?(~1HF_wv6X!p z6uXt_8u)`+*%^c@#)K27b&Aa%m>rXOcGQg8o^OB4t0}@-WWy38&)3vXd_4_t%F1|( z{z(S)>S!9eUCFA$fQ^127DonBeq@5FF|IR7(tZ?Nrx0(^{w#a$-(fbjhN$$(fQA(~|$wMG4 z?UjfpyON`6n#lVwcKQ+#CuAQm^nmQ!sSk>=Mdxk9e@SgE(L2&v`gCXv&8ezHHn*@% zi6qeD|I%Q@gb(?CYus&VD3EE#xfELUvni89Opq-6fQmY-9Di3jxF?i#O)R4t66ekw z)OW*IN7#{_qhrb?qlVwmM@)50jEGbjTiDB;nX{}%IC~pw{ev#!1`i6@xr$mgXX>j} zqgxKRY$fi?B7|GHArqvLWu;`?pvPr!m&N=F1<@i-kzAmZ69Sqp;$)kKg7`76GVBo{ zk+r?sgl{1)i6Hg2Hj!ehsDF3tp(@n2+l%ihOc7D~`vzgx=iVU0{tQ&qaV#PgmalfG zPj_JimuEvo^1X)dGYNrTHBXwTe@2XH-bcnfpDh$i?Il9r%l$Ob2!dqEL-To>;3O>` z@8%M*(1#g3_ITfp`z4~Z7G7ZG>~F0W^byMvwzfEf*59oM*g1H)8@2zL&da+$ms$Dp zrPZ&Uq?X)yKm7{YA;mX|rMEK@;W zA-SADGLvgp+)f01=S-d$Z8XfvEZk$amHe}B(gQX-g>(Y?IA6YJfZM(lWrf);5L zEjq1_5qO6U7oPSb>3|&z>OZ13;mVT zWCZ=CeIEK~6PUv_wqjl)pXMy3_46hB?AtR7_74~bUS=I}2O2CjdFDA*{749vOj2hJ z{kYM4fd`;NHTYQ_1Rk2dc;J&F2ex^}^%0kleFbM!yhwO|J^~w*CygBbkvHnzz@a~D z|60RVTr$AEa-5Z->qEMEfau=__2RanCTKQ{XzbhD{c!e5hz&$ZvhBX0(l84W%eW17 zQ!H)JKxP$wTOyq83^qmx1Qs;VuWuxclIp!BegkNYiwyMVBay@XWlTpPCzNn>&4)f* zm&*aS?T?;6?2>T~+!=Gq4fjP1Z!)+S<xiG>XqzY@WKKMzx?0|GTS4{ z+z&e0Uysciw#Hg%)mQ3C#WQkMcm{1yt(*)y|yao2R_FRX$WPvg-*NPoj%(k*{BA8Xx&0HEqT zI0Swyc#QyEeUc)0CC}x{p+J{WN>Z|+VZWDpzW`bZ2d7^Yc4ev~9u-K&nR zl#B0^5%-V4c~)1_xrH=dGbbYf*7)D&yy-}^V|Np|>V@#GOm($1=El5zV?Z`Z__tD5 zcLUi?-0^jKbZrbEny&VD!zA0Nk3L|~Kt4z;B43v@k~ zFwNisc~D*ZROFH;!f{&~&Pof-x8VG8{gSm9-Yg$G(Q@O5!A!{iQH0j z80Rs>Ket|`cbw>z$P@Gfxp#wwu;I6vi5~7GqtE4t7$Hz zPD=W|mg%;0+r~6)dC>MJ&!T$Dxq3 zU@UK_HHc`_nI5;jh!vi9NPx*#{~{$5Azx`_VtJGT49vB_=WN`*i#{^X`xu$9P@m>Z zL|oZ5CT=Zk?SMj{^NA5E)FqA9q88h{@E96;&tVv^+;R$K`kbB_ zZneKrSN+IeIrMq;4EcH>sT2~3B zrZf-vSJfekcY4A%e2nVzK8C5~rAaP%dV2Hwl~?W87Hdo<*EnDcbZqVUb#8lz$HE@y z2DN2AQh%OcqiuWRzRE>cKd)24PCc)#@o&VCo!Rcs;5u9prhK}!->CC)H1Sn-3C7m9 zyUeD#Udh1t_OYkIMAUrGU>ccTJS0tV9tW;^-6h$HtTbon@GL1&OukJvgz>OdY)x4D zg1m6Y@-|p;nB;bZ_O>_j&{BmuW9km4a728vJV5R0nO7wt*h6sy7QOT0ny-~cWTCZ3 z9EYG^5RaAbLwJ&~d(^PAiicJJs&ECAr&C6jQcy#L{JCK&anL)GVLK?L3a zYnsS$+P>UB?(QU7EI^%#9C;R-jqb;XWX2Bx5C;Uu#n9WGE<5U=zhekru(St>|FH2$ zOG*+Tky6R9l-yVPJk7giGulOO$gS_c!DyCog5PT`Sl@P!pHarmf7Y0HRyg$X@fB7F zaQy&vnM1KZe}sHuLY5u7?_;q!>mza}J?&eLLpx2o4q8$qY+G2&Xz6P8*fnLU+g&i2}$F%6R_Vd;k)U{HBg{+uuKUAo^*FRg!#z}BajS)OnqwXd!{u>Y&aH?)z%bwu_NB9zNw+~661!> zD3%1qX2{743H1G8d~`V=W`w7xk?bWgut-gyAl*6{dW=g_lU*m?fJ>h2#0_+J3EMz_ zR9r+0j4V*k>HU`BJaGd~@*G|3Yp?~Ljpth@!_T_?{an>URYtict~N+wb}%n)^GE8eM(=NqLnn*KJnE*v(7Oo)NmKB*qk;0&FbO zkrIQs&-)ln0-j~MIt__0pLdrcBH{C(62`3GvGjR?`dtTdX#tf-2qkGbeV;Ud6Dp0& z|A6-DPgg=v*%2`L4M&p|&*;;I`=Tn1M^&oER=Gp&KHBRxu_OuFGgX;-U8F?*2>PXjb!wwMMh_*N8$?L4(RdvV#O5cUu0F|_zQ#w1zMA4* zJeRk}$V4?zPVMB=^}N7x?(P7!x6BfI%*)yaUoZS0)|$bw07XN{NygpgroPW>?VcO} z@er3&#@R2pLVwkpg$X8HJM@>FT{4^Wi&6fr#DI$5{ERpM@|+60{o2_*a7k__tIvGJ9D|NPoX@$4?i_dQPFkx0^f$=#_)-hphQ93a0|`uaufR!Nlc^AP+hFWe~(j_DCZmv;7CJ4L7tWk{b;IFDvT zchD1qB=cE)Mywg5Nw>`-k#NQhT`_X^c`s$ODVZZ-)T}vgYM3*syn41}I*rz?)`Q<* zs-^C3!9AsV-nX^0wH;GT)Y$yQC*0x3o!Bl<%>h-o$6UEG?{g1ip>njUYQ}DeIw0@qnqJyo0do(`OyE4kqE2stOFNos%!diRfe=M zeU@=V=3$1dGv5ZbX!llJ!TnRQQe6?t5o|Y&qReNOxhkEa{CE6d^UtmF@OXk<_qkc0 zc+ckH8Knc!FTjk&5FEQ}$sxj!(a4223cII&iai-nY~2`|K89YKcrYFAMo^oIh@W^; zsb{KOy?dv_D5%}zPk_7^I!C2YsrfyNBUw_ude7XDc0-+LjC0!X_moHU3wmveS@GRu zX>)G}L_j1I-_5B|b&|{ExH~;Nm!xytCyc}Ed!&Hqg;=qTK7C93f>!m3n!S5Z!m`N} zjIcDWm8ES~V2^dKuv>8@Eu)Zi{A4;qHvTW7hB6B38h%$K76BYwC3DIQ0a;2fSQvo$ z`Q?BEYF1`@I-Nr6z{@>`ty~mFC|XR`HSg(HN>&-#&eoDw-Q1g;x@Bc$@sW{Q5H&R_ z5Aici44Jq-tbGnDsu0WVM(RZ=s;CIcIq?73**v!Y^jvz7ckw*=?0=B!{I?f{68@V( z4dIgOUYbLOiQccu$X4P87wZC^IbGnB5lLfFkBzLC3hRD?q4_^%@O5G*WbD?Wug6{<|N#Fv_Zf3ST>+v_!q5!fSy#{_XVq$;k*?Ar^R&FuFM7 zKYiLaSe>Cw@`=IUMZ*U#v>o5!iZ7S|rUy2(yG+AGnauj{;z=s8KQ(CdwZ>&?Z^&Bt z+74(G;BD!N^Ke>(-wwZN5~K%P#L)59`a;zSnRa>2dCzMEz`?VaHaTC>?&o|(d6e*Z zbD!=Ua-u6T6O!gQnncZ&699BJyAg9mKXd_WO8O`N@}bx%BSq)|jgrySfnFvzOj!44 z9ci@}2V3!ag8@ZbJO;;Q5ivdTWx+TGR`?75Jcje}*ufx@%5MFUsfsi%FoEx)&uzkN zgaGFOV!s@Hw3M%pq5`)M4Nz$)~Sr9$V2rkP?B7kvI7VAcnp6iZl zOd!(TNw+UH49iHWC4!W&9;ZuB+&*@Z$}>0fx8~6J@d)fR)WG1UndfdVEeKW=HAur| z15zG-6mf`wyn&x@&?@g1ibkIMob_`x7nh7yu9M>@x~pln>!_kzsLAY#2ng0QEcj)qKGj8PdWEuYKdM!jd{ zHP6j^`1g}5=C%)LX&^kpe=)X+KR4VRNli?R2KgYlwKCN9lcw8GpWMV+1Ku)~W^jV2 zyiTv-b*?$AhvU7j9~S5+u`Ysw9&5oo0Djp8e(j25Etbx42Qa=4T~}q+PG&XdkWDNF z7bqo#7KW&%dh~ST6hbu8S=0V`{X&`kAy@8jZWZJuYE}_#b4<-^4dNUc-+%6g($yN% z5ny^;ogGh}H5+Gq3jR21rQgy@5#TCgX+(28NZ4w}dzfx-LP%uYk9LPTKABaQh1ah) z@Y(g!cLd!Mcz+e|XI@@IH9z*2=zxJ0uaJ+S(iIsk7=d>A#L<}={n`~O?UTGX{8Pda z_KhI*4jI?b{A!?~-M$xk)w0QBJb7I=EGy&o3AEB_RloU;v~F8ubD@9BbxV1c36CsTX+wzAZlvUm*;Re06D+Bq~LYg-qF4L z5kZZ80PB&4U?|hL9nIZm%jVj0;P_lXar)NSt3u8xx!K6Y0bclZ%<9fwjZ&!^;!>ug zQ}M`>k@S{BR20cyVXtKK%Qa^7?e<%VSAPGmVtGo6zc6BkO5vW5)m8_k{xT3;ocdpH zudHGT06XU@y6U!&kP8i6ubMQl>cm7=(W6P7^24Uzu4Xpwc->ib?RSHL*?!d{c-aE# zp?TrFr{4iDL3dpljl#HHbEn{~eW2Nqfksa(r-}n)lJLI%e#Bu|+1% zN&!n(nv(3^jGx?onfDcyeCC*p6)DuFn_<*62b92Pn$LH(INE{z^8y?mEvvO zZ~2I;A2qXvuj>1kk@WsECq1WbsSC!0m8n=S^t3kxAx~of0vpv{EqmAmDJ3(o;-cvf zu$33Z)C0)Y4(iBhh@)lsS|a%{;*W(@DbID^$ z|FzcJB-RFzpkBLaFLQ;EWMAW#@K(D#oYoOmcctdTV?fzM2@6U&S#+S$&zA4t<^-!V z+&#*xa)cLnfMTVE&I}o#4kxP~JT3-A)L_5O!yA2ebq?zvb0WO1D6$r9p?!L0#)Fc> z+I&?aog~FPBH}BpWfW^pyc{2i8#Io6e)^6wv}MZn&`01oq@$M@5eJ6J^IrXLI) z4C!#kh)89u5*Q@W5(rYDqBKO6&G*kPGFZfu@J}ug^7!sC(Wcv3Fbe{$Sy|{-VXTct znsP+0v}kduRs=S=x0MA$*(7xZPE-%aIt^^JG9s}8$43E~^t4=MxmMts;q2$^sj=k( z#^suR{0Wl3#9KAI<=SC6hifXuA{o02vdyq>iw%(#tv+@ov{QZBI^*^1K?Q_QQqA5n9YLRwO3a7JR+1x3#d3lZL;R1@8Z!2hnWj^_5 z^M{3wg%f15Db5Pd>tS!6Hj~n^l478ljxe@>!C;L$%rKfm#RBw^_K&i~ZyY_$BC%-L z^NdD{thVHFlnwfy(a?{%!m;U_9ic*!OPxf&5$muWz7&4VbW{PP)oE5u$uXUZU>+8R zCsZ~_*HLVnBm*^{seTAV=iN)mB0{<}C!EgE$_1RMj1kGUU?cjSWu*|zFA(ZrNE(CkY7>Mv1C)E1WjsBKAE%w}{~apwNj z0h`k)C1$TwZ<3de9+>;v6A0eZ@xHm#^7|z9`gQ3<`+lpz(1(RsgHAM@Ja+)c?;#j- zC=&5FD)m@9AX}0g9XQ_Yt4YB}aT`XxM-t>7v@BV}2^0gu0zRH%S9}!P(MBAFGyJ8F zEMdB&{eGOd$RqV77Lx>8pX^<@TdL{6^K7p$0uMTLC^n)g*yXRXMy`tqjYIZ|3b#Iv z4<)jtQU5`b{A;r2QCqIy>@!uuj^TBed3OuO1>My{GQe<^9|$4NOHTKFp{GpdFY-kC zi?uHq>lF$}<(JbQatP0*>$Aw_lygfmUyojkE=PnV)zc)7%^5BxpjkU+>ol2}WpB2hlDP(hVA;uLdu`=M_A!%RaRTd6>Mi_ozLYOEh!dfT_h0dSsnQm1bk)%K45)xLw zql&fx?ZOMBLXtUd$PRlqpo2CxNQTBb=!T|_>p&k1F})Hq&xksq>o#4b+KSs2KyxPQ z#{(qj@)9r6u2O~IqHG76@Fb~BZ4Wz_J$p_NU9-b3V$$kzjN24*sdw5spXetOuU1SR z{v}b92c>^PmvPs>BK2Ylp6&1>tnPsBA0jg0RQ{({-?^SBBm>=W>tS?_h^6%Scc)8L zgsKjSU@@6kSFX%_3%Qe{i7Z9Wg7~fM_)v?ExpM@htI{G6Db5ak(B4~4kRghRp_7zr z#Pco0_(bD$IS6l2j>%Iv^Hc)M`n-vIu;-2T+6nhW0JZxZ|NfDEh;ZnAe d|9e8rKfIInFTYPwOD9TMuEcqhmizAn{|ERF)u#Xe diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f7fb1ff3f9..f01345ff52 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase = GRADLE_USER_HOME distributionPath = wrapper/dists -distributionUrl = https://dl.less.build/toolchains/gradle/gradle-8.9-rc-2-bin.zip +distributionUrl = https://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout = 10000 validateDistributionUrl = true zipStoreBase = GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1339..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e467..9b42019c79 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/package.json b/package.json index adb3adf9ee..1f4190b845 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,7 @@ "last 3 safari versions" ], "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] + "extends": ["@commitlint/config-conventional"] }, "workspaces": [ "packages/base", diff --git a/packages/base/build.gradle.kts b/packages/base/build.gradle.kts index 436ff94064..35401f776e 100644 --- a/packages/base/build.gradle.kts +++ b/packages/base/build.gradle.kts @@ -14,10 +14,11 @@ import elide.internal.conventions.kotlin.* plugins { - alias(libs.plugins.elide.conventions) kotlin("multiplatform") kotlin("plugin.atomicfu") kotlin("plugin.serialization") + alias(libs.plugins.kotlinx.plugin.benchmark) + alias(libs.plugins.elide.conventions) } elide { diff --git a/packages/cli-bridge/api/cli-bridge.api b/packages/cli-bridge/api/cli-bridge.api deleted file mode 100644 index ff4966ea2c..0000000000 --- a/packages/cli-bridge/api/cli-bridge.api +++ /dev/null @@ -1,5 +0,0 @@ -public class dev/elide/cli/bridge/CliNativeBridge { - public fun ()V - public static fun hello ()V -} - diff --git a/packages/cli-bridge/build.gradle.kts b/packages/cli-bridge/build.gradle.kts deleted file mode 100644 index 641eed2dd2..0000000000 --- a/packages/cli-bridge/build.gradle.kts +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2024 Elide Technologies, Inc. - * - * Licensed under the MIT license (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://opensource.org/license/mit/ - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under the License. - */ - -@file:Suppress( - "DSL_SCOPE_VIOLATION", - "UnstableApiUsage", -) - -import elide.internal.conventions.kotlin.KotlinTarget - -plugins { - java - `java-library` - distribution - publishing - jacoco - `jvm-test-suite` - `maven-publish` - - kotlin("jvm") - kotlin("kapt") - kotlin("plugin.serialization") - alias(libs.plugins.buildConfig) - alias(libs.plugins.gradle.checksum) - id(libs.plugins.shadow.get().pluginId) - id(libs.plugins.kover.get().pluginId) - alias(libs.plugins.elide.conventions) -} - -elide { - kotlin { - target = KotlinTarget.JVM - kotlinVersionOverride = "2.0" - explicitApi = true - } - - docs { - enabled = false - } -} - -dependencies { - api(libs.kotlinx.serialization.core) - implementation(libs.kotlinx.serialization.json) -} - -val isRelease = properties["elide.buildMode"] == "release" -val nativeTargets = rootProject.layout.projectDirectory.dir("targets") -val nativeDebugTargets = rootProject.layout.projectDirectory.dir("targets/debug") -val nativeReleaseTargets = rootProject.layout.projectDirectory.dir("targets/release") - -private fun Exec.configureCargo(vararg extraArgs: String) { - standardOutput = System.out - executable = "cargo" - environment("FORCE_COLOR" to "true") - args("build", "--color=always", *extraArgs) -} - -val buildNativeDebug by tasks.registering(Exec::class) { - group = "build" - description = "Build native Rust code via Cargo (debug)" - configureCargo() -} - -val buildNativeRelease by tasks.registering(Exec::class) { - group = "build" - description = "Build native Rust code via Cargo (release)" - executable = "cargo" - configureCargo("--release") -} - -val releaseNatives by tasks.registering { - outputs.dir(nativeReleaseTargets) - outputs.upToDateWhen { - nativeReleaseTargets.asFile.exists() - } -} - -val debugNatives by tasks.registering { - outputs.dir(nativeDebugTargets) - outputs.upToDateWhen { - nativeDebugTargets.asFile.exists() - } -} - -val nativeDeps = if (isRelease) releaseNatives else debugNatives - -tasks.jar { - dependsOn(nativeDeps) -} - -tasks.build { - dependsOn(nativeDeps, tasks.jar) -} diff --git a/packages/cli-bridge/gradle.lockfile b/packages/cli-bridge/gradle.lockfile deleted file mode 100644 index 83fa4bf21c..0000000000 --- a/packages/cli-bridge/gradle.lockfile +++ /dev/null @@ -1,12 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains:annotations:13.0=compileClasspath,runtimeClasspath -empty= diff --git a/packages/cli-bridge/src/main/java/dev/elide/cli/bridge/CliNativeBridge.java b/packages/cli-bridge/src/main/java/dev/elide/cli/bridge/CliNativeBridge.java deleted file mode 100644 index 9b10a1a157..0000000000 --- a/packages/cli-bridge/src/main/java/dev/elide/cli/bridge/CliNativeBridge.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2024 Elide Technologies, Inc. - * - * Licensed under the MIT license (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://opensource.org/license/mit/ - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under the License. - */ -package dev.elide.cli.bridge; - -/** Bridge to native code from the "umbrella" library. */ -public class CliNativeBridge { - /** Token expected for the tooling API at version 1. */ - public static final String VERSION_V1 = "v1"; - - /** Return the tooling protocol version. */ - public static native String apiVersion(); - - /** Return the library version. */ - public static native String libVersion(); - - /** Return the suite of reported tool names. */ - public static native String[] supportedTools(); - - /** Return the languages which relate to a given tool. */ - public static native String[] relatesTo(String toolName); - - /** Return the version string for a tool. */ - public static native String toolVersion(String toolName); - - /** Run the Ruff entrypoint. */ - public static native int runRuff(String[] args); - - /** Run the Orogene entrypoint. */ - public static native int runOrogene(String[] args); - - /** Run the Uv entrypoint. */ - public static native int runUv(String[] args); - - static { - System.loadLibrary("umbrella"); - } -} diff --git a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/bridge/NativeSubstrate.kt b/packages/cli-bridge/src/main/kotlin/dev/elide/cli/bridge/NativeSubstrate.kt deleted file mode 100644 index 2f6ea0cb29..0000000000 --- a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/bridge/NativeSubstrate.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.elide.cli.bridge - -public object NativeSubstrate { - /** - * - */ - public external fun enabledLibraries(): Array - - /** - * - */ - public external fun embeddedLibraryVersion(lib: String): String -} - -// dev.elide.cli.bridge.NativeSubstrate.enabledLibraries diff --git a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/model.kt b/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/model.kt deleted file mode 100644 index 86cdd3792d..0000000000 --- a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/model.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2024 Elide Technologies, Inc. - * - * Licensed under the MIT license (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://opensource.org/license/mit/ - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under the License. - */ - -package dev.elide.cli.tooling.api - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable @JvmRecord public data class CodeLocation( - public val file: String, - public val line: UInt, - public val column: UInt -) - -@Serializable public enum class Severity(public val string: String) { - @SerialName("Error") - ERROR("Error"), - - @SerialName("Info") - INFO("Info"), - - @SerialName("Warning") - WARNING("Warning"), -; -} - -@Serializable @JvmRecord public data class DiagnosticNote( - public val id: String, - public val tool: String, - public val code: String, - public val message: String, - public val location: CodeLocation, - public val severity: Severity -) - -@Serializable public enum class ToolType(public val string: String) { - @SerialName("Compiler") - COMPILER("Compiler"), - - @SerialName("Linter") - LINTER("Linter"), -; -} - -@Serializable @JvmRecord public data class ToolInfo( - public val name: String, - public val version: String, - public val language: String, - public val experimental: Boolean, - public val kind: ToolType -) diff --git a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/suite.kt b/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/suite.kt deleted file mode 100644 index 8148299252..0000000000 --- a/packages/cli-bridge/src/main/kotlin/dev/elide/cli/tooling/api/suite.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2024 Elide Technologies, Inc. - * - * Licensed under the MIT license (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * https://opensource.org/license/mit/ - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under the License. - */ - -package dev.elide.cli.tooling.api - -import kotlinx.serialization.ExperimentalSerializationApi -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json - -@Serializable @JvmRecord public data class DiagnosticTimings( - public val start: Long = 0, - public val end: Long = 0, -) - -@Serializable @JvmRecord public data class DiagnosticSuite( - public val maxSeverity: Severity, - public val notes: List, - public val timings: DiagnosticTimings? = null, -) - -public object Diagnostics { - @OptIn(ExperimentalSerializationApi::class) - private val diagnosticJson: Json by lazy { - Json { - isLenient = true - allowComments = true - allowTrailingComma = true - ignoreUnknownKeys = true - } - } - - @JvmStatic public fun empty(): DiagnosticSuite = DiagnosticSuite(Severity.INFO, emptyList()) - - @JvmStatic public fun fromJson(json: String): DiagnosticSuite = diagnosticJson.decodeFromString( - DiagnosticSuite.serializer(), - json, - ) -} diff --git a/packages/cli-bridge/src/main/public/dev_elide_cli_bridge_CliNativeBridge.h b/packages/cli-bridge/src/main/public/dev_elide_cli_bridge_CliNativeBridge.h deleted file mode 100644 index b06f1f198d..0000000000 --- a/packages/cli-bridge/src/main/public/dev_elide_cli_bridge_CliNativeBridge.h +++ /dev/null @@ -1,53 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class dev_elide_cli_bridge_CliNativeBridge */ - -#ifndef _Included_dev_elide_cli_bridge_CliNativeBridge -#define _Included_dev_elide_cli_bridge_CliNativeBridge -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: dev_elide_cli_bridge_CliNativeBridge - * Method: apiVersion - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_dev_elide_cli_bridge_CliNativeBridge_apiVersion - (JNIEnv *, jclass); - -/* - * Class: dev_elide_cli_bridge_CliNativeBridge - * Method: libVersion - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_dev_elide_cli_bridge_CliNativeBridge_libVersion - (JNIEnv *, jclass); - -/* - * Class: dev_elide_cli_bridge_CliNativeBridge - * Method: supportedTools - * Signature: ()[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_dev_elide_cli_bridge_CliNativeBridge_supportedTools - (JNIEnv *, jclass); - -/* - * Class: dev_elide_cli_bridge_CliNativeBridge - * Method: relatesTo - * Signature: (Ljava/lang/String;)[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_dev_elide_cli_bridge_CliNativeBridge_relatesTo - (JNIEnv *, jclass, jstring); - -/* - * Class: dev_elide_cli_bridge_CliNativeBridge - * Method: toolVersion - * Signature: (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_dev_elide_cli_bridge_CliNativeBridge_toolVersion - (JNIEnv *, jclass, jstring); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/packages/cli-bridge/src/main/public/umbrella.h b/packages/cli-bridge/src/main/public/umbrella.h deleted file mode 100644 index 5a8d21f4d6..0000000000 --- a/packages/cli-bridge/src/main/public/umbrella.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Generate this file with: -cbindgen --config ./tools/umbrella/cbindgen.toml --crate umbrella --output packages/cli-bridge/src/main/public/umbrella.h --cpp-compat tools/umbrella */ -#include -#include -#include -#include -#include "jni.h" -#include "jni_md.h" - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -jstring Java_dev_elide_cli_bridge_CliNativeBridge_libVersion(JNIEnv env, JClass _class); - -jstring Java_dev_elide_cli_bridge_CliNativeBridge_apiVersion(JNIEnv env, JClass _class); - -jobjectArray Java_dev_elide_cli_bridge_CliNativeBridge_supportedTools(JNIEnv env, JClass _class); - -jobjectArray Java_dev_elide_cli_bridge_CliNativeBridge_relatesTo(JNIEnv env, - JClass _class, - JString tool); - -jstring Java_dev_elide_cli_bridge_CliNativeBridge_toolVersion(JNIEnv env, - JClass _class, - JString tool); - -jint Java_dev_elide_cli_bridge_CliNativeBridge_runToolOnFile(JNIEnv env, - JClass _class, - JString tool, - JString file); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus diff --git a/packages/cli/build.gradle.kts b/packages/cli/build.gradle.kts index 8e8e29efec..d9ac8ce2b1 100644 --- a/packages/cli/build.gradle.kts +++ b/packages/cli/build.gradle.kts @@ -182,6 +182,10 @@ private fun platformConfig(type: String = "resource"): String { } } +val rootPath: String = rootProject.layout.projectDirectory.asFile.path +val thirdPartyPath: String = rootProject.layout.projectDirectory.dir("third_party").asFile.path +val sqliteLibPath: String = rootProject.layout.projectDirectory.dir("third_party/sqlite/install/lib").asFile.path + val nativesRootTemplate: (String) -> String = { version -> "/tmp/elide-runtime/v$version/native" } @@ -311,8 +315,6 @@ val languagePluginPaths = if (!enableDynamicPlugins) emptyList() else listOf( } val targetPath = rootProject.layout.projectDirectory.dir("target/${if (isRelease) "release" else "debug"}") -val targetLibs = rootProject.layout.projectDirectory.dir("target/${if (isRelease) "release" else "debug"}/lib") -val targetHeaders = rootProject.layout.projectDirectory.dir("target/${if (isRelease) "release" else "debug"}/include") val nativesPath = nativesRootTemplate(cliVersion) val umbrellaNativesPath: String = rootProject.layout.projectDirectory.dir("target/$nativesType").asFile.path val gvmResourcesPath: String = layout.buildDirectory.dir("native/nativeCompile/resources") @@ -367,7 +369,6 @@ dependencies { } implementation(mn.micronaut.picocli) - implementation(projects.packages.cliBridge) implementation(kotlin("stdlib-jdk8")) implementation(libs.logback) implementation(libs.bouncycastle) @@ -718,7 +719,6 @@ val commonNativeArgs = listOfNotNull( "-H:+AddAllCharsets", "-H:MaxRuntimeCompileMethods=20000", "-H:AdditionalSecurityProviders=${enabledSecurityProviders.joinToString(",")}", - "-H:NativeLinkerOption=-L$targetLibs", "-Delide.strict=true", "-J-Delide.strict=true", "-Delide.js.vm.enableStreams=true", @@ -727,6 +727,8 @@ val commonNativeArgs = listOfNotNull( "-J-Delide.mosaic=$enableMosaic", "-Delide.staticJni=$enableStaticJni", "-J-Delide.staticJni=$enableStaticJni", + "-Delide.root=$rootPath", + "-J-Delide.root=$rootPath", "-Delide.target=$targetPath", "-J-Delide.target=$targetPath", "-Delide.natives=$nativesPath", @@ -828,14 +830,14 @@ val experimentalFlags = listOf( // C compiler flags which are always included. val commonCFlags: List = listOf( "-DELIDE", - "-I$targetHeaders", ).plus( System.getenv("CFLAGS")?.ifEmpty { null }?.split(" ") ?: emptyList() ) // Linker flags which are always included. val commonLinkerOptions: List = listOf( - "-L$targetLibs", + "-L$sqliteLibPath", + "-lsqlite3", ) // CFlags for release mode. @@ -885,6 +887,7 @@ val jvmDefs = mapOf( "elide.strict" to "true", "elide.natives" to nativesPath, "elide.target" to targetPath.asFile.path, + "elide.root" to rootPath, "elide.graalvm.ee" to oracleGvm.toString(), "elide.mosaic" to enableMosaic.toString(), "elide.staticJni" to "true", @@ -927,6 +930,9 @@ val initializeAtRuntime: List = listOfNotNull( onlyIf(enableNativeTransportV2, "io.netty.channel.kqueue.Native"), onlyIf(enableNativeTransportV2, "io.netty.channel.kqueue.KQueueEventLoop"), + "dev.elide.cli.bridge.CliNativeBridge", + onlyIf(HostManager.hostIsLinux, "elide.runtime.gvm.internals.sqlite.SqliteModule"), + "java.awt.Desktop", "java.awt.Toolkit", "sun.awt.X11.MotifDnDConstants", @@ -972,6 +978,10 @@ val initializeAtRuntime: List = listOfNotNull( // --- Jansi/JLine ----- + "org.jline.nativ.JLineLibrary", + "org.jline.nativ.CLibrary", + "org.jline.nativ.CLibrary${'$'}WinSize", + "org.jline.nativ.CLibrary${'$'}Termios", "org.jline.terminal.impl.jna.osx.OsXNativePty", "org.jline.terminal.impl.jna.linux.LinuxNativePty", "org.jline.terminal.impl.jna.linux.LinuxNativePty${'$'}UtilLibrary", @@ -1171,7 +1181,11 @@ val darwinReleaseArgs = darwinOnlyArgs.toList() val linuxOnlyArgs = defaultPlatformArgs.plus( listOf( "-H:NativeLinkerOption=-lm", + "-H:NativeLinkerOption=-lssl", + "-H:NativeLinkerOption=-lcrypto", + "-H:NativeLinkerOption=-lsqlite3", "-H:NativeLinkerOption=-lstdc++", + "-H:NativeLinkerOption=-L$sqliteLibPath", "-H:+StaticExecutableWithDynamicLibC", "--initialize-at-run-time=io.netty.channel.kqueue.Native", "--initialize-at-run-time=io.netty.channel.kqueue.Native", @@ -1194,7 +1208,7 @@ val linuxOnlyArgs = defaultPlatformArgs.plus( ).plus(if (project.properties["elide.ci"] == "true") listOf( "-J-Xmx12g", ) else listOf( - "-J-Xmx24g", + "-J-Xmx48g", )) val linuxGvmReleaseFlags = listOf( @@ -1232,8 +1246,8 @@ fun nativeCliImageArgs( .plus(jvmCompileArgs) .plus(pklArgs.onlyIf(enablePkl)) .plus(listOf( - rootProject.layout.projectDirectory.dir("target/$nativesType").asFile.path, - rootProject.layout.projectDirectory.dir("target/$nativesType/lib").asFile.path, + targetPath, + sqliteLibPath, ).plus( languagePluginPaths ).plus( @@ -1660,6 +1674,7 @@ tasks { "java.library.path", listOf( umbrellaNativesPath, + sqliteLibPath, ).plus( languagePluginPaths.map { it.toString() @@ -1685,6 +1700,51 @@ tasks { ) } + test { + if (enableToolchains) javaLauncher = gvmLauncher + + jvmDefs.forEach { + systemProperty(it.key, it.value) + } + + systemProperty( + "micronaut.environments", + "dev", + ) + jvmDefs.map { + systemProperty(it.key, it.value) + } + systemProperty( + "org.graalvm.language.ruby.home", + layout.buildDirectory.dir("native/$nativeTargetType/resources/ruby/ruby-home").get().asFile.path.toString(), + ) + systemProperty( + "org.graalvm.language.python.home", + layout.buildDirectory.dir("native/$nativeTargetType/resources/python/python-home").get().asFile.path.toString(), + ) + systemProperty( + "elide.natives", + nativesPath, + ) + systemProperty( + "java.library.path", + listOf( + umbrellaNativesPath, + sqliteLibPath, + ).plus( + languagePluginPaths.map { + it.toString() + } + ).plus( + System.getProperty("java.library.path", "").split(File.pathSeparator).filter { + it.isNotEmpty() + } + ).joinToString( + File.pathSeparator + ) + ) + } + optimizedRun { dependsOn(ensureNatives) @@ -1709,6 +1769,7 @@ tasks { listOf( umbrellaNativesPath, nativesPath, + sqliteLibPath, ).plus( System.getProperty("java.library.path", "").split(File.pathSeparator).filter { it.isNotEmpty() diff --git a/packages/cli/detekt-baseline.xml b/packages/cli/detekt-baseline.xml index 7b478e6a46..add3595f0b 100644 --- a/packages/cli/detekt-baseline.xml +++ b/packages/cli/detekt-baseline.xml @@ -12,11 +12,11 @@ ConstructorParameterNaming:AbstractSubcommand.kt$AbstractSubcommand.DefaultOutputController$private val _settings: ToolState.OutputSettings = _state.output ConstructorParameterNaming:AbstractSubcommand.kt$AbstractSubcommand.DefaultOutputController$private val _state: State ConstructorParameterNaming:AbstractSubcommand.kt$AbstractSubcommand.ToolExecutionContextImpl$private val _state: T - CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand$override fun PolyglotEngineConfiguration.configureEngine() + CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand$override fun PolyglotEngineConfiguration.configureEngine(langs: EnumSet<GuestLanguage>) CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand$override suspend fun CommandContext.invoke(state: ToolContext<ToolState>): CommandResult CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand$private fun beginInteractiveSession( languages: EnumSet<GuestLanguage>, primaryLanguage: GuestLanguage, engine: PolyglotEngine, ctx: PolyglotContext, ) CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand$private fun displayFormattedError( exc: Throwable, message: String, advice: String? = null, internal: Boolean = false, stacktrace: Boolean = internal, withCause: Boolean = true, ) - CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand.LanguageSelector$internal fun resolve(project: ProjectInfo? = null, alias: String? = null): EnumSet<GuestLanguage> + CyclomaticComplexMethod:ToolShellCommand.kt$ToolShellCommand.LanguageSelector$internal fun resolveLangs(project: ProjectInfo? = null, alias: String? = null): EnumSet<GuestLanguage> FunctionParameterNaming:Statics.kt$Statics$`in`: InputStream LargeClass:ToolShellCommand.kt$ToolShellCommand : AbstractSubcommand LoopWithTooManyJumpStatements:ToolShellCommand.kt$ToolShellCommand$while @@ -32,6 +32,7 @@ MagicNumber:ToolShellCommand.kt$ToolShellCommand$40 MatchingDeclarationName:SanityTests.kt$SanitySelfTest : SelfTest MaxLineLength:ToolShellCommand.kt$ToolShellCommand$" or: elide @|bold,fg(cyan) run|shell|serve|start|@ [OPTIONS] [@|bold,fg(cyan) -c|@|@|bold,fg(cyan) --code|@ CODE]" + NestedBlockDepth:main.kt$private suspend inline fun runInner(args: Array<String>): Int ObjectPropertyNaming:Statics.kt$Statics$val `in`: InputStream get() = delegatedInStream.get() ?: System.`in` ReturnCount:ExecutionController.kt$ExecutionController$private fun toHost(polyglotException: PolyglotException): Throwable ReturnCount:NativeUtil.kt$NativeUtil$@JvmStatic internal fun loadOrCopy( workdir: File, path: String, libName: String, loader: ClassLoader, forceCopy: Boolean = false, forceLoad: Boolean = false, loadFromPath: Boolean = true, ): Pair<Boolean, Boolean> @@ -73,11 +74,15 @@ TooManyFunctions:ToolShellCommand.kt$ToolShellCommand : AbstractSubcommand TopLevelPropertyNaming:ToolInvokeCommand.kt$private const val jsHint = "package.json" TopLevelPropertyNaming:ToolInvokeCommand.kt$private const val pyHint = "requirements.txt" - TopLevelPropertyNaming:main.kt$// Whether to enable the experimental V2 entrypoint through Clikt. private const val enableCliEntryV2 = false UnusedParameter:AbstractToolCommand.kt$AbstractToolCommand$args: Array<String> UnusedParameter:Elide.kt$Elide.Companion$win32: Boolean = false + UnusedParameter:NativeEngine.kt$NativeEngine$extraProps: List<Pair<String, String>> UnusedPrivateProperty:AbstractToolCommand.kt$AbstractToolCommand$// Initialization state. private val initialized: AtomicBoolean = AtomicBoolean(false) UnusedPrivateProperty:ExecutionController.kt$ExecutionController$private val tRunException: Lazy<Value> = Lazy.of { loadClass("jdk.jshell.spi.ExecutionControl\$RunException") } + UnusedPrivateProperty:NativeEngine.kt$NativeEngine$val javaLibraryPath = System.getenv("JAVA_HOME")?.ifBlank { null }?.let { Path(it).resolve("lib") } + UnusedPrivateProperty:NativeEngine.kt$NativeEngine$val libExecPaths = listOf( resolvedExecPrefix, resolvedExecPrefix.resolve("python/python-home/lib/graalpy24.0"), resolvedExecPrefix.resolve("llvm/libsulong-native"), resolvedExecPrefix.resolve("ruby/ruby-home"), ) + UnusedPrivateProperty:NativeEngine.kt$NativeEngine$val libraryPath = System.getProperty("java.library.path", "") + UnusedPrivateProperty:NativeEngine.kt$NativeEngine$val nativesPath = natives.absolutePath UnusedPrivateProperty:ToolInvokeCommand.kt$// Sub-commands for Orogene. private val orogeneActions = sortedSetOf( "add", "apply", "login", "logout", "ping", "reapply", "remove", "view", "help", ) UnusedPrivateProperty:ToolInvokeCommand.kt$// Sub-commands for Uv. private val uvActions = sortedSetOf( "pip", "tool", "toolchain", "venv", "cache", "self", "version", "help", ) VariableNaming:AbstractScriptEngineFactory.kt$AbstractScriptEngineFactory.PolyglotContext$private val `in`: PolyglotReader diff --git a/packages/cli/gradle.lockfile b/packages/cli/gradle.lockfile index 2927b7bdf8..412872bd3f 100644 --- a/packages/cli/gradle.lockfile +++ b/packages/cli/gradle.lockfile @@ -9,13 +9,14 @@ ch.qos.logback:logback-classic:1.5.6=compileClasspath,runtimeClasspath ch.qos.logback:logback-core:1.5.6=compileClasspath,runtimeClasspath com.amazonaws:aws-java-sdk-bom:1.12.734=compileClasspath,runtimeClasspath com.azure:azure-sdk-bom:1.2.24=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-annotations:2.17.1=runtimeClasspath -com.fasterxml.jackson.core:jackson-core:2.17.1=runtimeClasspath -com.fasterxml.jackson.core:jackson-databind:2.17.1=runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1=runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1=runtimeClasspath -com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1=runtimeClasspath -com.fasterxml.jackson:jackson-bom:2.17.1=compileClasspath,runtimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.17.2=runtimeClasspath +com.fasterxml.jackson.core:jackson-core:2.17.2=runtimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.17.2=runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2=runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2=runtimeClasspath +com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2=runtimeClasspath +com.fasterxml.jackson:jackson-bom:2.17.1=compileClasspath +com.fasterxml.jackson:jackson-bom:2.17.2=runtimeClasspath com.github.ajalt.clikt:clikt-core-jvm:4.4.0.20-SNAPSHOT=compileClasspath,runtimeClasspath com.github.ajalt.clikt:clikt-core:4.4.0.20-SNAPSHOT=compileClasspath,runtimeClasspath com.github.ajalt.clikt:clikt-jvm:4.4.0.20-SNAPSHOT=compileClasspath,runtimeClasspath @@ -245,15 +246,15 @@ org.jetbrains.compose.collection-internal:collection:1.6.10=runtimeClasspath org.jetbrains.compose.runtime:runtime-desktop:1.6.10=compileClasspath,runtimeClasspath org.jetbrains.compose.runtime:runtime:1.6.10=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -264,10 +265,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/cli/src/config/resource-config-darwin-aarch64.json b/packages/cli/src/config/resource-config-darwin-aarch64.json index 23252538d2..807f3c7492 100644 --- a/packages/cli/src/config/resource-config-darwin-aarch64.json +++ b/packages/cli/src/config/resource-config-darwin-aarch64.json @@ -1,35 +1,43 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"}, - {"pattern":"\\Q(netty_quiche_osx_aarch_64, META-INF/native/libnetty_quiche_osx_aarch_64.jnilib)\\E"}, - {"pattern":"\\Q(netty_quiche_osx_aarch_64, META-INF/nativelibnetty_quiche_osx_aarch_64.dylib\\E"}, - {"pattern":"\\Q(netty_resolver_dns_native_macos_aarch_64, META-INF/native/libnetty_resolver_dns_native_macos_aarch_64.jnilib)\\E"}, - {"pattern":"\\Q(netty_resolver_dns_native_macos_aarch_64, META-INF/nativelibnetty_resolver_dns_native_macos_aarch_64.dylib\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" }, + { "pattern": "\\Q(netty_quiche_osx_aarch_64, META-INF/native/libnetty_quiche_osx_aarch_64.jnilib)\\E" }, + { "pattern": "\\Q(netty_quiche_osx_aarch_64, META-INF/nativelibnetty_quiche_osx_aarch_64.dylib\\E" }, + { + "pattern": "\\Q(netty_resolver_dns_native_macos_aarch_64, META-INF/native/libnetty_resolver_dns_native_macos_aarch_64.jnilib)\\E" + }, + { + "pattern": "\\Q(netty_resolver_dns_native_macos_aarch_64, META-INF/nativelibnetty_resolver_dns_native_macos_aarch_64.dylib\\E" + } ], "excludes": [ - {"pattern":"linux"}, - {"pattern":"Linux"}, - {"pattern":"windows"}, - {"pattern":"Windows"}, - {"pattern":"win32"}, - {"pattern":"Win32"}, - {"pattern":".*\\.dll"}, - {"pattern":".*\\.so"}, - {"pattern":"x86_64"}, - {"pattern":"x86-64"}, - {"pattern":"amd64"} + { "pattern": "linux" }, + { "pattern": "Linux" }, + { "pattern": "windows" }, + { "pattern": "Windows" }, + { "pattern": "win32" }, + { "pattern": "Win32" }, + { "pattern": ".*\\.dll" }, + { "pattern": ".*\\.so" }, + { "pattern": "x86_64" }, + { "pattern": "x86-64" }, + { "pattern": "amd64" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }, { - "name":"sun.awt.resources.awtosx", - "classNames":["sun.awt.resources.awtosx"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + }, + { + "name": "sun.awt.resources.awtosx", + "classNames": ["sun.awt.resources.awtosx"] + } + ] } diff --git a/packages/cli/src/config/resource-config-darwin-amd64.json b/packages/cli/src/config/resource-config-darwin-amd64.json index e855b163f5..1908a722cd 100644 --- a/packages/cli/src/config/resource-config-darwin-amd64.json +++ b/packages/cli/src/config/resource-config-darwin-amd64.json @@ -1,32 +1,36 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" } ], "excludes": [ - {"pattern":"linux"}, - {"pattern":"Linux"}, - {"pattern":"windows"}, - {"pattern":"Windows"}, - {"pattern":"win32"}, - {"pattern":"Win32"}, - {"pattern":"*.dll\\E"}, - {"pattern":"*.so\\E"}, - {"pattern":"\\Q**/*.dll\\E"}, - {"pattern":"\\Q**/*.so\\E"}, - {"pattern":"aarch64"}, - {"pattern":"arm64"} + { "pattern": "linux" }, + { "pattern": "Linux" }, + { "pattern": "windows" }, + { "pattern": "Windows" }, + { "pattern": "win32" }, + { "pattern": "Win32" }, + { "pattern": "*.dll\\E" }, + { "pattern": "*.so\\E" }, + { "pattern": "\\Q**/*.dll\\E" }, + { "pattern": "\\Q**/*.so\\E" }, + { "pattern": "aarch64" }, + { "pattern": "arm64" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }, { - "name":"sun.awt.resources.awtosx", - "classNames":["sun.awt.resources.awtosx"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + }, + { + "name": "sun.awt.resources.awtosx", + "classNames": ["sun.awt.resources.awtosx"] + } + ] } diff --git a/packages/cli/src/config/resource-config-linux-aarch64.json b/packages/cli/src/config/resource-config-linux-aarch64.json index 711ea6df22..0c62d2313d 100644 --- a/packages/cli/src/config/resource-config-linux-aarch64.json +++ b/packages/cli/src/config/resource-config-linux-aarch64.json @@ -1,27 +1,30 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" } ], "excludes": [ - {"pattern":"macos"}, - {"pattern":"macOS"}, - {"pattern":"darwin"}, - {"pattern":"Darwin"}, - {"pattern":"windows"}, - {"pattern":"Windows"}, - {"pattern":"win32"}, - {"pattern":"Win32"}, - {"pattern":"\\Q**/*.dll\\E"}, - {"pattern":"\\Q**/*.dylib\\E"} + { "pattern": "macos" }, + { "pattern": "macOS" }, + { "pattern": "darwin" }, + { "pattern": "Darwin" }, + { "pattern": "windows" }, + { "pattern": "Windows" }, + { "pattern": "win32" }, + { "pattern": "Win32" }, + { "pattern": "\\Q**/*.dll\\E" }, + { "pattern": "\\Q**/*.dylib\\E" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + } + ] } diff --git a/packages/cli/src/config/resource-config-linux-amd64.json b/packages/cli/src/config/resource-config-linux-amd64.json index 711ea6df22..0c62d2313d 100644 --- a/packages/cli/src/config/resource-config-linux-amd64.json +++ b/packages/cli/src/config/resource-config-linux-amd64.json @@ -1,27 +1,30 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" } ], "excludes": [ - {"pattern":"macos"}, - {"pattern":"macOS"}, - {"pattern":"darwin"}, - {"pattern":"Darwin"}, - {"pattern":"windows"}, - {"pattern":"Windows"}, - {"pattern":"win32"}, - {"pattern":"Win32"}, - {"pattern":"\\Q**/*.dll\\E"}, - {"pattern":"\\Q**/*.dylib\\E"} + { "pattern": "macos" }, + { "pattern": "macOS" }, + { "pattern": "darwin" }, + { "pattern": "Darwin" }, + { "pattern": "windows" }, + { "pattern": "Windows" }, + { "pattern": "win32" }, + { "pattern": "Win32" }, + { "pattern": "\\Q**/*.dll\\E" }, + { "pattern": "\\Q**/*.dylib\\E" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + } + ] } diff --git a/packages/cli/src/config/resource-config-windows-aarch64.json b/packages/cli/src/config/resource-config-windows-aarch64.json index 7f4a6921f1..b0170883dd 100644 --- a/packages/cli/src/config/resource-config-windows-aarch64.json +++ b/packages/cli/src/config/resource-config-windows-aarch64.json @@ -1,27 +1,30 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" } ], "excludes": [ - {"pattern":"*linux*"}, - {"pattern":"*Linux*"}, - {"pattern":"*macos*"}, - {"pattern":"*macos*"}, - {"pattern":"*darwin*"}, - {"pattern":"*darwin*"}, - {"pattern":"*win32*"}, - {"pattern":"*Win32*"}, - {"pattern":"\\Q**/*.so\\E"}, - {"pattern":"\\Q**/*.dylib\\E"} + { "pattern": "*linux*" }, + { "pattern": "*Linux*" }, + { "pattern": "*macos*" }, + { "pattern": "*macos*" }, + { "pattern": "*darwin*" }, + { "pattern": "*darwin*" }, + { "pattern": "*win32*" }, + { "pattern": "*Win32*" }, + { "pattern": "\\Q**/*.so\\E" }, + { "pattern": "\\Q**/*.dylib\\E" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + } + ] } diff --git a/packages/cli/src/config/resource-config-windows-amd64.json b/packages/cli/src/config/resource-config-windows-amd64.json index 7f4a6921f1..b0170883dd 100644 --- a/packages/cli/src/config/resource-config-windows-amd64.json +++ b/packages/cli/src/config/resource-config-windows-amd64.json @@ -1,27 +1,30 @@ { - "resources":{ + "resources": { "includes": [ - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E"}, - {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"} + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory\\E" }, + { "pattern": "\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E" } ], "excludes": [ - {"pattern":"*linux*"}, - {"pattern":"*Linux*"}, - {"pattern":"*macos*"}, - {"pattern":"*macos*"}, - {"pattern":"*darwin*"}, - {"pattern":"*darwin*"}, - {"pattern":"*win32*"}, - {"pattern":"*Win32*"}, - {"pattern":"\\Q**/*.so\\E"}, - {"pattern":"\\Q**/*.dylib\\E"} + { "pattern": "*linux*" }, + { "pattern": "*Linux*" }, + { "pattern": "*macos*" }, + { "pattern": "*macos*" }, + { "pattern": "*darwin*" }, + { "pattern": "*darwin*" }, + { "pattern": "*win32*" }, + { "pattern": "*Win32*" }, + { "pattern": "\\Q**/*.so\\E" }, + { "pattern": "\\Q**/*.dylib\\E" } ] }, - "bundles":[{ - "name":"ElideTool", - "locales":["en-US"] - }, { - "name":"sun.awt.resources.awt", - "classNames":["sun.awt.resources.awt"] - }] + "bundles": [ + { + "name": "ElideTool", + "locales": ["en-US"] + }, + { + "name": "sun.awt.resources.awt", + "classNames": ["sun.awt.resources.awt"] + } + ] } diff --git a/packages/cli/src/main/kotlin/dev/elide/cli/bridge/CliNativeBridge.kt b/packages/cli/src/main/kotlin/dev/elide/cli/bridge/CliNativeBridge.kt new file mode 100644 index 0000000000..751fa08218 --- /dev/null +++ b/packages/cli/src/main/kotlin/dev/elide/cli/bridge/CliNativeBridge.kt @@ -0,0 +1,60 @@ +@file:Suppress("RedundantVisibilityModifier") + +package dev.elide.cli.bridge + +/** + * # Native Bridge + * + * Bridges native methods from Elide's `umbrella` library, via JNI access points. + */ +object CliNativeBridge { + /** Token expected for the tooling API at version 1. */ + const val VERSION_V1: String = "v1" + + /** Native platform-agnostic library name for Elide's umbrella library. */ + private const val NATIVE_LIB_NAME = "umbrella" + + /** Whether the native layer has initialized yet. */ + private var initialized: Boolean = false + + /** Initialize the native layer. */ + @Synchronized public fun initialize() { + if (!initialized) { + initialized = true + val init = initializeNative() + assert(init == 0) { "Failed to initialize native layer; got code $init" } + } + } + + /** Initialize the native runtime layer; any non-zero return value indicates an error. */ + private external fun initializeNative(): Int + + /** Return the tooling protocol version. */ + external fun apiVersion(): String + + /** Return the library version. */ + external fun libVersion(): String + + /** Return the suite of reported tool names. */ + external fun supportedTools(): Array + + /** Return the languages which relate to a given tool. */ + external fun relatesTo(toolName: String): Array + + /** Return the version string for a tool. */ + external fun toolVersion(toolName: String): String + + /** Run the Ruff entrypoint. */ + external fun runRuff(args: Array): Int + + /** Run the Orogene entrypoint. */ + external fun runOrogene(args: Array): Int + + /** Run the Uv entrypoint. */ + external fun runUv(args: Array): Int + + init { + System.loadLibrary(NATIVE_LIB_NAME) + initialize() + } +} diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/AbstractSubcommand.kt b/packages/cli/src/main/kotlin/elide/tool/cli/AbstractSubcommand.kt index 104409fae5..e6e8708aa5 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/AbstractSubcommand.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/AbstractSubcommand.kt @@ -15,7 +15,6 @@ package elide.tool.cli import com.google.common.util.concurrent.ListeningExecutorService import com.google.common.util.concurrent.MoreExecutors -import com.oracle.svm.util.ReflectionUtil import lukfor.progress.TaskServiceBuilder import lukfor.progress.executors.ITaskExecutor import lukfor.progress.tasks.ITaskRunnable @@ -34,13 +33,13 @@ import java.util.concurrent.Executors import java.util.concurrent.ScheduledThreadPoolExecutor import java.util.concurrent.ThreadFactory import java.util.concurrent.atomic.AtomicBoolean +import java.util.concurrent.atomic.AtomicReference import kotlinx.coroutines.* import kotlin.coroutines.CoroutineContext import elide.runtime.Logger import elide.runtime.core.PolyglotContext import elide.runtime.core.PolyglotEngine import elide.runtime.core.PolyglotEngineConfiguration -import elide.runtime.plugins.api.NativePluginAPI import elide.tool.cli.err.AbstractToolError import elide.tool.cli.options.CommonOptions import elide.tool.cli.state.CommandState @@ -92,38 +91,6 @@ import org.graalvm.polyglot.Engine as VMEngine } } } - - // @JvmStatic fun loadLanguageExtensionMaybe(name: String) = try { - // loadLanguageExtension(name) - // } catch (err: Throwable) { - // Statics.logging.error("Failed to load extension '$name'", err) - // } - - // @JvmStatic fun loadLanguageExtension(name: String) { - // val libname = "elide$name" - // Statics.logging.debug("Loading extension '$name' ('$libname')") - // System.loadLibrary(libname) - // val capitalized = name.replaceFirstChar { - // if (it. isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() - // } - // val symbol = "elide.runtime.${name}.Elide${capitalized}Language" - // val klass = Class.forName(symbol) - // Statics.logging.debug("Loaded extension '$name' ('$libname') as '$klass'") - // try { - // val obtainer = ReflectionUtil.lookupMethod(klass, "get") - // val plugin = obtainer.invoke(null) as NativePluginAPI - // plugin.init() - // } catch (err: Throwable) { - // Statics.logging.error("Failed to load obtainer for plugin '$name'", err) - - // try { - // val instance = klass.declaredConstructors.first().newInstance() as NativePluginAPI - // instance.init() - // } catch (err: Throwable) { - // throw err - // } - // } - // } } private val _cpus = Runtime.getRuntime().availableProcessors() @@ -366,10 +333,10 @@ import org.graalvm.polyglot.Engine as VMEngine private val sharedResources: MutableList = LinkedList() // Common options shared by all commands. - @Mixin internal lateinit var commons: CommonOptions + @Mixin internal var commons: CommonOptions = CommonOptions() // Command specification from Picocli. - @Spec internal lateinit var commandSpec: CommandSpec + @Spec internal var commandSpec: CommandSpec? = null /** A thread-local [PolyglotContext] instance acquired from the [engine]. */ private val contextHandle: ThreadLocal = ThreadLocal() @@ -379,7 +346,7 @@ import org.graalvm.polyglot.Engine as VMEngine * * @see createEngine */ - protected val engine: PolyglotEngine by lazy(::createEngine) + protected val engine: AtomicReference = AtomicReference() /** Controller for tool output. */ protected lateinit var out: OutputController @@ -418,9 +385,9 @@ import org.graalvm.polyglot.Engine as VMEngine * * @return A new, exclusive [PolyglotEngine] instance. */ - private fun createEngine(): PolyglotEngine = PolyglotEngine { + private fun createEngine(langs: EnumSet): PolyglotEngine = PolyglotEngine { // allow subclasses to customize the engine - configureEngine() + configureEngine(langs) } // Build an initial `ToolState` instance from the main tool. @@ -490,13 +457,20 @@ import org.graalvm.polyglot.Engine as VMEngine ) } + @Synchronized protected fun resolveEngine(langs: EnumSet): PolyglotEngine { + return when (val ready = engine.get()) { + null -> createEngine(langs).also { engine.set(it) } + else -> ready + } + } + /** * Resolve a thread-local [PolyglotContext], acquiring a new one from the [engine] if necessary. That the returned * context _must not_ be shared with other threads to avoid exceptions related to concurrent usage. * * Subclasses should prefer [withContext] as it provides a limited scope in which the context can be used. */ - protected fun resolvePolyglotContext(): PolyglotContext { + protected fun resolvePolyglotContext(langs: EnumSet): PolyglotContext { logging.debug("Resolving context for current thread") // already initialized on the current thread @@ -507,7 +481,7 @@ import org.graalvm.polyglot.Engine as VMEngine // not initialized yet, acquire a new one and store it logging.debug("No cached context found for current thread, acquiring new context") - return engine.acquire().also { created -> + return resolveEngine(langs).acquire().also { created -> contextHandle.set(created) } } @@ -563,9 +537,9 @@ import org.graalvm.polyglot.Engine as VMEngine * The first invocation of this method will cause the [engine] to be initialized, triggering the * [configureEngine] event. */ - protected open fun withContext(block: (PolyglotContext) -> Unit) { + protected open fun withContext(langs: EnumSet, block: (PolyglotContext) -> Unit) { logging.debug("Acquiring context for CLI tool") - with(resolvePolyglotContext()) { + with(resolvePolyglotContext(langs)) { logging.debug("Context acquired") use { enter() @@ -694,7 +668,7 @@ import org.graalvm.polyglot.Engine as VMEngine protected open fun state(): State? = null /** Configure the [PolyglotEngine] that will be used to acquire contexts used by the [withContext] function. */ - protected open fun PolyglotEngineConfiguration.configureEngine(): Unit = Unit + protected open fun PolyglotEngineConfiguration.configureEngine(langs: EnumSet): Unit = Unit protected abstract suspend fun CommandContext.invoke(state: ToolContext): CommandResult } diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/AbstractToolCommand.kt b/packages/cli/src/main/kotlin/elide/tool/cli/AbstractToolCommand.kt index 01a937ed27..bbdaec6bb0 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/AbstractToolCommand.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/AbstractToolCommand.kt @@ -174,8 +174,10 @@ abstract class AbstractToolCommand: if (it.isFailure) { val err = it.exceptionOrNull() val stack = err?.stackTrace?.joinToString("\n") ?: "(unknown)" - logging.error("Uncaught fatal exception", err ?: "(unknown)", stack) + val label = err ?: "(unknown)" + logging.error("Uncaught fatal exception: $label\n$stack") exit.set(1) + if (err != null) throw err } } } diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/Elide.kt b/packages/cli/src/main/kotlin/elide/tool/cli/Elide.kt index 66cc4c5403..0c2bf96ce1 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/Elide.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/Elide.kt @@ -25,7 +25,11 @@ import org.graalvm.nativeimage.ImageInfo import org.graalvm.nativeimage.ProcessProperties import org.slf4j.bridge.SLF4JBridgeHandler import picocli.CommandLine -import picocli.CommandLine.* +import picocli.CommandLine.Command +import picocli.CommandLine.Help +import picocli.CommandLine.Option +import picocli.CommandLine.Parameters +import picocli.CommandLine.ScopeType import java.util.* import elide.annotations.Context import elide.annotations.Eager diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt b/packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt index 0242e27a37..4d208873c2 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt @@ -251,7 +251,7 @@ import elide.tool.project.ProjectManager // Resolve the primary interactive language. internal fun primary( - spec: CommandSpec, + spec: CommandSpec?, langs: EnumSet, project: ProjectInfo?, languageHint: String?, @@ -277,7 +277,7 @@ import elide.tool.project.ProjectManager val explicitlySelectedLanguagesBySet = Sets.intersection(language ?: emptySet(), langs) // language by alias - val candidateArgs = spec.commandLine()?.parseResult?.originalArgs() + val candidateArgs = spec?.commandLine()?.parseResult?.originalArgs() val languageHintMatch = langs.firstOrNull { it.id == languageHint } val candidateByName = languageHintMatch ?: maybeMatchLanguagesByAlias( candidateArgs?.firstOrNull(), @@ -311,7 +311,7 @@ import elide.tool.project.ProjectManager private val ktAliases = setOf("kt", "kotlin") // Resolve the specified language. - internal fun resolve(project: ProjectInfo? = null, alias: String? = null): EnumSet { + internal fun resolveLangs(project: ProjectInfo? = null, alias: String? = null): EnumSet { return EnumSet.noneOf(GuestLanguage::class.java).apply { add(JS) add(WASM) @@ -919,7 +919,7 @@ import elide.tool.project.ProjectManager // Build a highlighting manager for use by the line reader. private fun buildHighlighter(language: GuestLanguage, jnanorc: Path): Pair { - logging.debug("Building highlighter with config path '$jnanorc'") + logging.debug("Building highlighter with config path '{}'", jnanorc) val commandHighlighter = SyntaxHighlighter.build(jnanorc, "COMMAND") val argsHighlighter = SyntaxHighlighter.build(jnanorc, "ARGS") val langHighlighter = SyntaxHighlighter.build(jnanorc, syntaxHighlightName(language)) @@ -992,7 +992,7 @@ import elide.tool.project.ProjectManager val jnanorcDir = rootPath.resolve("nanorc") val jnanorcFile = Paths.get(userHome, "jnanorc").toFile() - logging.debug("Checking nanorc root at path '${jnanorcFile.toPath()}'") + logging.debug("Checking nanorc root at path '{}'", jnanorcFile.toPath()) var jnanocDirReady = false if (!jnanorcDir.exists()) { logging.debug("Nano config directory does not exist. Creating...") @@ -1023,7 +1023,7 @@ import elide.tool.project.ProjectManager "ts.nanorc", ).parallelStream().forEach { val target = jnanorcDir.resolve(it) - logging.debug("- Initializing syntax file '$it' ($target)") + logging.debug("- Initializing syntax file '{}' ({})", it, target) if (target.exists()) { logging.debug("Syntax file '$it' already exists. Skipping...") return@forEach @@ -1046,7 +1046,7 @@ import elide.tool.project.ProjectManager } } - logging.debug("Checking syntax config at path '${jnanorcFile.toPath()}'") + logging.debug("Checking syntax config at path '{}'", jnanorcFile.toPath()) if (!jnanorcFile.exists()) { logging.debug("Syntax config does not exist. Writing...") FileWriter(jnanorcFile).use { fw -> @@ -1524,13 +1524,19 @@ import elide.tool.project.ProjectManager ) // Read an executable script, and then execute the script and keep it started as a server. - private fun readStartServer(label: String, language: GuestLanguage, ctx: PolyglotContext, source: Source) { + private fun readStartServer( + label: String, + langs: EnumSet, + language: GuestLanguage, + ctx: PolyglotContext, + source: Source, + ) { try { // enter VM context logging.trace("Entered VM for server application (language: ${language.id}). Consuming script from: '$label'") // initialize the server intrinsic and run using the provided source - serverAgent.run(entrypoint = source, acquireContext = ::resolvePolyglotContext) + serverAgent.run(entrypoint = source) { resolvePolyglotContext(langs) } phaser.get().register() serverRunning.set(true) @@ -1549,6 +1555,7 @@ import elide.tool.project.ProjectManager ) { if (serveMode()) readStartServer( label, + languages, primaryLanguage, ctx, source, @@ -1637,18 +1644,15 @@ import elide.tool.project.ProjectManager } } - override fun PolyglotEngineConfiguration.configureEngine() { + override fun PolyglotEngineConfiguration.configureEngine(langs: EnumSet) { // grab project configurations, if available val project = activeProject.get() - if (project != null) logging.debug("Resolved project info: $project") + if (project != null) logging.debug("Resolved project info: {}", project) // conditionally apply debugging settings if (debug) debugger.apply(this) inspector.apply(this) - - val requiresIo = language.resolve(project, languageHint).let { - it.contains(PYTHON) || it.contains(RUBY) - } + val requiresIo = langs.let { it.contains(PYTHON) || it.contains(RUBY) } // configure host access rules hostAccess = when { @@ -1687,7 +1691,7 @@ import elide.tool.project.ProjectManager val cmd = ProcessHandle.current().info().command().orElse("elide") val args = Statics.args.get() ?: emptyList() - (language ?: LanguageSelector()).resolve().forEach { lang -> + langs.forEach { lang -> when (lang) { // Primary Engines JS -> install(elide.runtime.plugins.js.JavaScript) { @@ -1700,7 +1704,7 @@ import elide.tool.project.ProjectManager } WASM -> install(elide.runtime.plugins.wasm.Wasm) { - logging.debug("Configuring JS VM") + logging.debug("Configuring WASM VM") resourcesPath = GVM_RESOURCES } @@ -1761,7 +1765,7 @@ import elide.tool.project.ProjectManager // configure VFS with user-specified bundles vfs { deferred = true - languages.addAll(language.resolve(project)) + languages.addAll(langs) // resolve the file-system bundles to use val userBundles = filesystems.mapNotNull { checkFsBundle(it) } @@ -1779,19 +1783,19 @@ import elide.tool.project.ProjectManager } else { // make sure the file can be read val file = try { - logging.trace("Checking bundle at URI '$uri'") + logging.trace("Checking bundle at URI '{}'", uri) File(uri) } catch (err: IOException) { throw ShellError.BUNDLE_NOT_FOUND.asError() } - logging.trace("Checking existence of '$uri'") + logging.trace("Checking existence of '{}'", uri) if (!file.exists()) throw ShellError.BUNDLE_NOT_FOUND.asError() - logging.trace("Checking readability of '$uri'") + logging.trace("Checking readability of '{}'", uri) if (!file.canRead()) throw ShellError.BUNDLE_NOT_ALLOWED.asError() - logging.debug("Mounting guest filesystem at URI: '$uri'") + logging.debug("Mounting guest filesystem at URI: '{}'", uri) include(uri) } } @@ -1819,9 +1823,9 @@ import elide.tool.project.ProjectManager // resolve the language to use val project = projectConfigJob.await() - val langs = language.resolve(project, alias = languageHint) logging.trace("All supported languages: ${allSupported.joinToString(", ") { it.id }}") val supportedEnginesAndLangs = supported.flatMap { listOf(it.first.engine, it.first.id) }.toSortedSet() + val langs = language.resolveLangs(project, languageHint) // make sure each requested language is supported langs.forEach { @@ -1859,8 +1863,8 @@ import elide.tool.project.ProjectManager activeProject.set(prj) } - engine.unwrap().use { - withContext { + resolveEngine(langs).unwrap().use { + withContext(langs) { // activate interactive behavior interactive.compareAndSet(false, true) @@ -1892,7 +1896,7 @@ import elide.tool.project.ProjectManager beginInteractiveSession( langs, primaryLang.invoke(null), - engine, + engine.get(), it, ) } else { diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/cmd/tool/ToolInvokeCommand.kt b/packages/cli/src/main/kotlin/elide/tool/cli/cmd/tool/ToolInvokeCommand.kt index 37dfbe939c..0dc9fc2dc6 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/cmd/tool/ToolInvokeCommand.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/cmd/tool/ToolInvokeCommand.kt @@ -354,7 +354,7 @@ private enum class ToolAction ( } // decode instruction alias and resolve it to an action - val instruction = commandSpec.commandLine().parent.parseResult.originalArgs().firstOrNull() ?: DEFAULT_ACTION + val instruction = commandSpec?.commandLine()?.parent?.parseResult?.originalArgs()?.firstOrNull() ?: DEFAULT_ACTION val action = ToolAction.resolve(instruction) val isAutoToolsMode = tools.isEmpty() || tools.firstOrNull() == AUTO_SYMBOL val selectedTools = (if (isAutoToolsMode) resolveTools() else resolveApplicable( diff --git a/packages/cli/src/main/kotlin/elide/tool/cli/main.kt b/packages/cli/src/main/kotlin/elide/tool/cli/main.kt index 26af634167..96c1758a19 100644 --- a/packages/cli/src/main/kotlin/elide/tool/cli/main.kt +++ b/packages/cli/src/main/kotlin/elide/tool/cli/main.kt @@ -17,6 +17,7 @@ import com.github.ajalt.clikt.core.PrintHelpMessage import com.github.ajalt.clikt.parsers.CommandLineParser import com.github.ajalt.clikt.parsers.flatten import com.jakewharton.mosaic.runMosaic +import dev.elide.cli.bridge.CliNativeBridge import io.micronaut.configuration.picocli.MicronautFactory import io.micronaut.context.ApplicationContext import picocli.CommandLine @@ -30,7 +31,7 @@ import elide.annotations.Eager private val enableMosaic = System.getProperty("elide.mosaic").toBoolean() // Whether to enable the experimental V2 entrypoint through Clikt. -private const val enableCliEntryV2 = false +private val ENABLE_CLI_ENTRY_V2 = System.getenv("ELIDE_EXPERIMENTAL")?.ifBlank { null } != null // Whether to exist after completion. val exitOnComplete: AtomicBoolean = AtomicBoolean(true) @@ -41,9 +42,6 @@ val exitCode: AtomicInteger = AtomicInteger(0) // Unhandled error that caused exit, if any. val unhandledExc: AtomicReference = AtomicReference(null) -// Singleton entrypoint for Elide. -private val SINGLETON by lazy { Elide() } - // Read the old entrypoint factory. private fun sorryIHaveToFactory(args: Array): CommandLine = ApplicationContext .builder() @@ -58,38 +56,50 @@ private suspend inline fun runEntry(crossinline fn: suspend () -> Unit) = when ( } // Run the Clikt or regular entrypoint. -private suspend inline fun runInner(args: Array): Int = when (enableCliEntryV2) { +private suspend inline fun runInner(args: Array): Int = when (ENABLE_CLI_ENTRY_V2) { false -> Elide.entry(args) - true -> runCatching { - Elide.installStatics(args, System.getProperty("user.dir")) - CommandLineParser - .parse(SINGLETON, args.toList().also { Statics.args.set(it) }) - }.onFailure { - println("Failed to parse arguments: ${it.message}") - it.printStackTrace() - }.getOrNull()?.let { command -> - try { - command.invocation - .flatten() - .first() - .command - .enter() - .exitCode - } catch (err: PrintHelpMessage) { - try { - sorryIHaveToFactory(args).usage(System.out) - } catch (err: Throwable) { - println("Failed to print help message: ${err.message}") - err.printStackTrace() - exitProcess(1) + true -> ApplicationContext + .builder() + .eagerInitAnnotated(Eager::class.java) + .args(*args).start().use { applicationContext -> + MicronautFactory(applicationContext).use { factory -> + runCatching { + Elide.installStatics(args, System.getProperty("user.dir")) + CommandLineParser + .parse(factory.create(Elide::class.java), args.toList().also { Statics.args.set(it) }) + }.onFailure { + println("Failed to parse arguments: ${it.message}") + it.printStackTrace() + }.getOrNull()?.let { command -> + try { + val cmd = command.invocation + .flatten() + .first() + .command + + cmd.enter().exitCode + } catch (err: PrintHelpMessage) { + try { + sorryIHaveToFactory(args).usage(System.out) + } catch (err: Throwable) { + println("Failed to print help message: ${err.message}") + err.printStackTrace() + exitProcess(1) + } + 0 + } catch (err: RuntimeException) { + println("Uncaught error while running command: ${err.message}") + err.printStackTrace() + 1 + } + } ?: 1 } - 0 - } catch (err: RuntimeException) { - println("Uncaught error while running command: ${err.message}") - err.printStackTrace() - 1 } - } ?: 1 +} + +// Perform early startup initialization tasks. +private fun initialize() { + CliNativeBridge.initialize() } /** @@ -101,6 +111,10 @@ private suspend inline fun runInner(args: Array): Int = when (enableCliE * @param args Arguments to run with. */ suspend fun main(args: Array) = try { + // perform early init + initialize() + + // run the entrypoint runEntry { exitCode.set(try { runInner(args) diff --git a/packages/cli/src/main/kotlin/elide/tool/engine/NativeEngine.kt b/packages/cli/src/main/kotlin/elide/tool/engine/NativeEngine.kt index 94b0da40ac..6d5ac1251f 100644 --- a/packages/cli/src/main/kotlin/elide/tool/engine/NativeEngine.kt +++ b/packages/cli/src/main/kotlin/elide/tool/engine/NativeEngine.kt @@ -318,29 +318,6 @@ object NativeEngine { Path(it).resolve("lib") } - val libPath = if (!libraryPath.contains("/elide-runtime")) { - libraryPath.split(separator).toMutableList().apply { - // elide's natives path - add(0, nativesPath) - - // any given override path - System.getProperty("elide.natives")?.let { add(1, it) } - - // bundled library paths - addAll(libExecPaths.map { it.absolutePathString() }) - - // java's library path - if (javaLibraryPath != null) add(javaLibraryPath.absolutePathString()) - }.distinct().joinToString(separator) - } else libraryPath - - listOf( - "java.library.path" to libPath, - "io.netty.native.workdir" to nativesPath, - ).plus(extraProps).forEach { - System.setProperty(it.first, it.second) - } - // load all required native libs for current platform loadAllNatives(platform, natives.toFile(), this::class.java.classLoader) diff --git a/packages/cli/src/main/kotlin/elide/tool/feature/ToolingUmbrellaFeature.kt b/packages/cli/src/main/kotlin/elide/tool/feature/ToolingUmbrellaFeature.kt index b9f9c54863..410abc2c67 100644 --- a/packages/cli/src/main/kotlin/elide/tool/feature/ToolingUmbrellaFeature.kt +++ b/packages/cli/src/main/kotlin/elide/tool/feature/ToolingUmbrellaFeature.kt @@ -38,14 +38,6 @@ import elide.runtime.feature.engine.AbstractStaticNativeLibraryFeature deps = listOf("ssl", "crypto", "apr-2", "sqlite3", "sqlitejdbc"), )) - private fun loadUmbrella() { - // force-load the library - System.loadLibrary("umbrella") - require(CliNativeBridge.apiVersion() == CliNativeBridge.VERSION_V1) { - "Native bridge version mismatch" - } - } - private fun registerJniCalls() { register(dev.elide.cli.bridge.CliNativeBridge::class.java) } @@ -53,6 +45,5 @@ import elide.runtime.feature.engine.AbstractStaticNativeLibraryFeature override fun beforeAnalysis(access: BeforeAnalysisAccess) { super.beforeAnalysis(access) registerJniCalls() - loadUmbrella() } } diff --git a/packages/core/build.gradle.kts b/packages/core/build.gradle.kts index a172b7cb73..a1361983a8 100644 --- a/packages/core/build.gradle.kts +++ b/packages/core/build.gradle.kts @@ -48,3 +48,17 @@ dependencies { api(libs.jetbrains.annotations) } } + +tasks.named("jvmTest", Test::class) { + systemProperty("java.library.path", StringBuilder().apply { + append(rootProject.layout.projectDirectory.dir("target/debug").asFile.path) + append(File.pathSeparator) + append(rootProject.layout.projectDirectory.dir("target/release").asFile.path) + System.getProperty("java.library.path", "").let { + if (it.isNotEmpty()) { + append(File.pathSeparator) + append(it) + } + } + }.toString()) +} diff --git a/packages/core/src/jvmMain/kotlin/module-info.java b/packages/core/src/jvmMain/kotlin/module-info.java index b8be2396e8..cb39cbe443 100644 --- a/packages/core/src/jvmMain/kotlin/module-info.java +++ b/packages/core/src/jvmMain/kotlin/module-info.java @@ -12,8 +12,8 @@ */ module elide.core { - requires java.base; requires kotlin.stdlib; + requires jdk.incubator.vector; exports elide.core.api; exports elide.core.annotations; diff --git a/packages/core/src/jvmTest/kotlin/.gitkeep b/packages/core/src/jvmTest/kotlin/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/engine/api/engine.api b/packages/engine/api/engine.api index 02f6fca8fe..7f6f1fba45 100644 --- a/packages/engine/api/engine.api +++ b/packages/engine/api/engine.api @@ -188,6 +188,8 @@ public final class elide/runtime/core/PolyglotContext$EvaluationOptions$Companio public final class elide/runtime/core/PolyglotContext$EvaluationOptionsData : java/lang/Record, elide/runtime/core/PolyglotContext$EvaluationOptions { public final fun component1 ()Z + public final fun copy (Z)Lelide/runtime/core/PolyglotContext$EvaluationOptionsData; + public static synthetic fun copy$default (Lelide/runtime/core/PolyglotContext$EvaluationOptionsData;ZILjava/lang/Object;)Lelide/runtime/core/PolyglotContext$EvaluationOptionsData; public fun equals (Ljava/lang/Object;)Z public synthetic fun getInternals ()Z public fun hashCode ()I diff --git a/packages/engine/gradle.lockfile b/packages/engine/gradle.lockfile index 9c1b8985a2..213860ad09 100644 --- a/packages/engine/gradle.lockfile +++ b/packages/engine/gradle.lockfile @@ -115,14 +115,14 @@ org.graalvm.sdk:nativeimage:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.graalvm.sdk:word:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -131,10 +131,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/engine/src/main/kotlin/elide/runtime/plugins/AbstractLanguagePlugin.kt b/packages/engine/src/main/kotlin/elide/runtime/plugins/AbstractLanguagePlugin.kt index 84a035e3d2..5003cb3ef2 100644 --- a/packages/engine/src/main/kotlin/elide/runtime/plugins/AbstractLanguagePlugin.kt +++ b/packages/engine/src/main/kotlin/elide/runtime/plugins/AbstractLanguagePlugin.kt @@ -204,7 +204,10 @@ import elide.runtime.plugins.bindings.Bindings ) } catch (err: RuntimeException) { if (System.getProperty("elide.strict") == "true") { - throw IllegalStateException("Embedded init evaluation failed. This is a bug in Elide.", err) + throw IllegalStateException( + "Embedded init evaluation failed at unit '${source.path}'. This is a bug in Elide.", + err, + ) } } } diff --git a/packages/graalvm-java/gradle.lockfile b/packages/graalvm-java/gradle.lockfile index 35535bfb5b..596038974a 100644 --- a/packages/graalvm-java/gradle.lockfile +++ b/packages/graalvm-java/gradle.lockfile @@ -134,14 +134,14 @@ org.graalvm.truffle:truffle-nfi:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspat org.graalvm.truffle:truffle-runtime:24.2.0-SNAPSHOT=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -150,10 +150,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-jvm/gradle.lockfile b/packages/graalvm-jvm/gradle.lockfile index 0b3a2a5e35..0affdddc9c 100644 --- a/packages/graalvm-jvm/gradle.lockfile +++ b/packages/graalvm-jvm/gradle.lockfile @@ -134,14 +134,14 @@ org.graalvm.truffle:truffle-nfi:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspat org.graalvm.truffle:truffle-runtime:24.2.0-SNAPSHOT=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -150,10 +150,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-kt/gradle.lockfile b/packages/graalvm-kt/gradle.lockfile index 59922b3299..826e03ee93 100644 --- a/packages/graalvm-kt/gradle.lockfile +++ b/packages/graalvm-kt/gradle.lockfile @@ -135,23 +135,23 @@ org.graalvm.truffle:truffle-runtime:24.2.0-SNAPSHOT=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.intellij.deps:trove4j:1.0.20200330=runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-compiler-embeddable:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-daemon-embeddable:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-script-runtime:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-scripting-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-scripting-jvm-host:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-compiler-embeddable:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-daemon-embeddable:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-script-runtime:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-scripting-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-scripting-jvm-host:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -160,10 +160,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-llvm/gradle.lockfile b/packages/graalvm-llvm/gradle.lockfile index d9a58a6d0a..bb21d7e431 100644 --- a/packages/graalvm-llvm/gradle.lockfile +++ b/packages/graalvm-llvm/gradle.lockfile @@ -130,14 +130,14 @@ org.graalvm.truffle:truffle-nfi-libffi:24.2.0-SNAPSHOT=compileClasspath,runtimeC org.graalvm.truffle:truffle-nfi:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -146,10 +146,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-py/gradle.lockfile b/packages/graalvm-py/gradle.lockfile index e6e16e5127..d3b8df8b08 100644 --- a/packages/graalvm-py/gradle.lockfile +++ b/packages/graalvm-py/gradle.lockfile @@ -141,14 +141,14 @@ org.graalvm.truffle:truffle-nfi:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspat org.graalvm.truffle:truffle-runtime:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -157,10 +157,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-py/src/main/kotlin/elide/runtime/plugins/python/Python.kt b/packages/graalvm-py/src/main/kotlin/elide/runtime/plugins/python/Python.kt index bd2f40a9e3..593136ea52 100644 --- a/packages/graalvm-py/src/main/kotlin/elide/runtime/plugins/python/Python.kt +++ b/packages/graalvm-py/src/main/kotlin/elide/runtime/plugins/python/Python.kt @@ -13,6 +13,7 @@ package elide.runtime.plugins.python +import com.oracle.graal.python.PythonLanguage import org.graalvm.nativeimage.ImageInfo import org.graalvm.polyglot.io.FileSystem import java.nio.file.Path @@ -48,6 +49,16 @@ private val BUILTIN_PYTHON_PATHS = listOf( if (resources != null) initializeEmbeddedScripts(context, resources) } + private fun resolveGraalPythonVersions(): Pair { + val langVersion = PythonLanguage.VERSION + val graalvmMajor = PythonLanguage.GRAALVM_MAJOR + val graalvmMinor = PythonLanguage.GRAALVM_MINOR + + // `3.11.2` → `3.11` + val parsedLangVersion = langVersion.split(".").slice(0..1).joinToString(".") + return parsedLangVersion to "$graalvmMajor.$graalvmMinor" + } + private fun renderPythonPath(): String = sequence { yieldAll(BUILTIN_PYTHON_PATHS) yieldAll(config.additionalPythonPaths) @@ -83,11 +94,13 @@ private val BUILTIN_PYTHON_PATHS = listOf( ) if (ImageInfo.inImageCode()) { + val (pythonVersion, graalPyVersion) = resolveGraalPythonVersions() + builder.setOptions( - "python.CoreHome" to "$it/python/python-home/lib/graalpy24.0", - "python.SysPrefix" to "$it/python/python-home/lib/graalpy24.0", - "python.StdLibHome" to "$it/python/python-home/lib/python3.10", - "python.CAPI" to "$it/python/python-home/lib/graalpy24.0", + "python.CoreHome" to "$it/python/python-home/lib/graalpy$graalPyVersion", + "python.SysPrefix" to "$it/python/python-home/lib/graalpy$graalPyVersion", + "python.StdLibHome" to "$it/python/python-home/lib/python$pythonVersion", + "python.CAPI" to "$it/python/python-home/lib/graalpy$graalPyVersion", "python.PythonHome" to "$it/python/python-home", ) } diff --git a/packages/graalvm-py/src/main/resources/META-INF/elide/embedded/runtime/python/environment.py b/packages/graalvm-py/src/main/resources/META-INF/elide/embedded/runtime/python/environment.py index 248e656f02..df0a19c689 100644 --- a/packages/graalvm-py/src/main/resources/META-INF/elide/embedded/runtime/python/environment.py +++ b/packages/graalvm-py/src/main/resources/META-INF/elide/embedded/runtime/python/environment.py @@ -18,18 +18,20 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under the License. +import polyglot + + # noinspection PyPep8Naming class _Elide_ApplicationEnvironment(object): - """Handler for resolving application-level environment, and withholding system environment, as needed.""" __app_environ = {} __virtual_env = {} def __init__(self): - import polyglot data = polyglot.import_value("__Elide_app_env__") - self.__app_environ = {x: data[x] for x in data} + if data is not None: + self.__app_environ = {x: data[x] for x in data} def contains_key(self, item): return item in self.__app_environ or item in self.__virtual_env @@ -53,9 +55,16 @@ def __repr__(self): return "Environ(%s)" % ", ".join(self.all_keys()) def __dir__(self): - return ( - ["get", "contains_key", "all_keys", "__getitem__", "__setitem__", "__repr__", "__contains__", "__dir__"] - ) + return [ + "get", + "contains_key", + "all_keys", + "__getitem__", + "__setitem__", + "__repr__", + "__contains__", + "__dir__", + ] def get(self, item, default=None): if item in self: @@ -66,6 +75,7 @@ def get(self, item, default=None): def __patch(cls, singleton): """Patch the OS environment component, if it has not been patched yet.""" import os + if not getattr(cls, "_patched", False): os.environ = singleton setattr(cls, "_patched", True) diff --git a/packages/graalvm-rb/gradle.lockfile b/packages/graalvm-rb/gradle.lockfile index 888c5cc0de..cf8618df9a 100644 --- a/packages/graalvm-rb/gradle.lockfile +++ b/packages/graalvm-rb/gradle.lockfile @@ -144,14 +144,14 @@ org.graalvm.truffle:truffle-nfi:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspat org.graalvm.truffle:truffle-runtime:24.2.0-SNAPSHOT=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -160,10 +160,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-ts/gradle.lockfile b/packages/graalvm-ts/gradle.lockfile index 974158b2f9..5ff4247520 100644 --- a/packages/graalvm-ts/gradle.lockfile +++ b/packages/graalvm-ts/gradle.lockfile @@ -119,14 +119,14 @@ org.graalvm.shadowed:icu4j:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.graalvm.truffle:truffle-api:24.2.0-SNAPSHOT=compileClasspath,runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -135,10 +135,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm-wasm/gradle.lockfile b/packages/graalvm-wasm/gradle.lockfile index fa64556d65..1250928cd3 100644 --- a/packages/graalvm-wasm/gradle.lockfile +++ b/packages/graalvm-wasm/gradle.lockfile @@ -122,14 +122,14 @@ org.graalvm.wasm:wasm-community:24.2.0-SNAPSHOT=runtimeClasspath org.graalvm.wasm:wasm-language:24.2.0-SNAPSHOT=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -138,10 +138,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm/api/graalvm.api b/packages/graalvm/api/graalvm.api index 6d8735b94f..163ed31ec5 100644 --- a/packages/graalvm/api/graalvm.api +++ b/packages/graalvm/api/graalvm.api @@ -2267,6 +2267,8 @@ public final class elide/runtime/gvm/internals/vfs/EffectiveGuestVFSConfig { public final fun component7 ()Ljava/lang/Boolean; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/nio/file/Path; + public final fun copy (ZZZLelide/runtime/gvm/internals/vfs/GuestVFSPolicy;Ljava/util/List;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/nio/file/Path;)Lelide/runtime/gvm/internals/vfs/EffectiveGuestVFSConfig; + public static synthetic fun copy$default (Lelide/runtime/gvm/internals/vfs/EffectiveGuestVFSConfig;ZZZLelide/runtime/gvm/internals/vfs/GuestVFSPolicy;Ljava/util/List;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/nio/file/Path;ILjava/lang/Object;)Lelide/runtime/gvm/internals/vfs/EffectiveGuestVFSConfig; public static final fun empty (ZZZLjava/lang/String;Ljava/lang/String;)Lelide/runtime/gvm/internals/vfs/EffectiveGuestVFSConfig; public fun equals (Ljava/lang/Object;)Z public final fun getBundle ()Ljava/util/List; @@ -2837,6 +2839,8 @@ public final class elide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOption public static final field Companion Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions$Companion; public synthetic fun (ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Z + public final fun copy (Z)Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions; + public static synthetic fun copy$default (Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions;ZILjava/lang/Object;)Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions; public fun equals (Ljava/lang/Object;)Z public static final fun from (Lorg/graalvm/polyglot/Value;)Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions; public static final fun getDEFAULTS ()Lelide/runtime/intrinsics/js/encoding/TextDecoder$DecodeOptions; @@ -2874,6 +2878,8 @@ public final class elide/runtime/intrinsics/js/encoding/TextDecoder$Options : ja public synthetic fun (ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Z public final fun component2 ()Z + public final fun copy (ZZ)Lelide/runtime/intrinsics/js/encoding/TextDecoder$Options; + public static synthetic fun copy$default (Lelide/runtime/intrinsics/js/encoding/TextDecoder$Options;ZZILjava/lang/Object;)Lelide/runtime/intrinsics/js/encoding/TextDecoder$Options; public fun equals (Ljava/lang/Object;)Z public final fun fatal ()Z public static final fun from (Lorg/graalvm/polyglot/Value;)Lelide/runtime/intrinsics/js/encoding/TextDecoder$Options; diff --git a/packages/graalvm/build.gradle.kts b/packages/graalvm/build.gradle.kts index 1f5f02d9d7..136bc9542a 100644 --- a/packages/graalvm/build.gradle.kts +++ b/packages/graalvm/build.gradle.kts @@ -156,12 +156,20 @@ sourceSets { val benchmarks by creating { kotlin.srcDirs( layout.projectDirectory.dir("src/benchmarks/kotlin"), - layout.projectDirectory.dir("src/main/kotlin"), ) } } } +if (enableBenchmarks) kotlin { + sourceSets { + val main by getting + val benchmarks by getting { + dependsOn(main) + } + } +} + val nativesRootTemplate: (String) -> String = { version -> "/tmp/elide-runtime/v$version/native" } @@ -371,8 +379,8 @@ graalvmNative { if (enableBenchmarks) benchmark { configurations { named("main") { - warmups = 10 - iterations = 5 + warmups = 3 + iterations = 2 } } targets { @@ -403,7 +411,6 @@ if (enableBenchmarks) { configurations.compileClasspath.get(), ) } - val benchmarksImplementation: Configuration by configurations.getting { extendsFrom( configurations.implementation.get(), @@ -416,6 +423,11 @@ if (enableBenchmarks) { configurations.testRuntimeOnly.get() ) } + + dependencies { + // Benchmarks + benchmarksRuntimeOnly(libs.kotlinx.benchmark.runtime) + } } dependencies { @@ -552,6 +564,8 @@ dependencies { val testBase: Configuration by configurations.creating tasks { + checkNatives(test, build) + test { maxHeapSize = "2G" maxParallelForks = 2 @@ -632,3 +646,19 @@ tasks { add("testBase", testJar) } } + +if (enableBenchmarks) afterEvaluate { + tasks.named("benchmarksBenchmark", JavaExec::class) { + systemProperty("java.library.path", StringBuilder().apply { + append(rootProject.layout.projectDirectory.dir("target/$nativesType").asFile.path) + append(File.pathSeparator) + append(nativesPath) + System.getProperty("java.library.path", "").let { + if (it.isNotEmpty()) { + append(File.pathSeparator) + append(it) + } + } + }.toString()) + } +} diff --git a/packages/graalvm/gradle.lockfile b/packages/graalvm/gradle.lockfile index 4af4d1bea5..b00169fa05 100644 --- a/packages/graalvm/gradle.lockfile +++ b/packages/graalvm/gradle.lockfile @@ -3,13 +3,13 @@ # This file is expected to be part of source control. com.amazonaws:aws-java-sdk-bom:1.12.734=compileClasspath,runtimeClasspath com.azure:azure-sdk-bom:1.2.24=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-annotations:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-core:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-databind:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson:jackson-bom:2.17.1=compileClasspath,runtimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson.core:jackson-core:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2=compileClasspath,runtimeClasspath +com.fasterxml.jackson:jackson-bom:2.17.2=compileClasspath,runtimeClasspath com.github.javaparser:javaparser-core:3.25.10=runtimeClasspath com.github.javaparser:javaparser-symbol-solver-core:3.25.10=runtimeClasspath com.github.oshi:oshi-core-java11:6.6.1=compileClasspath,runtimeClasspath @@ -187,15 +187,15 @@ org.graalvm.wasm:wasm-language:24.2.0-SNAPSHOT=runtimeClasspath org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -206,10 +206,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/graalvm/src/benchmarks/kotlin/.gitkeep b/packages/graalvm/src/benchmarks/kotlin/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/graalvm/src/benchmarks/kotlin/elide/core/EncodingsBench.kt b/packages/graalvm/src/benchmarks/kotlin/elide/core/EncodingsBench.kt new file mode 100644 index 0000000000..d69c4698ac --- /dev/null +++ b/packages/graalvm/src/benchmarks/kotlin/elide/core/EncodingsBench.kt @@ -0,0 +1,55 @@ +package elide.core + +import org.openjdk.jmh.annotations.* +import java.util.concurrent.TimeUnit.NANOSECONDS +import java.util.concurrent.TimeUnit.SECONDS +import elide.util.Base64 + +@State(Scope.Benchmark) +@BenchmarkMode(Mode.SampleTime) +@Timeout(time = 30, timeUnit = SECONDS) +@OutputTimeUnit(NANOSECONDS) +class EncodingsBench { + companion object { + private const val SAMPLE_TEXT = "Hello, world!" + private const val MEDIUM_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + private const val LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + private val SAMPLE_TEXT_BYTES = SAMPLE_TEXT.toByteArray() + private val MEDIUM_TEXT_BYTES = MEDIUM_TEXT.toByteArray() + private val LONG_TEXT_BYTES = LONG_TEXT.toByteArray() + } + + @CompilerControl(CompilerControl.Mode.DONT_INLINE) + private fun base64EncodeBytes(value: ByteArray): ByteArray { + return Base64.encode(value) + } + + @CompilerControl(CompilerControl.Mode.DONT_INLINE) + private fun base64EncodeString(value: String): String { + return Base64.encodeToString(value) + } + + @Benchmark fun base64EncodeBytesShort(): ByteArray { + return base64EncodeBytes(SAMPLE_TEXT_BYTES) + } + + @Benchmark fun base64EncodeBytesMedium(): ByteArray { + return base64EncodeBytes(MEDIUM_TEXT_BYTES) + } + + @Benchmark fun base64EncodeBytesLong(): ByteArray { + return base64EncodeBytes(LONG_TEXT_BYTES) + } + + @Benchmark fun base64EncodeStringShort(): String { + return base64EncodeString(SAMPLE_TEXT) + } + + @Benchmark fun base64EncodeStringMedium(): String { + return base64EncodeString(MEDIUM_TEXT) + } + + @Benchmark fun base64EncodeStringLong(): String { + return base64EncodeString(LONG_TEXT) + } +} diff --git a/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/AbstractStaticNativeLibraryFeature.kt b/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/AbstractStaticNativeLibraryFeature.kt index dbada6f0b0..445bc12862 100644 --- a/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/AbstractStaticNativeLibraryFeature.kt +++ b/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/AbstractStaticNativeLibraryFeature.kt @@ -92,9 +92,7 @@ public abstract class AbstractStaticNativeLibraryFeature : NativeLibraryFeature renameTo: ((String) -> String)? = null, cbk: (() -> Unit)? = null, ): List { - val nativesPath = requireNotNull(System.getProperty("elide.target")?.ifBlank { null }).let { - Path(it).resolve("lib").absolutePathString() - } + val nativesPath = requireNotNull(System.getProperty("elide.target")?.ifBlank { null }) val unpacked: LinkedList = LinkedList() for (candidate in path) { val stream = scanForResource(jar, candidate) ?: continue @@ -171,16 +169,23 @@ public abstract class AbstractStaticNativeLibraryFeature : NativeLibraryFeature if (it.builtin) { libSupport.preregisterUninitializedBuiltinLibrary(it.linkName) } - if (it.registerPrefix) { - it.prefix.forEach { prefix -> - platformLibs.addBuiltinPkgNativePrefix(prefix.replace(".", "_")) - } - } if (it.registerJni) (access as BeforeAnalysisAccessImpl).nativeLibraries.let { nativeLibraries -> + if (it.registerPrefix) { + it.prefix.forEach { prefix -> + platformLibs.addBuiltinPkgNativePrefix(prefix.replace(".", "_")) + } + } when (it.type) { STATIC -> nativeLibraries.addStaticJniLibrary(it.name, *it.deps.toTypedArray()) SHARED -> nativeLibraries.addDynamicNonJniLibrary(it.name) } + } else { + (access as BeforeAnalysisAccessImpl).nativeLibraries.let { nativeLibraries -> + when (it.type) { + STATIC -> nativeLibraries.addStaticNonJniLibrary(it.name, *it.deps.toTypedArray()) + SHARED -> nativeLibraries.addDynamicNonJniLibrary(it.name) + } + } } if (it.eager) { val absolute = it.absolutePath diff --git a/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/NativeSQLiteFeature.kt b/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/NativeSQLiteFeature.kt index cc1b286055..c7eee86660 100644 --- a/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/NativeSQLiteFeature.kt +++ b/packages/graalvm/src/main/kotlin/elide/runtime/feature/engine/NativeSQLiteFeature.kt @@ -29,20 +29,32 @@ import org.sqlite.util.LibraryLoaderUtil import org.sqlite.util.OSInfo import elide.annotations.internal.VMFeature import elide.runtime.feature.NativeLibraryFeature.NativeLibInfo +import elide.runtime.feature.NativeLibraryFeature.NativeLibType.STATIC /** Mounts the SQLite native library via static JNI. */ @VMFeature public class NativeSQLiteFeature : AbstractStaticNativeLibraryFeature() { private companion object { private const val STATIC_JNI = true + private const val LIBMATH = "m" + private const val SQLITE_LIB = "sqlite3" + private const val SQLITEJDBC_LIB = "sqlitejdbc" + private const val NATIVE_DB = "org.sqlite.core.NativeDB" } override fun getDescription(): String = "Registers native SQLite access" override fun nativeLibs(access: BeforeAnalysisAccess): List = if (STATIC_JNI) listOfNotNull( - nativeLibrary(singular = libraryNamed("sqlitejdbc", "org.sqlite.core.NativeDB", deps = ( - // on linux, we need to additionally link against the `math` library, which is at `libm` - if (Platform.includedIn(Platform.LINUX::class.java) && STATIC_JNI) listOf("m") else emptyList() - ))) + nativeLibrary(singular = libraryNamed( + SQLITE_LIB, + registerJni = false, + type = STATIC, + )), + nativeLibrary(singular = libraryNamed(SQLITEJDBC_LIB, NATIVE_DB, type = STATIC, deps = ( + listOf(SQLITE_LIB).plus( + // on linux, we need to additionally link against the `math` library, which is at `libm` + if (Platform.includedIn(Platform.LINUX::class.java) && STATIC_JNI) listOf(LIBMATH) else emptyList() + ) + ))), ) else emptyList() private fun onDbReachable() { diff --git a/packages/proto/proto-capnp/gradle.lockfile b/packages/proto/proto-capnp/gradle.lockfile index ea346d6811..5a5487f68f 100644 --- a/packages/proto/proto-capnp/gradle.lockfile +++ b/packages/proto/proto-capnp/gradle.lockfile @@ -14,14 +14,14 @@ jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath org.apache.commons:commons-compress:1.26.2=compileClasspath,runtimeClasspath org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath org.capnproto:runtime:0.1.18-elide=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -30,10 +30,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/proto/proto-core/build.gradle.kts b/packages/proto/proto-core/build.gradle.kts index 676fb2ea6a..658a258097 100644 --- a/packages/proto/proto-core/build.gradle.kts +++ b/packages/proto/proto-core/build.gradle.kts @@ -14,7 +14,6 @@ import elide.internal.conventions.kotlin.* plugins { - java kotlin("multiplatform") alias(libs.plugins.elide.conventions) } diff --git a/packages/proto/proto-core/gradle.lockfile b/packages/proto/proto-core/gradle.lockfile deleted file mode 100644 index cc19a08f46..0000000000 --- a/packages/proto/proto-core/gradle.lockfile +++ /dev/null @@ -1,42 +0,0 @@ -# This is a Gradle generated file for dependency locking. -# Manual edits can break the build and are not advised. -# This file is expected to be part of source control. -commons-codec:commons-codec:1.17.0=compileClasspath,runtimeClasspath -commons-io:commons-io:2.16.1=compileClasspath,runtimeClasspath -dev.elide:elide-uuid-core-jvm:2.0.0-Beta3-0.20.0-rc1=compileClasspath,runtimeClasspath -dev.elide:elide-uuid-core:2.0.0-Beta3-0.20.0-rc1=compileClasspath,runtimeClasspath -io.micronaut:micronaut-aop:4.5.3=compileClasspath,runtimeClasspath -io.micronaut:micronaut-context:4.5.3=compileClasspath,runtimeClasspath -io.micronaut:micronaut-core:4.5.3=compileClasspath,runtimeClasspath -io.micronaut:micronaut-inject:4.5.3=compileClasspath,runtimeClasspath -jakarta.annotation:jakarta.annotation-api:2.1.1=compileClasspath,runtimeClasspath -jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath -org.apache.commons:commons-compress:1.26.2=compileClasspath,runtimeClasspath -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-jdk9:1.9.0-RC=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath -org.jetbrains:annotations:24.1.0=compileClasspath,runtimeClasspath -org.reactivestreams:reactive-streams:1.0.3=runtimeClasspath -org.slf4j:slf4j-api:2.0.13=compileClasspath,runtimeClasspath -empty= diff --git a/packages/proto/proto-kotlinx/build.gradle.kts b/packages/proto/proto-kotlinx/build.gradle.kts index 7878555386..56ad093c33 100644 --- a/packages/proto/proto-kotlinx/build.gradle.kts +++ b/packages/proto/proto-kotlinx/build.gradle.kts @@ -16,7 +16,6 @@ import elide.internal.conventions.kotlin.* plugins { - java kotlin("multiplatform") kotlin("plugin.serialization") @@ -87,13 +86,3 @@ configurations { extendsFrom(configurations["jvmRuntimeClasspath"]) } } - -tasks.compileJava { - options.compilerArgumentProviders.add(CommandLineArgumentProvider { - listOf( - "--add-exports=elide.protocol.core/elide.proto=elide.protocol.kotlinx", - "--add-exports=elide.protocol.core/elide.proto.internal.annotations=elide.protocol.kotlinx", - "--add-reads=elide.protocol.kotlinx=ALL-UNNAMED" - ) - }) -} diff --git a/packages/proto/proto-kotlinx/gradle.lockfile b/packages/proto/proto-kotlinx/gradle.lockfile index ae3bd99053..fe88a198ab 100644 --- a/packages/proto/proto-kotlinx/gradle.lockfile +++ b/packages/proto/proto-kotlinx/gradle.lockfile @@ -13,15 +13,15 @@ jakarta.annotation:jakarta.annotation-api:2.1.1=runtimeClasspath jakarta.inject:jakarta.inject-api:2.0.1=runtimeClasspath org.apache.commons:commons-compress:1.26.2=runtimeClasspath org.apache.commons:commons-lang3:3.14.0=runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=runtimeClasspath @@ -30,10 +30,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/proto/proto-protobuf/gradle.lockfile b/packages/proto/proto-protobuf/gradle.lockfile index 57c651a6f4..d4baee0813 100644 --- a/packages/proto/proto-protobuf/gradle.lockfile +++ b/packages/proto/proto-protobuf/gradle.lockfile @@ -29,15 +29,15 @@ javax.annotation:jsr250-api:1.0=compileClasspath,runtimeClasspath org.apache.commons:commons-compress:1.26.2=runtimeClasspath org.apache.commons:commons-lang3:3.14.0=runtimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=runtimeClasspath @@ -46,10 +46,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=runtimeClasspath diff --git a/packages/server/gradle.lockfile b/packages/server/gradle.lockfile index 8db3cfedc0..05d20417a1 100644 --- a/packages/server/gradle.lockfile +++ b/packages/server/gradle.lockfile @@ -3,13 +3,19 @@ # This file is expected to be part of source control. com.amazonaws:aws-java-sdk-bom:1.12.734=compileClasspath,runtimeClasspath com.azure:azure-sdk-bom:1.2.24=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-annotations:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-core:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.core:jackson-databind:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1=compileClasspath,runtimeClasspath -com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1=runtimeClasspath -com.fasterxml.jackson:jackson-bom:2.17.1=compileClasspath,runtimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.17.1=compileClasspath +com.fasterxml.jackson.core:jackson-annotations:2.17.2=runtimeClasspath +com.fasterxml.jackson.core:jackson-core:2.17.1=compileClasspath +com.fasterxml.jackson.core:jackson-core:2.17.2=runtimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.17.1=compileClasspath +com.fasterxml.jackson.core:jackson-databind:2.17.2=runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1=compileClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2=runtimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1=compileClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2=runtimeClasspath +com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2=runtimeClasspath +com.fasterxml.jackson:jackson-bom:2.17.1=compileClasspath +com.fasterxml.jackson:jackson-bom:2.17.2=runtimeClasspath com.github.javaparser:javaparser-core:3.25.10=runtimeClasspath com.github.javaparser:javaparser-symbol-solver-core:3.25.10=runtimeClasspath com.github.oshi:oshi-core-java11:6.6.1=runtimeClasspath @@ -192,15 +198,15 @@ org.jdbi:jdbi3-bom:3.45.1=compileClasspath,runtimeClasspath org.jetbrains.kotlin-wrappers:kotlin-css-jvm:1.0.0-pre.754=compileClasspath,runtimeClasspath org.jetbrains.kotlin-wrappers:kotlin-css:1.0.0-pre.754=compileClasspath,runtimeClasspath org.jetbrains.kotlin:kotlin-bom:1.9.24=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-reflect:2.0.20-Beta1=runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20-Beta1=compileClasspath,runtimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:2.0.20-Beta1=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.0.10-RC=runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10-RC=compileClasspath,runtimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu-jvm:0.24.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:atomicfu:0.24.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.4-wasm1=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-collections-immutable:0.4-wasm1=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0-RC=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC=compileClasspath,runtimeClasspath @@ -213,10 +219,10 @@ org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.9.0-RC=runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-datetime:0.6.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-html-jvm:0.11.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-bytestring:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0=compileClasspath,runtimeClasspath -org.jetbrains.kotlinx:kotlinx-io-core:0.4.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-bytestring:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.5.0=compileClasspath,runtimeClasspath +org.jetbrains.kotlinx:kotlinx-io-core:0.5.0=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.1=compileClasspath,runtimeClasspath org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1=compileClasspath,runtimeClasspath diff --git a/packages/sqlite/src/main/java/org/sqlite/SQLiteJDBCLoader.java b/packages/sqlite/src/main/java/org/sqlite/SQLiteJDBCLoader.java index 0fd4ec452f..c14f79328f 100644 --- a/packages/sqlite/src/main/java/org/sqlite/SQLiteJDBCLoader.java +++ b/packages/sqlite/src/main/java/org/sqlite/SQLiteJDBCLoader.java @@ -24,6 +24,7 @@ // -------------------------------------- package org.sqlite; +import org.graalvm.nativeimage.ImageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sqlite.util.LibraryLoaderUtil; @@ -300,6 +301,20 @@ private static void loadSQLiteNativeLibrary() throws Exception { } logger.trace("Loading SQLite native library"); + if (ImageInfo.inImageCode() && ImageInfo.isExecutable()) { + // try loading as the umbrella library first + try { + System.loadLibrary("umbrella"); + + // if we get this far, we should return and mark it as loaded + extracted = true; + return; + } catch (Throwable err) { + // we ignore this error because the library could be provided at `libsqlitejdbc` as well + logger.trace("SQLite could not be loaded via umbrella lib"); + } + } + // As a first step, try loading through System.loadLibrary if (loadNativeLibraryJdk()) { logger.trace("SQLite loaded via JNI (attempt 1)"); @@ -374,7 +389,8 @@ private static void loadSQLiteNativeLibrary() throws Exception { extracted = false; throw new NativeLibraryNotFoundException( String.format( - "No native library found for os.name=%s, os.arch=%s, paths=[%s]", + "No native library found for name '%s', os.name=%s, os.arch=%s, paths=[%s]", + sqliteNativeLibraryName, OSInfo.getOSName(), OSInfo.getArchName(), StringUtils.join(triedPaths, File.pathSeparator))); diff --git a/packages/uuid b/packages/uuid index 28155765f3..78b2992c46 160000 --- a/packages/uuid +++ b/packages/uuid @@ -1 +1 @@ -Subproject commit 28155765f33a31d7595e024af99e23a044347c6e +Subproject commit 78b2992c46738ea0a6e6a775d67f7f804a1ddb55 diff --git a/requirements.txt b/requirements.txt index 064745096d..6d4c5a81a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -flask==3.0.3 +ruff==0.5.2 diff --git a/samples/fullstack/react-ssr/server/build.gradle.kts b/samples/fullstack/react-ssr/server/build.gradle.kts index 457f58c18b..f1316e5053 100644 --- a/samples/fullstack/react-ssr/server/build.gradle.kts +++ b/samples/fullstack/react-ssr/server/build.gradle.kts @@ -14,7 +14,7 @@ import tools.elide.assets.ManifestFormat plugins { kotlin("jvm") kotlin("kapt") - kotlin("plugin.serialization") version "2.0.20-Beta1" + kotlin("plugin.serialization") version "2.0.10-RC" id("dev.elide.buildtools.plugin") id("io.micronaut.application") id("io.micronaut.docker") diff --git a/settings.gradle.kts b/settings.gradle.kts index 8af2cae4fb..3cf21a1df6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -126,17 +126,6 @@ dependencyResolutionManagement { includeGroup("org.jetbrains.dokka") } } - maven { - name = "wasm-dev" - url = uri("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") - content { - includeGroup("io.ktor") - includeGroup("org.jetbrains.compose") - includeGroup("org.jetbrains.compose.compiler") - includeGroup("org.jetbrains.kotlin") - includeGroup("org.jetbrains.kotlinx") - } - } maven { name = "compose-dev" url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev/") @@ -226,50 +215,51 @@ if (buildPkl == "true") { // Build modules. include( + ":crates:base", ":crates:builder", - ":crates:core", ":crates:deps", ":crates:entry", ":crates:model", + ":crates:project", + ":crates:protocol", ":crates:sqlite", ":crates:substrate", ":crates:terminal", ":crates:transport", ":packages:base", + ":packages:bom", ":packages:cli", - ":packages:cli-bridge", ":packages:core", ":packages:engine", ":packages:graalvm", - ":packages:graalvm-ts", + ":packages:graalvm-java", ":packages:graalvm-jvm", + ":packages:graalvm-kt", ":packages:graalvm-llvm", - ":packages:graalvm-wasm", ":packages:graalvm-py", ":packages:graalvm-rb", - ":packages:graalvm-kt", - ":packages:graalvm-java", + ":packages:graalvm-ts", + ":packages:graalvm-wasm", ":packages:http", - ":packages:proto:proto-core", - ":packages:proto:proto-test", + ":packages:platform", ":packages:proto:proto-capnp", + ":packages:proto:proto-core", ":packages:proto:proto-kotlinx", ":packages:proto:proto-protobuf", - ":packages:platform", - ":packages:bom", + ":packages:proto:proto-test", ":packages:server", - ":packages:ssr", - ":packages:test", ":packages:sqlite", + ":packages:ssr", ":packages:tcnative", ":packages:terminal", + ":packages:test", ":packages:tooling", ":packages:transport:transport-common", ":packages:transport:transport-epoll", ":packages:transport:transport-kqueue", ":packages:transport:transport-uring", - ":tools:umbrella", ":tools:reports", + ":tools:umbrella", ) val buildDeprecated: String by settings diff --git a/third_party/Makefile b/third_party/Makefile index 6905253a15..316a2547fd 100644 --- a/third_party/Makefile +++ b/third_party/Makefile @@ -19,9 +19,16 @@ CUSTOM_ZLIB ?= no NATIVE ?= no RELEASE ?= no USE_NINJA ?= yes +ENABLE_CCACHE ?= yes +ENABLE_SCCACHE ?= yes ELIDE_ROOT ?= $(realpath $(shell pwd)/..) MACOS_MIN_VERSION ?= 12.3 +NATIVE_TOOLS ?= sqlite boringssl apr +LANGS ?= pkl + +REQUIRED ?= zlib sqlite boringssl apr + ifeq ($(RELEASE),yes) TARGET_ROOT ?= $(ELIDE_ROOT)/target/release else @@ -47,13 +54,15 @@ CLANG ?= $(shell which clang) OS ?= $(shell uname -s) UNAME_P := $(shell uname -p) -CMAKE_BUILD = $(MAKE) -j`nproc` +CMAKE_BUILD = $(MAKE) CMAKE_INSTALL = $(MAKE) install +JOBS ?= $(shell nproc) + ifneq ($(NINJA),) ifeq ($(USE_NINJA),yes) EXTRA_CMAKE_FLAGS += -GNinja -CMAKE_BUILD = $(NINJA) -j`nproc` +CMAKE_BUILD = $(NINJA) -j$(JOBS) CMAKE_INSTALL = $(NINJA) install endif endif @@ -62,6 +71,23 @@ ifeq ($(OS),Darwin) EXTRA_CMAKE_FLAGS += -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_OSX_DEPLOYMENT_TARGET=$(MACOS_MIN_VERSION) endif +CCACHE ?= $(shell which ccache) +SCCACHE ?= $(shell which sccache) + +ifeq ($(ENABLE_SCCACHE),yes) +ifneq ($(SCCACHE),) +CC_INJECTED ?= $(SCCACHE) $(CC) +EXTRA_CMAKE_FLAGS += -DCMAKE_C_COMPILER_LAUNCHER=$(SCCACHE) -DCMAKE_CXX_COMPILER_LAUNCHER=$(SCCACHE) +endif +else ifeq ($(ENABLE_CCACHE),yes) +ifneq ($(CCACHE),) +CC_INJECTED ?= $(CCACHE) $(CC) +EXTRA_CMAKE_FLAGS += -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) -DCMAKE_CXX_COMPILER_LAUNCHER=$(CCACHE) +endif +else +CC_INJECTED ?= $(CC) +endif + GRADLE ?= ./gradlew CFLAGS_BASE_ALL ?=-g -O2 -fPIC -fPIE -fno-omit-frame-pointer -DELIDE -DHAVE_OPENSSL -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS $(CFLAGS) @@ -135,16 +161,11 @@ endif GRADLE_ARGS ?= -x test -x check LIBROOT ?= lib/ -NATIVE_TOOLS ?= sqlite boringssl apr -LANGS ?= pkl - -REQUIRED ?= zlib sqlite boringssl apr - ifeq ($(CUSTOM_ZLIB),yes) -ZLIB_TARGET ?= cloudflare/zlib/target +ZLIB_TARGET ?= cloudflare/zlib/libz.a ZLIB_SRC ?= cloudflare/zlib else -ZLIB_TARGET ?= madler/zlib/target +ZLIB_TARGET ?= madler/zlib/libz.a ZLIB_SRC ?= madler/zlib endif @@ -172,12 +193,12 @@ apple/pkl/build: apr: apache/apr/.libs CFLAGS_APR ?= -CFLAGS_APR +=$(CFLAGS_BASE) $(CFLAGS_LTO) -I$(TARGET_ROOT)/include -Wno-macro-redefined -Wno-tautological-type-limit-compare -LDFLAGS_APR ?=-L$(TARGET_ROOT)/lib -lssl -lcrypto +CFLAGS_APR +=$(CFLAGS_BASE) $(CFLAGS_LTO) -I$(ELIDE_ROOT)/third_party/google/boringssl/include -Wno-macro-redefined -Wno-tautological-type-limit-compare +LDFLAGS_APR ?=-L$(ELIDE_ROOT)/third_party/google/boringssl/build -lssl -lcrypto LDFLAGS_APR +=$(LDFLAGS_BASE) # APR does not link with LLD. -APR_PREFIX = CC="$(CC)" CXX="$(CXX)" LD="ld" CFLAGS="$(CFLAGS_APR)" LDFLAGS="$(LDFLAGS_APR)" +APR_PREFIX = CC="$(CC_INJECTED)" CXX="$(CXX)" LD="ld" CFLAGS="$(CFLAGS_APR)" LDFLAGS="$(LDFLAGS_APR)" apache/apr/.libs: google/boringssl/build @echo "" @@ -190,8 +211,7 @@ apache/apr/.libs: google/boringssl/build --enable-threads \ --enable-posix-shm \ --enable-sysv-shm \ - && $(APR_PREFIX) make -j`nproc` \ - && $(APR_PREFIX) make install + && $(APR_PREFIX) make clean-apr: $(RULE)cd apache/apr && git clean -xdf @@ -217,19 +237,15 @@ google/boringssl/build: $(RULE)cd google/boringssl && mkdir build && cd build \ && $(BORINGSSL_PREFIX) $(CMAKE) $(CMAKE_BORINGSSL) -DCMAKE_INSTALL_PREFIX=$(TARGET_ROOT) .. \ && $(BORINGSSL_PREFIX) $(CMAKE_BUILD) \ - && $(BORINGSSL_PREFIX) $(CMAKE_INSTALL) \ && ./ssl_test \ - && echo "Mounting BoringSSL libs..." \ - && mkdir -p $(TARGET_ROOT)/lib/boringssl \ && cd .. \ - && cp -fr ./build $(TARGET_ROOT)/lib/boringssl/ \ && echo "BoringSSL is ready." CFLAGS_ZLIB ?= CFLAGS_ZLIB +=$(CFLAGS_BASE) $(CFLAGS_BASE_STRICT) -std=c11 LDFLAGS_ZLIB ?= LDFLAGS_ZLIB +=$(LDFLAGS_BASE) -ZLIB_PREFIX = CC="$(CC)" CXX="$(CXX)" LD="$(LD)" CFLAGS="$(CFLAGS_ZLIB)" LDFLAGS="$(LDFLAGS_ZLIB)" +ZLIB_PREFIX = CC="$(CC_INJECTED)" CXX="$(CXX)" LD="$(LD)" CFLAGS="$(CFLAGS_ZLIB)" LDFLAGS="$(LDFLAGS_ZLIB)" ZLIB_CONFIGURE ?= --const --prefix=$(TARGET_ROOT) --static --64 zlib: $(ZLIB_TARGET) @@ -242,37 +258,12 @@ $(ZLIB_TARGET): @echo "Configuring zlib..." $(RULE)cd $(ZLIB_SRC) \ && $(ZLIB_PREFIX) ./configure $(ZLIB_CONFIGURE) \ - && $(ZLIB_PREFIX) make -j`nproc` \ - && $(ZLIB_PREFIX) make install \ - && cp -fv $(TARGET_ROOT)/lib/libz* $(TARGET_ROOT) + && $(ZLIB_PREFIX) make -SQLITE3_CONFIGURE ?=--enable-all --enable-memsys5 --enable-update-limit --enable-tempstore=yes --enable-debug +SQLITE3_CONFIGURE ?=--enable-all --enable-memsys5 --enable-update-limit --enable-tempstore=yes --enable-debug --enable-static --enable-shared --with-pic CFLAGS_SQLITE3 ?=$(CFLAGS_BASE) -SQLITE3_SETTINGS += -DSQLITE_CORE=1 \ - -DSQLITE_DEFAULT_FILE_PERMISSIONS=0666 \ - -DSQLITE_DEFAULT_MEMSTATUS=0 \ - -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1 \ - -DSQLITE_ENABLE_API_ARMOR=1 \ - -DSQLITE_ENABLE_COLUMN_METADATA=1 \ - -DSQLITE_ENABLE_DBSTAT_VTAB=1 \ - -DSQLITE_ENABLE_FTS3=1 \ - -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 \ - -DSQLITE_ENABLE_FTS5=1 \ - -DSQLITE_ENABLE_LOAD_EXTENSION=1 \ - -DSQLITE_ENABLE_MATH_FUNCTIONS=1 \ - -DSQLITE_ENABLE_RTREE=1 \ - -DSQLITE_ENABLE_STAT4=1 \ - -DSQLITE_HAVE_ISNAN=1 \ - -DSQLITE_MAX_ATTACHED=125 \ - -DSQLITE_MAX_COLUMN=32767 \ - -DSQLITE_MAX_FUNCTION_ARG=127 \ - -DSQLITE_MAX_LENGTH=2147483647 \ - -DSQLITE_MAX_MMAP_SIZE=1099511627776 \ - -DSQLITE_MAX_PAGE_COUNT=4294967294 \ - -DSQLITE_MAX_SQL_LENGTH=1073741824 \ - -DSQLITE_MAX_VARIABLE_NUMBER=250000 \ - -DSQLITE_THREADSAFE=1 +SQLITE3_SETTINGS += -DSQLITE_CORE=1 -DSQLITE_DEFAULT_FILE_PERMISSIONS=0666 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_HAVE_ISNAN=1 -DSQLITE_MAX_ATTACHED=125 -DSQLITE_MAX_COLUMN=32767 -DSQLITE_MAX_FUNCTION_ARG=127 -DSQLITE_MAX_LENGTH=2147483647 -DSQLITE_MAX_MMAP_SIZE=1099511627776 -DSQLITE_MAX_PAGE_COUNT=4294967294 -DSQLITE_MAX_SQL_LENGTH=1073741824 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_THREADSAFE=1 ifeq ($(OS),Darwin) CFLAGS_SQLITE3 +=$(CFLAGS_BASE) -Wno-array-bounds -Wno-format-nonliteral -Wno-array-bounds-pointer-arithmetic -Wno-assign-enum -Wno-implicit-fallthrough -Wno-tautological-constant-in-range-compare $(SQLITE3_SETTINGS) @@ -284,7 +275,7 @@ LDFLAGS_SQLITE3 ?= LDFLAGS_SQLITE3 +=$(LDFLAGS_BASE) # SQLite does not link under LLD. -SQLITE3_PREFIX = CC="$(CC)" CXX="$(CXX)" LD="ld" CFLAGS="$(CFLAGS_SQLITE3)" LDFLAGS="$(LDFLAGS_SQLITE3)" +SQLITE3_PREFIX = CC="$(CC_INJECTED)" CXX="$(CXX)" LD="ld" CFLAGS="$(CFLAGS_SQLITE3)" LDFLAGS="$(LDFLAGS_SQLITE3)" sqlite: sqlite/sqlite3.c @@ -293,17 +284,16 @@ sqlite-clean: sqlite/Makefile: @echo "" - @echo "Configuring sqlite3 amalgamation..." - $(RULE)cd sqlite && $(SQLITE3_PREFIX) ./configure --prefix=$(TARGET_ROOT) $(SQLITE3_CONFIGURE) + @echo "Configuring sqlite3..." + $(RULE)cd sqlite && $(SQLITE3_PREFIX) ./configure --prefix=`pwd`/install $(SQLITE3_CONFIGURE) sqlite/sqlite3.c: sqlite/Makefile @echo "" - @echo "Building sqlite3 amalgamation..." + @echo "Building sqlite3..." $(RULE)cd sqlite \ - && $(SQLITE3_PREFIX) $(MAKE) -j`nproc` \ - && $(SQLITE3_PREFIX) $(MAKE) -j`nproc` sqlite3.c \ - && $(SQLITE3_PREFIX) $(MAKE) install \ - && cp -fv $(TARGET_ROOT)/lib/libsqlite* $(TARGET_ROOT) + && $(SQLITE3_PREFIX) $(MAKE) OPTS="$(SQLITE3_SETTINGS)" sqlite3.c \ + && $(SQLITE3_PREFIX) $(MAKE) OPTS="$(SQLITE3_SETTINGS)" \ + && $(SQLITE3_PREFIX) $(MAKE) OPTS="$(SQLITE3_SETTINGS)" install GVM_BUILD_PREFIX ?= JAVA_HOME="$$HOME/.mx/jdks/$(LABS_JDK)/Contents/Home" @@ -380,14 +370,18 @@ clean: apache/apr/target \ google/boringssl/build \ $(LIBROOT) - $(RULE)-cd sqlite && $(MAKE) clean && rm -fv Makefile sqlite3.c + $(RULE)-cd sqlite && $(MAKE) clean && rm -fv Makefile sqlite3.c && git clean -xdf $(RULE)-cd google/boringssl && rm -fr build $(RULE)-cd apache/apr && git clean -xdf $(RULE)-cd cloudflare/zlib && make clean && git clean -xdf + $(RULE)-cd madler/zlib && make clean && git clean -xdf gvm-clean: $(RULE)-cd oracle/graalvm/vm && $(GVM_BUILD_PREFIX) $(MX) clean distclean: clean gvm-clean +help: + @echo "Please use the main project Makefile." + .PHONY: all pkl google libroot diff --git a/tools/conventions/src/main/kotlin/dev.elide.build.kotlin.gradle.kts b/tools/conventions/src/main/kotlin/dev.elide.build.kotlin.gradle.kts index b041d11714..0f9680f38f 100644 --- a/tools/conventions/src/main/kotlin/dev.elide.build.kotlin.gradle.kts +++ b/tools/conventions/src/main/kotlin/dev.elide.build.kotlin.gradle.kts @@ -93,7 +93,7 @@ extensions.configure { configurations.all { resolutionStrategy.eachDependency { if (requested.group == "org.jetbrains.kotlin" && requested.name.contains("stdlib")) { - useVersion(kotlinVersion ?: "2.0.20-Beta1") + useVersion(kotlinVersion ?: "2.0.10-RC") because("pin kotlin stdlib") } } diff --git a/tools/elide-build/gradle/wrapper/gradle-wrapper.properties b/tools/elide-build/gradle/wrapper/gradle-wrapper.properties index 1e6f052720..09cc9a3101 100644 --- a/tools/elide-build/gradle/wrapper/gradle-wrapper.properties +++ b/tools/elide-build/gradle/wrapper/gradle-wrapper.properties @@ -13,7 +13,7 @@ distributionBase = GRADLE_USER_HOME distributionPath = wrapper/dists -distributionUrl = https://dl.less.build/toolchains/gradle/gradle-8.9-rc-2-bin.zip +distributionUrl = https://dl.less.build/toolchains/gradle/gradle-8.9-bin.zip networkTimeout = 10000 validateDistributionUrl = true zipStoreBase = GRADLE_USER_HOME diff --git a/tools/elide-build/src/main/kotlin/elide/internal/conventions/Constants.kt b/tools/elide-build/src/main/kotlin/elide/internal/conventions/Constants.kt index 49aa159afd..a417e97860 100644 --- a/tools/elide-build/src/main/kotlin/elide/internal/conventions/Constants.kt +++ b/tools/elide-build/src/main/kotlin/elide/internal/conventions/Constants.kt @@ -90,7 +90,7 @@ public object Constants { const val KOTLIN = "versions.kotlin.language" /** Constant: default Kotlin SDK version if no other version is defined. */ - const val KOTLIN_SDK_PIN = "2.0.20-Beta1" + const val KOTLIN_SDK_PIN = "2.0.10-RC" /** Constant: pinned version of Kotlin Coroutines. */ const val COROUTINES = "1.9.0-RC" @@ -233,7 +233,6 @@ public object Constants { "-Xskip-prerelease-check", "-Xexpect-actual-classes", "-Xsuppress-version-warnings", - "-Xconsistent-data-class-copy-visibility", ) /** Compiler args to include in Kotlin JVM targets. */ diff --git a/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/DetektConventionsPlugin.kt b/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/DetektConventionsPlugin.kt index 077213c74b..bec4ea5118 100644 --- a/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/DetektConventionsPlugin.kt +++ b/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/DetektConventionsPlugin.kt @@ -49,7 +49,6 @@ private fun DetektExtension.configureDetektForProject(conventions: ElideBuildExt } project.tasks.withType(Detekt::class) detekt@{ - finalizedBy(detektMergeSarif, detektMergeXml) reports.sarif.required = true reports.xml.required = true reports.sarif.outputLocation.set(project.layout.buildDirectory.file("reports/detekt/detekt.sarif")) @@ -66,6 +65,9 @@ private fun DetektExtension.configureDetektForProject(conventions: ElideBuildExt project.tasks.withType(DetektCreateBaselineTask::class) detekt@{ jvmTarget = if (conventions.jvm.forceJvm17) "17" else "21" // @TODO pull from property state } + project.tasks.withType(Detekt::class) detektReports@{ + finalizedBy(detektMergeSarif, detektMergeXml) + } } public class DetektConventionsPlugin : Plugin { diff --git a/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/SonarConventionsPlugin.kt b/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/SonarConventionsPlugin.kt index dc89fcbedf..8681ec0730 100644 --- a/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/SonarConventionsPlugin.kt +++ b/tools/elide-build/src/main/kotlin/elide/internal/conventions/linting/SonarConventionsPlugin.kt @@ -76,15 +76,22 @@ private fun List.filterExistsInLayout(layout: Directory): String? { } private fun SonarExtension.configureSonarForProject(conventions: ElideBuildExtension, project: Project) { + // skip unrelated projects + if (project.path.contains("crates")) { + isSkipProject = true + return + } + // cancel if skipped or non-kotlin/non java if ((!conventions.kotlin.requested && !conventions.java.requested) || !conventions.checks.sonar) return val target = conventions.kotlin.target val isJvm = target != null && JVM in target val isMultiplatform = target != null && (Native in target || KotlinTarget.Embedded == target) val isJavascript = target != null && (JsNode in target || JsBrowser in target) - val projectPath = project.projectDir.relativeTo(project.rootDir).toPath().toString() + val projectPath = project.projectDir.absolutePath properties { + property("sonar.verbose", "true") when { isMultiplatform -> { project.logger.lifecycle("Configuring Sonar Kotlin/MPP for project: ${project.name}") @@ -94,9 +101,7 @@ private fun SonarExtension.configureSonarForProject(conventions: ElideBuildExten property("sonar.junit.reportsPath", "build/test-results/jvmTest/") property("sonar.coverage.jacoco.xmlReportPaths", listOf( "$projectPath/build/reports/kover/report.xml", - "build/reports/kover/report.xml", "$projectPath/build/reports/jacoco/test/jacocoTestReport.xml", - "build/reports/jacoco/test/jacocoTestReport.xml", ).joinToString(",")) } @@ -104,6 +109,7 @@ private fun SonarExtension.configureSonarForProject(conventions: ElideBuildExten project.logger.lifecycle("Configuring Sonar Kotlin/JS for project: ${project.name}") property("sonar.sources", "src/jsMain/kotlin") property("sonar.tests", "src/jsTest/kotlin") + property("sonar.java.binaries", "build/classes/kotlin/js/main") property("sonar.coverage.jacoco.xmlReportPaths", "$projectPath/build/reports/kover/report.xml") } @@ -111,19 +117,24 @@ private fun SonarExtension.configureSonarForProject(conventions: ElideBuildExten project.logger.lifecycle("Configuring Sonar Kotlin/JVM for project: ${project.name}") jvmSrcs.filterExistsInLayout(project.layout.projectDirectory)?.let { property("sonar.sources", it) } jvmTestSrcs.filterExistsInLayout(project.layout.projectDirectory)?.let { property("sonar.tests", it) } - property("sonar.java.binaries", "build/classes/kotlin/main") + + (listOf( + "classes/kotlin/main", + "classes/java/main", + "classes/kotlin/jvm/main", + ).find { + project.layout.buildDirectory.dir(it).get().asFile.exists() + } ?: error("Failed to resolve `sonar.java.binaries` for project at '${project.path}'")).let { binPath -> + property("sonar.java.binaries", "build/$binPath") + } + property("sonar.junit.reportsPath", "build/test-results/test/") property("sonar.coverage.jacoco.xmlReportPaths", listOf( "$projectPath/build/reports/kover/report.xml", - "build/reports/kover/report.xml", "$projectPath/build/reports/kover/xml/coverage.xml", - "build/reports/kover/xml/coverage.xml", "$projectPath/build/reports/jacoco/test/jacocoTestReport.xml", - "build/reports/jacoco/test/jacocoTestReport.xml", "$projectPath/build/reports/jacoco/testCodeCoverageReport/jacocoTestReport.xml", - "build/reports/jacoco/testCodeCoverageReport/jacocoTestReport.xml", "$projectPath/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml", - "build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml", ).joinToString(",")) } diff --git a/tools/elide-build/src/main/kotlin/org/gradle/kotlin/dsl/ElideConventionsDsl.kt b/tools/elide-build/src/main/kotlin/org/gradle/kotlin/dsl/ElideConventionsDsl.kt index 57e390943b..7be2068a09 100644 --- a/tools/elide-build/src/main/kotlin/org/gradle/kotlin/dsl/ElideConventionsDsl.kt +++ b/tools/elide-build/src/main/kotlin/org/gradle/kotlin/dsl/ElideConventionsDsl.kt @@ -14,9 +14,62 @@ package org.gradle.kotlin.dsl import org.gradle.api.Project +import org.gradle.api.tasks.TaskProvider +import org.jetbrains.kotlin.konan.target.HostManager +import java.nio.file.Files +import java.nio.file.Path import elide.internal.conventions.ElideBuildExtension import elide.internal.conventions.ElideConventionPlugin +public fun Project.checkNatives(vararg needs: TaskProvider<*>, enforce: Boolean = true) { + val quickbuild = ( + project.properties["elide.release"] != "true" || + project.properties["elide.buildMode"] == "dev" + ) + val isRelease = !quickbuild && ( + project.properties["elide.release"] == "true" || + project.properties["elide.buildMode"] == "release" + ) + val checkNative by tasks.registering { + group = "build" + description = "Check native libraries required for build/test" + doFirst { + val targetRoot = Path.of( + rootProject.layout.projectDirectory.dir("target").asFile.path + ).resolve(if (isRelease) "release" else "debug") + + val sqliteLibRoot = rootProject.layout.projectDirectory.dir("third_party/sqlite/install/lib").asFile.toPath() + val ext = when { + HostManager.hostIsMingw -> "dll" + HostManager.hostIsMac -> "dylib" + else -> "so" + } + val sqliteLib = targetRoot.resolve("libsqlitejdbc.$ext") + + listOf( + targetRoot, + sqliteLib, + sqliteLibRoot, + ).forEach { + if (!Files.exists(it)) { + val isThirdParty = it.toString().contains("third_party") + val advice = if (isThirdParty) { + "Please build third-party natives with 'make natives'." + } else { + "Please build Elide's native layer with 'make natives' or 'cargo build'." + } + + error( + "Required path does not exist: '$it'. $advice" + ) + } + } + } + } + if (enforce) { + needs.forEach { it.configure { dependsOn(checkNative) } } + } +} public fun Project.elide(block: ElideBuildExtension.() -> Unit) { plugins.getPlugin(ElideConventionPlugin::class.java).applyElideConventions(this, block) diff --git a/tools/plugin/gradle-plugin/build.gradle.kts b/tools/plugin/gradle-plugin/build.gradle.kts index cc6ff7ee6b..b4f968fd0a 100644 --- a/tools/plugin/gradle-plugin/build.gradle.kts +++ b/tools/plugin/gradle-plugin/build.gradle.kts @@ -15,7 +15,7 @@ import java.util.* plugins { java - kotlin("kapt") version "2.0.20-Beta1" apply false + kotlin("kapt") version "2.0.10-RC" apply false alias(libs.plugins.ksp) apply false alias(libs.plugins.kover) alias(libs.plugins.detekt) diff --git a/tools/plugin/gradle-plugin/gradle/libs.versions.toml b/tools/plugin/gradle-plugin/gradle/libs.versions.toml index ae3ad6b227..84a96820cb 100644 --- a/tools/plugin/gradle-plugin/gradle/libs.versions.toml +++ b/tools/plugin/gradle-plugin/gradle/libs.versions.toml @@ -3,7 +3,7 @@ elide = "1.0.0-alpha10" elideTools = "1.0.0-alpha10" ksp = "2.0.0-1.0.21" detekt = "1.23.6" -kotlin = "2.0.20-Beta1" +kotlin = "2.0.10-RC" kotlin_dsl = "4.0.7" kotlinx_coroutines = "1.8.0" kotlinx_collections = "0.3.5" diff --git a/tools/plugin/gradle-plugin/plugin-build/buildSrc/build.gradle.kts b/tools/plugin/gradle-plugin/plugin-build/buildSrc/build.gradle.kts index c94070fd35..6d1a3ddcba 100644 --- a/tools/plugin/gradle-plugin/plugin-build/buildSrc/build.gradle.kts +++ b/tools/plugin/gradle-plugin/plugin-build/buildSrc/build.gradle.kts @@ -15,7 +15,7 @@ "DSL_SCOPE_VIOLATION", ) -val kotlinVersion = "2.0.20-Beta1" +val kotlinVersion = "2.0.10-RC" val javaVersion = "21" plugins { diff --git a/tools/scripts/bench-cli.sh b/tools/scripts/bench-cli.sh index bff9ea509a..9ac90d0563 100755 --- a/tools/scripts/bench-cli.sh +++ b/tools/scripts/bench-cli.sh @@ -1,5 +1,18 @@ #!/bin/env bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + source ./tools/scripts/bench-common.sh # Resolved Elide binary diff --git a/tools/scripts/bench-common.sh b/tools/scripts/bench-common.sh index 742654817e..8a348981e6 100755 --- a/tools/scripts/bench-common.sh +++ b/tools/scripts/bench-common.sh @@ -1,3 +1,16 @@ +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + # # Include this file from a `bench-x.sh` script, as a relative path from the project root. # diff --git a/tools/scripts/bench-server.sh b/tools/scripts/bench-server.sh index edfe3fc4e5..de31feecfc 100755 --- a/tools/scripts/bench-server.sh +++ b/tools/scripts/bench-server.sh @@ -1,5 +1,18 @@ #!/bin/env bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + source ./tools/scripts/bench-common.sh # Resolved Elide binary diff --git a/tools/scripts/build-release-debug.sh b/tools/scripts/build-release-debug.sh index 7eebc62aef..2d9b5c8f97 100755 --- a/tools/scripts/build-release-debug.sh +++ b/tools/scripts/build-release-debug.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + version=$(cat ./.release) platform=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) diff --git a/tools/scripts/build-release-opt.sh b/tools/scripts/build-release-opt.sh index 71ebd1a7ac..3d5ad1fc26 100755 --- a/tools/scripts/build-release-opt.sh +++ b/tools/scripts/build-release-opt.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + version=$(cat ./.release) platform=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) diff --git a/tools/scripts/build-releases.sh b/tools/scripts/build-releases.sh index 15b4619fb1..21f5ac0015 100755 --- a/tools/scripts/build-releases.sh +++ b/tools/scripts/build-releases.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + echo "Building 'debug' release artifacts..." bash ./tools/scripts/build-release-debug.sh diff --git a/tools/scripts/cargo-coverage-report.sh b/tools/scripts/cargo-coverage-report.sh new file mode 100755 index 0000000000..cc2aa0396a --- /dev/null +++ b/tools/scripts/cargo-coverage-report.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +# Export to lcov +echo "Exporting coverage to lcov..." +llvm-cov export \ + $( + for file in \ + $( + RUSTFLAGS="-C instrument-coverage" \ + cargo test --tests --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - + ); do + printf "%s %s " -object $file + done + ) \ + --format=lcov \ + --ignore-filename-regex='/.cargo/registry' \ + --ignore-filename-regex='/.cargo/git' \ + --ignore-filename-regex='builder' \ + --ignore-filename-regex='rustc' \ + --ignore-filename-regex='out/' \ + --instr-profile=./target/profiles/elide-rust.profdata \ + --Xdemangler=rustfilt \ + -sources crates \ + > target/coverage-report.lcov + +# Export to JSON +echo "Exporting coverage to JSON..." +llvm-cov export \ + $( + for file in \ + $( + RUSTFLAGS="-C instrument-coverage" \ + cargo test --tests --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - + ); do + printf "%s %s " -object $file + done + ) \ + --format=text \ + --ignore-filename-regex='/.cargo/registry' \ + --ignore-filename-regex='/.cargo/git' \ + --ignore-filename-regex='builder' \ + --ignore-filename-regex='rustc' \ + --ignore-filename-regex='out/' \ + --instr-profile=./target/profiles/elide-rust.profdata \ + --Xdemangler=rustfilt \ + -sources crates \ + > target/coverage-report.json diff --git a/tools/scripts/cargo-coverage-show.sh b/tools/scripts/cargo-coverage-show.sh new file mode 100755 index 0000000000..d68ae97abc --- /dev/null +++ b/tools/scripts/cargo-coverage-show.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +llvm-cov show \ + $( + for file in \ + $( + RUSTFLAGS="-C instrument-coverage" \ + cargo test --tests --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - + ); do + printf "%s %s " -object $file + done + ) \ + --use-color \ + --ignore-filename-regex='/.cargo/registry' \ + --ignore-filename-regex='/.cargo/git' \ + --ignore-filename-regex='builder' \ + --ignore-filename-regex='rustc' \ + --ignore-filename-regex='out/' \ + --instr-profile=./target/profiles/elide-rust.profdata \ + --show-instantiations \ + --show-line-counts-or-regions \ + --Xdemangler=rustfilt \ + | less -R diff --git a/tools/scripts/cargo-test-coverage.sh b/tools/scripts/cargo-test-coverage.sh new file mode 100755 index 0000000000..a39afb9889 --- /dev/null +++ b/tools/scripts/cargo-test-coverage.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + +export RUSTFLAGS="-C instrument-coverage" +export LLVM_PROFILE_FILE="$(pwd)/target/profiles/default_%m_%p.profraw" + +rm -fr target/profiles \ + && cargo test --tests \ + && llvm-profdata merge \ + -sparse target/profiles/*.profraw \ + -o target/profiles/elide-rust.profdata \ + && llvm-cov report \ + $( + for file in \ + $( + RUSTFLAGS="-C instrument-coverage" \ + cargo test --tests --no-run --message-format=json \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - + ); do + printf "%s %s " -object $file + done + ) \ + --use-color \ + --ignore-filename-regex='/.cargo/registry' \ + --ignore-filename-regex='/.cargo/git' \ + --ignore-filename-regex='builder' \ + --ignore-filename-regex='rustc' \ + --ignore-filename-regex='out/' \ + --instr-profile=./target/profiles/elide-rust.profdata \ + -sources $(pwd)/crates/ diff --git a/tools/scripts/llvm-linux.sh b/tools/scripts/llvm-linux.sh index 9174105a07..68e86c3c0a 100644 --- a/tools/scripts/llvm-linux.sh +++ b/tools/scripts/llvm-linux.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + LLVM_VERSION="18" echo "" && echo "Installing initial dependencies..." diff --git a/tools/scripts/macos-linker.sh b/tools/scripts/macos-linker.sh index 81e024469c..046e151f72 100755 --- a/tools/scripts/macos-linker.sh +++ b/tools/scripts/macos-linker.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + # This is a wrapper to adapt ld64 to gnu style arguments; it is called by `rustc` when linking on macOS. This linker is # activated by `~/.cargo/config.toml`, which should be symlinked to `~/.cargo/config.macos-.toml` when building on # macOS. diff --git a/tools/scripts/stamp-releases.sh b/tools/scripts/stamp-releases.sh index 09af4b6794..6b2a4e5c38 100755 --- a/tools/scripts/stamp-releases.sh +++ b/tools/scripts/stamp-releases.sh @@ -1,5 +1,18 @@ #!/bin/bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + version=$(cat ./.release) platform=$(uname -o | tr '[:upper:]' '[:lower:]') arch=$(uname -m) diff --git a/tools/scripts/train-pgo.sh b/tools/scripts/train-pgo.sh index 057463e230..e2a81a4067 100755 --- a/tools/scripts/train-pgo.sh +++ b/tools/scripts/train-pgo.sh @@ -1,5 +1,18 @@ #!/bin/env bash +# +# Copyright (c) 2024 Elide Technologies, Inc. +# +# Licensed under the MIT license (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://opensource.org/license/mit/ +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under the License. +# + # Resolved Elide binary ELIDE="$1" diff --git a/tools/umbrella/Cargo.toml b/tools/umbrella/Cargo.toml index 9f5db504bb..587fec7d78 100644 --- a/tools/umbrella/Cargo.toml +++ b/tools/umbrella/Cargo.toml @@ -13,6 +13,7 @@ crate-type = ["lib", "staticlib", "cdylib"] [features] default = ["lib", "all", "entry"] all = ["js", "python", "jvm"] +diag = [] js = ["orogene"] jvm = [] lib = ["jni/default"] @@ -42,20 +43,26 @@ experimental = [ ] [lints.rust] -unsafe_code = "forbid" dead_code = "allow" [dependencies] ## Local +base = { workspace = true } +deps = { workspace = true } +entry = { workspace = true } substrate = { workspace = true } sqlite = { workspace = true } terminal = { workspace = true } +model = { workspace = true } +project = { workspace = true } +protocol = { workspace = true } transport = { workspace = true } ## Compile anyhow = { workspace = true } -#boring = { workspace = true } +bytemuck = { workspace = true } clap = { workspace = true, features = ["derive", "string", "wrap_help"] } +console-subscriber = { workspace = true } colored = { workspace = true } java_native = { workspace = true } jni = { workspace = true, default-features = false } @@ -89,3 +96,6 @@ biome_json_formatter = { workspace = true, optional = true } biome_markup = { workspace = true, optional = true } biome_suppression = { workspace = true, optional = true } biome_unicode_table = { workspace = true, optional = true } + +[build-dependencies] +builder = { workspace = true } diff --git a/tools/umbrella/build.rs b/tools/umbrella/build.rs index 60a36b6d93..ab6ed66bf5 100644 --- a/tools/umbrella/build.rs +++ b/tools/umbrella/build.rs @@ -1,4 +1,20 @@ +use builder::{target_os, TargetOs}; fn main() { - println!("cargo:rustc-link-lib=dylib=stdc++"); + println!("cargo::rustc-link-lib=static=sqlite3"); + println!("cargo::rustc-link-lib=dylib=sqlite3"); + + match target_os() { + TargetOs::Linux => { + println!("cargo:rustc-link-lib=dylib=stdc++"); + println!("cargo:rustc-link-lib=dylib=ssl"); + println!("cargo:rustc-link-lib=dylib=crypto"); + println!("cargo:rustc-link-lib=static=ssl"); + println!("cargo:rustc-link-lib=static=crypto"); + } + TargetOs::Darwin => { + println!("cargo:rustc-link-lib=dylib=c++"); + } + _ => {} + } } diff --git a/tools/umbrella/src/diagnostics.rs b/tools/umbrella/src/diagnostics.rs index 28f26945c8..db6eac178d 100644 --- a/tools/umbrella/src/diagnostics.rs +++ b/tools/umbrella/src/diagnostics.rs @@ -16,46 +16,46 @@ use serde::Serialize; #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub enum Severity { - Info, - Warning, - Error, + Info, + Warning, + Error, } #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub struct CodeLocation { - pub file: &'static str, - pub line: u32, - pub column: u32, + pub file: &'static str, + pub line: u32, + pub column: u32, } #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub struct DiagnosticNote { - pub id: &'static str, - pub tool: &'static str, - pub code: &'static str, - pub message: &'static str, - pub location: CodeLocation, - pub severity: Severity, + pub id: &'static str, + pub tool: &'static str, + pub code: &'static str, + pub message: &'static str, + pub location: CodeLocation, + pub severity: Severity, } #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub struct DiagnosticTimings { - pub start: u64, - pub end: u64, + pub start: u64, + pub end: u64, } #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub struct DiagnosticSuite { - pub max_severity: Severity, - pub notes: Vec, - pub timings: DiagnosticTimings, + pub max_severity: Severity, + pub notes: Vec, + pub timings: DiagnosticTimings, } #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] pub struct DiagnosticResult { - pub success: bool, - pub exit_code: i32, - pub diagnostics: Vec, + pub success: bool, + pub exit_code: i32, + pub diagnostics: Vec, } diff --git a/tools/umbrella/src/lib.rs b/tools/umbrella/src/lib.rs index 3be2f62072..87b335a482 100644 --- a/tools/umbrella/src/lib.rs +++ b/tools/umbrella/src/lib.rs @@ -10,20 +10,23 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under the License. */ -#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe, unsafe_code)] + +#![forbid(unsafe_op_in_unsafe_fn, unused_unsafe)] + +extern crate core; #[cfg(target_os = "windows")] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; #[cfg(all( - not(target_os = "windows"), - not(target_os = "openbsd"), - any( - target_arch = "x86_64", - target_arch = "aarch64", - target_arch = "powerpc64" - ) + not(target_os = "windows"), + not(target_os = "openbsd"), + any( + target_arch = "x86_64", + target_arch = "aarch64", + target_arch = "powerpc64" + ) ))] #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; @@ -42,6 +45,7 @@ use std::ffi::{c_void, OsStr}; use std::sync::OnceLock; use tokio::runtime::Runtime; +pub use sqlitejdbc; pub use terminal; pub use transport; @@ -67,286 +71,309 @@ use crate::tools::RUFF_INFO; use crate::tools::UV_INFO; use crate::tools::{ToolInfo, API_VERSION, LIB_VERSION}; -mod diagnostics; -mod nativetransport; -mod tools; +pub mod diagnostics; +pub mod nativetransport; +pub mod tools; + +const DIAG_PORT: u16 = 5555; + +#[cfg(feature = "diag")] +fn initialize_console_diag() { + console_subscriber::ConsoleLayer::builder() + .retention(std::time::Duration::from_secs(60)) + .server_addr(([127, 0, 0, 1], DIAG_PORT)) + .init(); +} + +/// Initialize Elide's native layer; this is run unconditionally early in Elide's boot. +pub fn initialize_elide_native(_env: Option) -> u32 { + #[cfg(feature = "diag")] + initialize_console_diag(); + 0 +} /// Obtain a mapping of tool names to their respective `ToolInfo`. fn tool_map() -> &'static HashMap<&'static str, &'static ToolInfo> { - static TOOL_MAP: OnceLock> = OnceLock::new(); - TOOL_MAP.get_or_init(|| { - let mut m = HashMap::new(); - #[cfg(feature = "biome")] - m.insert("biome", &BIOME_INFO); - #[cfg(feature = "orogene")] - m.insert("orogene", &ORO_INFO); - #[cfg(feature = "oxc")] - m.insert("oxc", &OXC_INFO); - #[cfg(feature = "ruff")] - m.insert("ruff", &RUFF_INFO); - #[cfg(feature = "uv")] - m.insert("uv", &UV_INFO); - m - }) + static TOOL_MAP: OnceLock> = OnceLock::new(); + TOOL_MAP.get_or_init(|| { + let mut m = HashMap::new(); + #[cfg(feature = "biome")] + m.insert("biome", &BIOME_INFO); + #[cfg(feature = "orogene")] + m.insert("orogene", &ORO_INFO); + #[cfg(feature = "oxc")] + m.insert("oxc", &OXC_INFO); + #[cfg(feature = "ruff")] + m.insert("ruff", &RUFF_INFO); + #[cfg(feature = "uv")] + m.insert("uv", &UV_INFO); + m + }) } /// Obtain the active Tokio runtime; if one is not already initialized, a new one will be created. fn obtain_runtime() -> &'static Runtime { - static RUNTIME: OnceLock = OnceLock::new(); - RUNTIME.get_or_init(|| { - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .expect("Failed building the Runtime") - }) + static RUNTIME: OnceLock = OnceLock::new(); + RUNTIME.get_or_init(|| { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .expect("Failed building the Runtime") + }) } #[cfg(feature = "ruff")] fn run_ruff_entry(args: Vec) -> ExitStatus { - let args = Args::parse_from(args); - run(args).unwrap_or_else(|err| { - #[allow(clippy::print_stderr)] - { - // This communicates that this isn't a linter error but ruff itself hard-errored for - // some reason (e.g. failed to resolve the configuration) - eprintln!("{}", "ruff failed".red().bold()); - // Currently we generally only see one error, but e.g. with io errors when resolving - // the configuration it is help to chain errors ("resolving configuration failed" -> - // "failed to read file: subdir/pyproject.toml") - for cause in err.chain() { - eprintln!(" {} {cause}", "Cause:".bold()); - } - } - ExitStatus::Error - }) + let args = Args::parse_from(args); + run(args).unwrap_or_else(|err| { + #[allow(clippy::print_stderr)] + { + // This communicates that this isn't a linter error but ruff itself hard-errored for + // some reason (e.g. failed to resolve the configuration) + eprintln!("{}", "ruff failed".red().bold()); + // Currently we generally only see one error, but e.g. with io errors when resolving + // the configuration it is help to chain errors ("resolving configuration failed" -> + // "failed to read file: subdir/pyproject.toml") + for cause in err.chain() { + eprintln!(" {} {cause}", "Cause:".bold()); + } + } + ExitStatus::Error + }) } #[cfg(feature = "orogene")] fn run_oro_with_args(args: Vec) -> Result<()> { - let cmd = Command::new("orogene"); - let again = Orogene::augment_args(cmd); + let cmd = Command::new("orogene"); + let again = Orogene::augment_args(cmd); - // Execute the future, blocking the current thread until completion - let runtime = obtain_runtime(); - let _guard = runtime.enter(); - runtime.block_on(Orogene::init_and_run(again, args)) -} - -#[cfg(feature = "uv")] -fn run_uv_with_args(args: Vec) -> uv::commands::ExitStatus { - eprintln!("checkpoint(uv) args: {:?}", args); - eprintln!("checkpoint(uv) {}", 0); - let runtime = obtain_runtime(); - eprintln!("checkpoint(uv) {}", 1); - let _guard = runtime.enter(); - eprintln!("checkpoint(uv) {}", 2); - match runtime.block_on(run_uv_entry_with_args(args)) { - Ok(_) => uv::commands::ExitStatus::Success, - Err(e) => { - eprintln!("Error running uv: {:?}", e); - return uv::commands::ExitStatus::Error; - } - } -} - -#[cfg(test)] -mod tests { - #[cfg(feature = "uv")] - use std::ffi::OsString; - - #[cfg(feature = "uv")] - #[test] - fn test_run_uv_with_args() { - let args = vec!["uv", "--help"]; - let as_os_strs: Vec = args.iter().map(|x| x.to_string().into()).collect(); - let result = super::run_uv_with_args(as_os_strs); - let exit_code = match result { - uv::commands::ExitStatus::Success => 0, - uv::commands::ExitStatus::Failure => 1, - uv::commands::ExitStatus::Error => 2, - }; - assert_eq!(exit_code, 0); - } + // Execute the future, blocking the current thread until completion + let runtime = obtain_runtime(); + let _guard = runtime.enter(); + runtime.block_on(Orogene::init_and_run(again, args)) } // -- Entrypoint Functions fn all_supported_tools() -> Vec<&'static str> { - tool_map().keys().copied().collect() + tool_map().keys().copied().collect() } // -- JNI Aliases +#[jni("dev.elide.cli.bridge.CliNativeBridge")] +pub fn initializeNative(env: JNIEnv, _class: JClass) -> jint { + initialize_elide_native(Some(env)) as jint +} + #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn libVersion(env: JNIEnv, _class: JClass) -> jstring { - env.new_string(LIB_VERSION).unwrap().into_raw() + env.new_string(LIB_VERSION).unwrap().into_raw() } #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn apiVersion(env: JNIEnv, _class: JClass) -> jstring { - env.new_string(API_VERSION).unwrap().into_raw() + env.new_string(API_VERSION).unwrap().into_raw() } #[jni("dev.elide.cli.bridge.CliNativeBridge")] -pub fn supportedTools<'local>(mut env: JNIEnv, _class: JClass) -> jobjectArray { - let tools = all_supported_tools(); - let array = env - .new_object_array( - tools.len() as i32, - "java/lang/String", - env.new_string("").unwrap(), - ) - .unwrap(); - - for (i, tool) in tools.iter().enumerate() { - let tool = env.new_string(*tool).unwrap(); - env.set_object_array_element(&array, i as i32, tool) - .unwrap(); - } - array.into_raw() +pub fn supportedTools(mut env: JNIEnv, _class: JClass) -> jobjectArray { + let tools = all_supported_tools(); + let array = env + .new_object_array( + tools.len() as i32, + "java/lang/String", + env.new_string("").unwrap(), + ) + .unwrap(); + + for (i, tool) in tools.iter().enumerate() { + let tool = env.new_string(*tool).unwrap(); + env + .set_object_array_element(&array, i as i32, tool) + .unwrap(); + } + array.into_raw() } #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn relatesTo(mut env: JNIEnv, _class: JClass, tool: JString<'_>) -> jobjectArray { - let input: String = env - .get_string(&tool) - .expect("Couldn't get tool string") - .into(); - let tool_info = tool_map().get(input.as_str()); - let tool = match tool_info { - Some(tool) => tool, - None => panic!("Tool not found"), - }; - let array = env - .new_object_array(1, "java/lang/String", env.new_string("").unwrap()) - .unwrap(); - - tool.language.iter().for_each(|lang| { - let tool = env.new_string(lang).unwrap(); - env.set_object_array_element(&array, 0, tool).unwrap(); - }); - - array.into_raw() + let input: String = env + .get_string(&tool) + .expect("Couldn't get tool string") + .into(); + let tool_info = tool_map().get(input.as_str()); + let tool = match tool_info { + Some(tool) => tool, + None => panic!("Tool not found"), + }; + let array = env + .new_object_array(1, "java/lang/String", env.new_string("").unwrap()) + .unwrap(); + + tool.language.iter().for_each(|lang| { + let tool = env.new_string(lang).unwrap(); + env.set_object_array_element(&array, 0, tool).unwrap(); + }); + + array.into_raw() } #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn toolVersion(mut env: JNIEnv, _class: JClass, tool: JString<'_>) -> jstring { - let input: String = env - .get_string(&tool) - .expect("Couldn't get tool string") - .into(); - let tool_info = tool_map().get(input.as_str()); - let tool = match tool_info { - Some(tool) => tool, - None => panic!("Tool not found"), - }; - env.new_string(tool.version).unwrap().into_raw() + let input: String = env + .get_string(&tool) + .expect("Couldn't get tool string") + .into(); + let tool_info = tool_map().get(input.as_str()); + let tool = match tool_info { + Some(tool) => tool, + None => panic!("Tool not found"), + }; + env.new_string(tool.version).unwrap().into_raw() } fn decode_tool_args(mut env: JNIEnv, args: JObjectArray) -> Vec { - let arg_count = env.get_array_length(&args).unwrap(); - let mut arg_i = 0; - let mut tool_args: Vec = vec![]; - while arg_i < arg_count { - // fetch the arg - let arg_entry = env - .get_object_array_element(&args, arg_i) - .expect("Failed to retrieve expected array element"); - - // cast/decode as a string - let arg_str = env - .get_string(<&JString>::from(&arg_entry)) - .expect("Failed to decode string argument for Ruff"); - - let arg_str = arg_str.to_str(); - let arg_os_str = OsStr::new(arg_str.as_ref()); - - // insert into the arg vec - tool_args.insert(arg_i as usize, arg_os_str.to_os_string()); - arg_i += 1; - } - tool_args + let arg_count = env.get_array_length(&args).unwrap(); + let mut arg_i = 0; + let mut tool_args: Vec = vec![]; + while arg_i < arg_count { + // fetch the arg + let arg_entry = env + .get_object_array_element(&args, arg_i) + .expect("Failed to retrieve expected array element"); + + // cast/decode as a string + let arg_str = env + .get_string(<&JString>::from(&arg_entry)) + .expect("Failed to decode string argument for Ruff"); + + let arg_str = arg_str.to_str(); + let arg_os_str = OsStr::new(arg_str.as_ref()); + + // insert into the arg vec + tool_args.insert(arg_i as usize, arg_os_str.to_os_string()); + arg_i += 1; + } + tool_args } #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runOrogene<'local>( - env: JNIEnv<'local>, - _class: JClass<'local>, - args: JObjectArray<'local>, + env: JNIEnv<'local>, + _class: JClass<'local>, + args: JObjectArray<'local>, ) -> jint { - #[cfg(feature = "orogene")] - match run_oro_with_args(decode_tool_args(env, args)) { - Ok(_) => 0, - Err(_) => 1, - } - #[cfg(not(feature = "orogene"))] - return -1; + #[cfg(feature = "orogene")] + match run_oro_with_args(decode_tool_args(env, args)) { + Ok(_) => 0, + Err(_) => 1, + } + #[cfg(not(feature = "orogene"))] + return -1; } #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runRuff<'local>( - env: JNIEnv<'local>, - _class: JClass<'local>, - args: JObjectArray<'local>, + env: JNIEnv<'local>, + _class: JClass<'local>, + args: JObjectArray<'local>, ) -> jint { - #[cfg(feature = "ruff")] - match run_ruff_entry(decode_tool_args(env, args)) { - ExitStatus::Success => 0, - ExitStatus::Failure => 1, - ExitStatus::Error => 2, - } - #[cfg(not(feature = "ruff"))] - return 0; + #[cfg(feature = "ruff")] + match run_ruff_entry(decode_tool_args(env, args)) { + ExitStatus::Success => 0, + ExitStatus::Failure => 1, + ExitStatus::Error => 2, + } + #[cfg(not(feature = "ruff"))] + return 0; } #[cfg(feature = "uv")] #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runUv<'local>( - env: JNIEnv<'local>, - _class: JClass<'local>, - args: JObjectArray<'local>, + env: JNIEnv<'local>, + _class: JClass<'local>, + args: JObjectArray<'local>, ) -> jint { - match run_uv_with_args(decode_tool_args(env, args)) { - uv::commands::ExitStatus::Success => 0, - uv::commands::ExitStatus::Failure => 1, - uv::commands::ExitStatus::Error => 2, - } + match run_uv_with_args(decode_tool_args(env, args)) { + uv::commands::ExitStatus::Success => 0, + uv::commands::ExitStatus::Failure => 1, + uv::commands::ExitStatus::Error => 2, + } } #[cfg(not(feature = "uv"))] #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runUv<'local>( - _env: JNIEnv<'local>, - _class: JClass<'local>, - _args: JObjectArray<'local>, + _env: JNIEnv<'local>, + _class: JClass<'local>, + _args: JObjectArray<'local>, ) -> jint { - -1 + -1 } #[cfg(feature = "biome")] #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runBiomeFmt<'local>( - _env: JNIEnv<'local>, - _class: JClass<'local>, - _args: JObjectArray<'local>, + _env: JNIEnv<'local>, + _class: JClass<'local>, + _args: JObjectArray<'local>, ) -> jint { - return 0; + return 0; } #[cfg(not(feature = "biome"))] #[jni("dev.elide.cli.bridge.CliNativeBridge")] pub fn runBiomeFmt<'local>( - _env: JNIEnv<'local>, - _class: JClass<'local>, - _args: JObjectArray<'local>, + _env: JNIEnv<'local>, + _class: JClass<'local>, + _args: JObjectArray<'local>, ) -> jint { - -1 + -1 } #[on_load(umbrella)] -pub fn on_load<'local>(_vm: JavaVM, _: c_void) -> jint { - JNI_VERSION_21 +pub fn on_load(_vm: JavaVM, _: c_void) -> jint { + JNI_VERSION_21 } #[on_unload(umbrella)] -pub fn on_unload<'local>(_vm: JavaVM, _: c_void) { - // nothing to do at this time +pub fn on_unload(_vm: JavaVM, _: c_void) { + // nothing to do at this time +} + +#[cfg(feature = "uv")] +fn run_uv_with_args(args: Vec) -> uv::commands::ExitStatus { + eprintln!("checkpoint(uv) args: {:?}", args); + eprintln!("checkpoint(uv) {}", 0); + let runtime = obtain_runtime(); + eprintln!("checkpoint(uv) {}", 1); + let _guard = runtime.enter(); + eprintln!("checkpoint(uv) {}", 2); + match runtime.block_on(run_uv_entry_with_args(args)) { + Ok(_) => uv::commands::ExitStatus::Success, + Err(e) => { + eprintln!("Error running uv: {:?}", e); + return uv::commands::ExitStatus::Error; + } + } +} + +#[cfg(test)] +mod tests { + #[cfg(feature = "uv")] + use std::ffi::OsString; + + #[cfg(feature = "uv")] + #[test] + fn test_run_uv_with_args() { + let args = vec!["uv", "--help"]; + let as_os_strs: Vec = args.iter().map(|x| x.to_string().into()).collect(); + let result = super::run_uv_with_args(as_os_strs); + let exit_code = match result { + uv::commands::ExitStatus::Success => 0, + uv::commands::ExitStatus::Failure => 1, + uv::commands::ExitStatus::Error => 2, + }; + assert_eq!(exit_code, 0); + } } diff --git a/tools/umbrella/src/nativetransport.rs b/tools/umbrella/src/nativetransport.rs index 476ee63eaf..e84ee041ac 100644 --- a/tools/umbrella/src/nativetransport.rs +++ b/tools/umbrella/src/nativetransport.rs @@ -15,7 +15,7 @@ use serde::Serialize; #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug, Serialize)] enum TransportMode { - EPOLL, - KQUEUE, - URING, + Epoll, + Kqueue, + Uring, } diff --git a/tools/umbrella/src/tools.rs b/tools/umbrella/src/tools.rs index 9129f3541d..b50dba5a69 100644 --- a/tools/umbrella/src/tools.rs +++ b/tools/umbrella/src/tools.rs @@ -13,21 +13,21 @@ #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug)] pub enum ToolType { - Linter, - Formatter, - Compiler, - Resolver, - EnvManager, + Linter, + Formatter, + Compiler, + Resolver, + EnvManager, } #[typeshare::typeshare] #[derive(Clone, Hash, Eq, PartialEq, Debug)] pub struct ToolInfo { - pub name: &'static str, - pub version: &'static str, - pub experimental: bool, - pub language: &'static [&'static str], - pub kind: &'static [&'static ToolType], + pub name: &'static str, + pub version: &'static str, + pub experimental: bool, + pub language: &'static [&'static str], + pub kind: &'static [&'static ToolType], } // Library version of the tooling layer. @@ -38,45 +38,45 @@ pub static API_VERSION: &str = "v1"; #[cfg(feature = "uv")] pub static UV_INFO: ToolInfo = ToolInfo { - name: "uv", - version: "0.1.9", - experimental: true, - language: &["python"], - kind: &[&ToolType::Resolver, &ToolType::EnvManager], + name: "uv", + version: "0.1.9", + experimental: true, + language: &["python"], + kind: &[&ToolType::Resolver, &ToolType::EnvManager], }; #[cfg(feature = "ruff")] pub static RUFF_INFO: ToolInfo = ToolInfo { - name: "ruff", - version: "0.4.0", - experimental: true, - language: &["python"], - kind: &[&ToolType::Linter, &ToolType::Formatter], + name: "ruff", + version: "0.4.0", + experimental: true, + language: &["python"], + kind: &[&ToolType::Linter, &ToolType::Formatter], }; #[cfg(feature = "oxc")] pub static OXC_INFO: ToolInfo = ToolInfo { - name: "oxc", - version: "0.12.3", - experimental: true, - language: &["js"], - kind: &[&ToolType::Compiler], + name: "oxc", + version: "0.12.3", + experimental: true, + language: &["js"], + kind: &[&ToolType::Compiler], }; #[cfg(feature = "biome")] pub static BIOME_INFO: ToolInfo = ToolInfo { - experimental: true, - name: "biome", - version: "0.5.7", - language: &["js"], - kind: &[&ToolType::Formatter, &ToolType::Linter], + experimental: true, + name: "biome", + version: "0.5.7", + language: &["js"], + kind: &[&ToolType::Formatter, &ToolType::Linter], }; #[cfg(feature = "orogene")] pub static ORO_INFO: ToolInfo = ToolInfo { - name: "orogene", - version: "0.3.35-elide", - experimental: true, - language: &["js"], - kind: &[&ToolType::Resolver], + name: "orogene", + version: "0.3.35-elide", + experimental: true, + language: &["js"], + kind: &[&ToolType::Resolver], };