Skip to content

Add native tooling/runtime deps to export --json#4240

Draft
kubukoz wants to merge 1 commit intoVirtusLab:mainfrom
kubukoz:native-export-options
Draft

Add native tooling/runtime deps to export --json#4240
kubukoz wants to merge 1 commit intoVirtusLab:mainfrom
kubukoz:native-export-options

Conversation

@kubukoz
Copy link
Copy Markdown
Contributor

@kubukoz kubukoz commented Apr 18, 2026

Summary

  • Adds a nativeOptions field to export --json output when platform == "Native", containing:
    • scalaNativeVersion — the effective Scala Native version
    • compilerPlugins — implicit compiler plugins (e.g. nscplugin)
    • runtimeDependencies — implicit runtime deps (e.g. javalib, scala3lib)
    • toolingDependencies — packaging-time deps (e.g. scala-native-cli)
  • Existing top-level fields (scalaNativeVersion, platform, etc.) are unchanged for backward compatibility
  • Non-Native exports (JVM, JS) are unaffected — nativeOptions is absent

Closes #4234

Motivation

Downstream tools like scala-cli-nix need to know the full artifact closure used by scala-cli package to prefetch dependencies for offline builds. Previously, export --json only exposed user-declared dependencies, forcing downstream tools to hardcode knowledge of Scala CLI internals (implicit Native runtime/tooling deps).

Example output

{
  "scalaNativeVersion": "0.5.10",
  "nativeOptions": {
    "scalaNativeVersion": "0.5.10",
    "compilerPlugins": [
      { "groupId": "org.scala-native", "artifactId": { "name": "nscplugin", "fullName": "nscplugin_3.2.2" }, "version": "0.5.10" }
    ],
    "runtimeDependencies": [
      { "groupId": "org.scala-native", "artifactId": { "name": "javalib_native0.5", "fullName": "javalib_native0.5_3" }, "version": "0.5.10" },
      { "groupId": "org.scala-native", "artifactId": { "name": "scala3lib_native0.5", "fullName": "scala3lib_native0.5_3" }, "version": "3.2.2+0.5.10" }
    ],
    "toolingDependencies": [
      { "groupId": "org.scala-native", "artifactId": { "name": "scala-native-cli", "fullName": "scala-native-cli_2.12" }, "version": "0.5.10" }
    ]
  }
}

Test plan

  • Existing export json with test scope integration test updated with expected nativeOptions
  • JVM and JS exports verified to not include nativeOptions
  • Manually tested native binary output against a Scala Native project

🤖 Generated with Claude Code

@kubukoz kubukoz force-pushed the native-export-options branch from 908f327 to aa81e1e Compare April 18, 2026 23:13
|"scalaNativeVersion":"${Constants.scalaNativeVersion}",
|"scalaNativeVersion":"$nativeVersion",
|"nativeOptions": {
| "scalaNativeVersion":"$nativeVersion",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is duplicated

@kubukoz kubukoz marked this pull request as draft April 20, 2026 11:40
@kubukoz
Copy link
Copy Markdown
Contributor Author

kubukoz commented Apr 20, 2026

I need to test this out a bit more :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export --json: Provide tooling versions (e.g. Native CLI)

1 participant