Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new runtime info API #437

Merged
merged 5 commits into from
Oct 5, 2023
Merged

feat: new runtime info API #437

merged 5 commits into from
Oct 5, 2023

Conversation

darvld
Copy link
Member

@darvld darvld commented Oct 1, 2023

Ready for review Powered by Pull Request Badge

Summary

This PR introduces the HostRuntime API, which provides information about the runtime to engine plugins. Use the PolyglotEngineConfiguration.hostRuntime property to access it:

/** Provides information about the runtime hosting the application. */
@DelicateElideApi public interface HostRuntime {
  /** The name of this runtime, which is used in string representations and for debugging purposes. */
  public val name: String

  /** The version spec of this runtime, wrapped to allow version comparisons using regular operators. */
  public val version: Version?

  /** An optional variant name for this runtime. Some engines like GraalVM differentiate between runtime variants. */
  public val variant: String?
}

The HostRuntime.on extension provides conditional execution of code based on the version of the current runtime, compared with the specified target version (or version range). The GraalVMRuntime companion provides a few version constants representing known GraalVM versions (GVM_23 and GVM_23_1):

fun configureOptions(configuration: PolyglotEngineConfiguration) {
  // enable some options only for GraalVM 23.0 and previous versions
  configuration.hostRuntime.on(GVM_23.andLower()) {
    enableOption("engine.Inlining")
  }
}

@darvld darvld added the 🚧 WIP Works-in-progress. Blocks merge label Oct 1, 2023
@darvld darvld self-assigned this Oct 1, 2023
@github-actions github-actions bot added the platform:jvm PRs and issues relating to JVM support. label Oct 1, 2023
@darvld darvld force-pushed the feat/runtime-info branch from 96ba32f to 66f98c6 Compare October 1, 2023 15:40
@darvld darvld marked this pull request as ready for review October 1, 2023 15:46
@darvld darvld requested a review from sgammon as a code owner October 1, 2023 15:46
@darvld darvld enabled auto-merge October 1, 2023 15:47
@darvld darvld removed the 🚧 WIP Works-in-progress. Blocks merge label Oct 1, 2023
@sgammon sgammon changed the base branch from v3 to release/alpha7 October 5, 2023 07:54
@sgammon sgammon force-pushed the feat/runtime-info branch from 66f98c6 to ca15bc9 Compare October 5, 2023 07:55
@sgammon
Copy link
Member

sgammon commented Oct 5, 2023

merging with #445

@sgammon sgammon mentioned this pull request Oct 5, 2023
42 tasks
@sgammon sgammon disabled auto-merge October 5, 2023 08:09
@sgammon sgammon merged commit 01ac48d into release/alpha7 Oct 5, 2023
@sgammon sgammon deleted the feat/runtime-info branch October 5, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:jvm PRs and issues relating to JVM support.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants