mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
[PR #647] [CLOSED] Add ResourceReaderFactory abstraction #654
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/647
Author: @HT154
Created: 9/15/2024
Status: ❌ Closed
Base:
main← Head:resource-reader-factory📝 Commits (1)
bbb67e2Add ResourceReaderFactory abstraction📊 Changes
20 files changed (+435 additions, -124 deletions)
View changed files
📝
docs/src/test/kotlin/DocSnippetTests.kt(+3 -2)📝
pkl-cli/src/main/kotlin/org/pkl/cli/CliRepl.kt(+9 -9)📝
pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt(+14 -12)📝
pkl-core/src/main/java/org/pkl/core/EvaluatorBuilder.java(+22 -21)📝
pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java(+3 -3)📝
pkl-core/src/main/java/org/pkl/core/project/Project.java(+5 -5)📝
pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java(+3 -3)➕
pkl-core/src/main/java/org/pkl/core/resource/ResourceReaderFactories.java(+227 -0)➕
pkl-core/src/main/java/org/pkl/core/resource/ResourceReaderFactory.java(+38 -0)📝
pkl-core/src/main/java/org/pkl/core/resource/ResourceReaders.java(+0 -21)📝
pkl-core/src/main/java/org/pkl/core/runtime/ResourceManager.java(+18 -7)📝
pkl-core/src/main/java/org/pkl/core/service/ExecutorSpiImpl.java(+9 -9)📝
pkl-core/src/main/java/org/pkl/core/settings/PklSettings.java(+2 -2)📝
pkl-core/src/test/kotlin/org/pkl/core/ReplServerTest.kt(+5 -2)📝
pkl-core/src/test/kotlin/org/pkl/core/resource/ResourceReadersEvaluatorTest.kt(+3 -2)📝
pkl-core/src/test/kotlin/org/pkl/core/resource/ResourceReadersTest.kt(+7 -4)📝
pkl-server/src/main/kotlin/org/pkl/server/BinaryEvaluator.kt(+3 -3)➕
pkl-server/src/main/kotlin/org/pkl/server/ClientResourceReaderFactory.kt(+39 -0)📝
pkl-server/src/main/kotlin/org/pkl/server/Server.kt(+20 -17)📝
pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorTest.kt(+5 -2)📄 Description
This is preparatory work for SPICE-0009. It is being contributed in a separate pull request to ease review.
This is required to allow deferred launch of external reader processes without requiring up-front configuration of scheme->process mappings. More details on why this is required here: https://github.com/apple/pkl-evolution/pull/10#discussion_r1724145677
One concern here (which applies before this change as well) is that the semantics of module key factories and resource reader factories is reversed. For module key factories, the first factory that answers for a URI scheme "wins", while for resource reader factories, the last reader factory that answers for a URI scheme "wins". This PR preserves that behavior, but it may be worth reconsidering this design at this time.
This behavior can be observed in practice in
ResourceReadersEvaluatorTest.`module path`whereResourceReaders.modulePathis added after the pre-configuredResourceReaders.classPathand takes precedence.This is a fairly large breaking API change, but in practice most clients will only need to replace a few lines in their calls to
EvaluatorBuilder, eg.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.