Skip to content

pkl-config-java: Replace Config.fromPklBinary() with ConfigDecoder#1533

Merged
bioball merged 1 commit intoapple:mainfrom
odenix:config-decoder
Apr 20, 2026
Merged

pkl-config-java: Replace Config.fromPklBinary() with ConfigDecoder#1533
bioball merged 1 commit intoapple:mainfrom
odenix:config-decoder

Conversation

@odenix
Copy link
Copy Markdown
Contributor

@odenix odenix commented Apr 18, 2026

Motivation:

  • Config mixes configuration representation with decoding logic
  • Config.fromPklBinary() does not scale as decoding gains options (e.g., binary versions or formats)
  • The decoding API is inconsistent with ConfigEvaluator

Changes:

  • Introduce ConfigDecoder (with builder) and move Config.fromPklBinary() logic into it
  • Deprecate Config.fromPklBinary() methods for removal
  • Add ConfigDecoder.forKotlin() extension function
  • Update and improve tests

Result:

  • Decoding is separated from Config and exposed via a dedicated API
  • Decoding can evolve independently (e.g., adding options such as binary versions or supporting new formats)
  • Evaluation and decoding APIs follow a consistent design

Copy link
Copy Markdown
Member

@bioball bioball left a comment

Choose a reason for hiding this comment

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

LGTM! Yeah, this makes sense and gives us good symmetry with the evaluator side of things.

Looking for one more thumb before merging this.

@@ -0,0 +1,78 @@
/*
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copyright years are per source file (new files introduced this year should have © 2026)

Suggested change
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.

@@ -0,0 +1,62 @@
/*
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.

@@ -0,0 +1,49 @@
/*
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.

Motivation:
- `Config` mixes configuration representation with decoding logic
- `Config.fromPklBinary()` does not scale as decoding gains options (e.g., binary versions or formats)
- The decoding API is inconsistent with `ConfigEvaluator`

Changes:
- Introduce `ConfigDecoder` (with builder) and move `Config.fromPklBinary()` logic into it
- Deprecate `Config.fromPklBinary()` methods for removal
- Add `ConfigDecoder.forKotlin()` extension function
- Update and improve tests

Result:
- Decoding is separated from `Config` and exposed via a dedicated API
- Decoding can evolve independently (e.g., adding options such as binary versions or supporting new formats)
- Evaluation and decoding APIs follow a consistent design
Copy link
Copy Markdown
Contributor

@HT154 HT154 left a comment

Choose a reason for hiding this comment

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

LGTM

@bioball bioball merged commit 7a75ab5 into apple:main Apr 20, 2026
17 checks passed
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.

3 participants