[PR #946] [MERGED] Make commands classes instead of objects #819

Closed
opened 2025-12-30 01:27:00 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/946
Author: @bioball
Created: 2/11/2025
Status: Merged
Merged: 2/11/2025
Merged by: @bioball

Base: mainHead: make-commands-classes


📝 Commits (2)

  • 7b7b07b Make commands classes instead of objects
  • bcc0fc0 Update pkl-cli/src/test/kotlin/org/pkl/cli/CliMainTest.kt

📊 Changes

13 files changed (+36 additions, -37 deletions)

View changed files

📝 pkl-cli/src/main/kotlin/org/pkl/cli/Main.kt (+1 -1)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/AnalyzeCommand.kt (+1 -1)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/DownloadPackageCommand.kt (+1 -1)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt (+1 -1)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt (+4 -4)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/ReplCommand.kt (+1 -2)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/RootCommand.kt (+8 -8)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/ServerCommand.kt (+1 -1)
📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt (+1 -1)
📝 pkl-cli/src/test/kotlin/org/pkl/cli/CliMainTest.kt (+12 -13)
📝 pkl-cli/src/test/kotlin/org/pkl/cli/CliTestRunnerTest.kt (+1 -1)
📝 pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt (+2 -2)
📝 pkl-doc/src/test/kotlin/org/pkl/doc/CliMainTest.kt (+2 -1)

📄 Description

Making these classes caused native-image to statically initialize them at build time, which included CLI argument default values (like working dir).

This turns them back into classes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/946 **Author:** [@bioball](https://github.com/bioball) **Created:** 2/11/2025 **Status:** ✅ Merged **Merged:** 2/11/2025 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `make-commands-classes` --- ### 📝 Commits (2) - [`7b7b07b`](https://github.com/apple/pkl/commit/7b7b07bd4bec49aee1dea2962dc6a43c8ca5d841) Make commands classes instead of objects - [`bcc0fc0`](https://github.com/apple/pkl/commit/bcc0fc04a207fc9935375ddda859b8b9c2378327) Update pkl-cli/src/test/kotlin/org/pkl/cli/CliMainTest.kt ### 📊 Changes **13 files changed** (+36 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/Main.kt` (+1 -1) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/AnalyzeCommand.kt` (+1 -1) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/DownloadPackageCommand.kt` (+1 -1) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt` (+1 -1) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt` (+4 -4) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/ReplCommand.kt` (+1 -2) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/RootCommand.kt` (+8 -8) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/ServerCommand.kt` (+1 -1) 📝 `pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt` (+1 -1) 📝 `pkl-cli/src/test/kotlin/org/pkl/cli/CliMainTest.kt` (+12 -13) 📝 `pkl-cli/src/test/kotlin/org/pkl/cli/CliTestRunnerTest.kt` (+1 -1) 📝 `pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt` (+2 -2) 📝 `pkl-doc/src/test/kotlin/org/pkl/doc/CliMainTest.kt` (+2 -1) </details> ### 📄 Description Making these classes caused native-image to statically initialize them at build time, which included CLI argument default values (like working dir). This turns them back into classes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:27:00 +01:00
adam closed this issue 2025-12-30 01:27:00 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#819