diff --git a/pkl-core/src/main/java/org/pkl/core/EvaluatorBuilder.java b/pkl-core/src/main/java/org/pkl/core/EvaluatorBuilder.java index 8b5ad5d4..aa7ae8dd 100644 --- a/pkl-core/src/main/java/org/pkl/core/EvaluatorBuilder.java +++ b/pkl-core/src/main/java/org/pkl/core/EvaluatorBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. + * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +91,7 @@ public final class EvaluatorBuilder { *
  • {@link ResourceReaders#https} *
  • {@link ResourceReaders#pkg} *
  • {@link ResourceReaders#projectpackage} + *
  • {@link ResourceReaders#fromServiceProviders} *
  • {@link System#getProperties} * */ @@ -108,6 +109,7 @@ public final class EvaluatorBuilder { .addResourceReader(ResourceReaders.https()) .addResourceReader(ResourceReaders.pkg()) .addResourceReader(ResourceReaders.projectpackage()) + .addResourceReaders(ResourceReaders.fromServiceProviders()) .addModuleKeyFactory(ModuleKeyFactories.standardLibrary); if (!TruffleOptions.AOT) { diff --git a/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorBuilderTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorBuilderTest.kt index 4a13f11e..8baa0059 100644 --- a/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorBuilderTest.kt +++ b/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorBuilderTest.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. + * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.pkl.core.project.Project +import org.pkl.core.resource.TestResourceReader class EvaluatorBuilderTest { @Test @@ -35,6 +36,12 @@ class EvaluatorBuilderTest { assertThat(builder.externalProperties).isEqualTo(System.getProperties()) } + @Test + fun `preconfigured builder adds resource readers from service providers`() { + val builder = EvaluatorBuilder.preconfigured() + assertThat(builder.resourceReaders).hasAtLeastOneElementOfType(TestResourceReader::class.java) + } + @Test fun `unconfigured builder does not set process env vars`() { val builder = EvaluatorBuilder.unconfigured()