Commit Graph

473 Commits

Author SHA1 Message Date
Islon Scherer
d5b6038147 Prepare 0.29.0 release 0.29.0 2025-07-24 19:05:24 +02:00
Daniel Chao
efee9f3801 Disable publishing jpkl (#1147)
This is causing a breakage in our release pipeline right now.
2025-07-24 10:04:46 -07:00
Daniel Chao
8e88133248 Disable publishing native executables to Maven Central (#1146)
Attempts to publish these artifacts is resulting in errors like
"No Archiver found for the stream signature"

Also, add to release notes
2025-07-24 09:21:02 -07:00
Daniel Chao
b38b15ba71 Remove duplicate block ids (#1145)
We can't repeat these block ids multiple times in the same page.
2025-07-24 17:19:29 +02:00
Daniel Chao
1c4fbe7c1c Fix: use http.rewrites to configure the evaluator in message passing API (#1141)
This is a bugfix, where the `rewrites` option is currently ignored.

Also: return any illegal argument errors from creating the evaluator as
an error in the CreateEvaluatorResponse
2025-07-24 07:30:31 -07:00
Daniel Chao
ae046a804b Add release notes for 0.29 (#1140)
Co-authored-by: Jen Basch <421772+HT154@users.noreply.github.com>
2025-07-24 07:30:04 -07:00
Daniel Chao
53f6951d81 Add bytesType to pkl:reflect (#1144)
Just like other data types on the base module, the mirror for `Bytes`
should be available directly on `pkl:reflect`.
2025-07-24 06:21:10 -07:00
Daniel Chao
7c8c4438d5 Defer noProxy to settings.pkl or PklProject if not set explicitly (#1143)
Fixes an issue where `http.noProxy` settings are ignored.
2025-07-23 10:57:31 -07:00
Daniel Chao
bdf6aa6b60 Un-deprecate Resource.base64, compute bytes/base64 in terms of each other (#1138)
This makes changes to avoid a needless breaking change.
It preserves code like `new Resource { base64 = someValue }.sha256`,
and also code that renders `Resource` into static formats.

Co-authored-by: Islon Scherer <islonscherer@gmail.com>
2025-07-23 06:25:49 -07:00
Daniel Chao
03d8e01801 Bump GraalVM JDK version to 21.0.8 (#1139) 2025-07-23 05:22:17 -07:00
Jen Basch
85e4f133a4 Add getOrDefault method to Listing and Mapping (#1053)
This PR adds methods to Listing and Mapping that can be used to retrieve members. If the member for the index/key isn't present, it applies default to the index/key. In both cases, this is essentially sugar for getOrNull(<index/key>) ?? default.apply(<index/key>).

Co-authored-by: Daniel Chao <daniel.h.chao@gmail.com>
2025-07-22 15:45:49 -07:00
Daniel Chao
306a3b0fc2 Polish http rewrites (#1133)
* Polish rewrite docs
* Add documentation comments, add missing evaluator options
* Add ability to set HTTP builder in ConfigEvaluatorBuilder
* Add ability to set rewrites in executor API
2025-07-22 15:42:07 -07:00
Daniel Chao
fe064960b4 Bump Gradle to 8.14.3 (#1129) 2025-07-18 11:03:38 -07:00
Daniel Chao
6cd73227a1 Update dependencies (#1128) 2025-07-18 09:29:44 -07:00
Islon Scherer
ba82c5c6d6 Only allow shebangs in the beginning of a module (#1126) 2025-07-18 11:18:45 +02:00
Daniel Chao
decb4ea66e Improve message passing api docs (#1127)
1. Change `Binary` to `Bytes` (new type representing binary data)
2. Add documentation for `http.rewrites` option
2025-07-17 07:57:48 -07:00
Daniel Chao
99020bb79d Add support for HTTP rewrites (#1062)
This adds a new configuration option for the HTTP client to replace URI prefixes when making outbound calls.

Follows the design of https://github.com/apple/pkl-evolution/pull/17
2025-07-16 15:53:31 -07:00
Daniel Chao
fea031a138 Switch publishing to sonatype central (#1121)
OSSRH is now EOL, so we need to publish to this new repository.
2025-07-11 05:48:31 -07:00
Daniel Chao
48ad4386c8 Add Kotlin support for "addGeneratedAnnotation" flag (#1115)
This adds logic so that the Kotlin code generator also supports the
"addGeneratedAnnotation" flag.

Also:
* Add Antora documentation
* Adjust names (generated-annotation -> add-generated-annotation)
* Adjust doc comments
2025-07-08 14:05:15 -07:00
Islon Scherer
3a35be6311 Remove ANTLR from the repo (#1114) 2025-07-08 09:43:35 +02:00
André Rouél
0973774a5d Add @Generated annotation to generated Java types (#1075)
JaCoCo automatically excludes methods and classes annotated with @Generated from the coverage reports. This is very important to us as generated code should not normally be included in the coverage report. We want to measure the coverage of the code that we actually wrote and maintain, not the code that was automatically generated by tools.

By introducing a property generatedAnnotation (default value false) one could enable writing @Generated on Java types to be generated.

Co-authored-by: Nullpointer <mike.schulze@tealium.com>
2025-07-07 15:31:49 -07:00
Jen Basch
dbf57280ba Fix crash due to parse error in module header (#1112) 2025-07-01 10:05:16 +02:00
Artem Yarmoliuk
f1388ffb2f Don't show 100% when number of failures is rounded up (#1110)
Co-Authored-By: Mike Drob <mdrob@apple.com>
2025-06-27 15:29:26 +02:00
Daniel Chao
d6fd7e0942 Fix native build (#1099)
* Add truffle boundaries
* Fix snippet output tests
* Make java LanguageSnippetTests eval output.bytes, just like the CLI does
2025-06-17 08:42:49 -07:00
Daniel Chao
e9320557b7 Introduces Bytes class (#1019)
This introduces a new `Bytes` standard library class, for working with
binary data.

* Add Bytes class to the standard library
* Change CLI to eval `output.bytes`
* Change code generators to map Bytes to respective underlying type
* Add subscript and concat operator support
* Add binary encoding for Bytes
* Add PCF and Plist rendering for Bytes

Co-authored-by: Kushal Pisavadia <kushi.p@gmail.com>
2025-06-11 16:23:55 -07:00
Artem Yarmoliuk
3bd8a88506 Aggregate junit report into one file (#1056)
Some systems require junit report to be in a single file. For example `bazel` https://bazel.build/reference/test-encyclopedia needs single file to be available in `XML_OUTPUT_FILE` path.

To avoid implementing junit aggregation in pkl wrappers in different places this PR instead adds a `--junit-aggregate-reports` flag to return all junit reports as a single file.

Additional flag `--junit-aggregate-suite-name` is added to allow overriding global test suite name from default `pkl-tests`
2025-06-06 17:33:13 -07:00
Daniel Chao
0b0f3b131d Add ResourceReaders#fromServiceProviders to preconfigured evaluator (#1094)
The preconfigured evaluator currently adds module key factories from
service providers, but not resource readers.

This means that users of pkl-spring, for example, cannot add custom
resource readers.
This is also inconsistent (in the preconfigured evaluator, `import` can
 use custom schemes, but not `read`).
2025-06-06 17:26:38 -07:00
Daniel Chao
568c6ccbc2 Update dependencies, and clean up multi-JDK testing (#1088)
* Update dependencies
  1. Remove */gradle.lockfile files
  2. Run `gradle updateDependencyLocks` and commit
* Update multi-JDK testing to use simple Test task, add junit-platform-launcher to dependencies
  - Don't use JvmTestSuite (we don't use another test runner, we use the same classpath)
* Add junit-platform-launcher to libs (prevent an issue where junit-engine and junit-launcher can fall out of sync)
2025-06-04 08:30:02 -07:00
Daniel Chao
dd9800c70a Update Gradle to 8.14.1 (#1091) 2025-06-04 08:28:52 -07:00
Daniel Chao
2bc9c2f424 Treat opaque file URIs as errors (#1087)
Opaque file URIs are URIs whose scheme-specific part does not start with `/`.
For example, `file:foo/bar.txt` is an opaque URI.

Currently, this has the unintentional behavior of: look for file `foo/bar.txt` from the process working directory.
These are effectively dynamics imports; from a single import, we can't statically analyze what it resolves as.

According to RFC-8089, File URIs must have paths that start with `/`. So, these are actually _not valid URIs_.
See the grammar defined in https://datatracker.ietf.org/doc/html/rfc8089#section-2

This changes Pkl's behavior so that these URIs are treated as errors.
2025-06-03 14:57:22 -07:00
Daniel Chao
4eeb61dc74 Fix multi-jdk testing setup (#1086)
This changes the Gradle build to always create multi-jdk tasks,
and instead use the `enabled` property to determine whether the task
is actually ran or not.

The has the following benefits:
* IntelliJ and other tools understand the task execution graph (e.g. testJdk20 shows up as a task)
* JDK-specific Gradle configurations always exist, so `updateDependencyLocks` is consistent.
2025-06-03 08:56:02 -07:00
Vladimir Sitnikov
7d50c46c29 Use javac -release and kotlinc -Xjdk-release (#1080)
The change ensures the generated bytecode adheres to the APIs
for the target Java release.

Previously, only sourceCompatibility and targetCompatibility were used,
and they might cause issues like NoSuchMethodError when a newer javac
compiles with -target older_release.

Note: it is good to use a new an up to date javac to avoid issues
in the compiler itself, so having a proper `-release ..` configuration
is vital.

See https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderr
2025-05-28 09:38:53 -07:00
Islon Scherer
a19e6bf684 Fix doc dependency link (#1078) 2025-05-28 18:08:38 +02:00
Jen Basch
021f43bec4 I'm Jen! (#1072) 2025-05-19 11:55:24 -07:00
Islon Scherer
fe2e4aa1a4 Simplify precedence and associativity parsing (#1066) 2025-05-12 14:59:26 +02:00
Josh B
948a20ad0c Add mapNonNullIndexed API to List and Set (#1063) 2025-05-08 15:57:28 +02:00
Sitaktif
919d63e51a docs: fixed referenced property in "fixed" section (#1065) 2025-05-08 15:52:40 +02:00
Artem Yarmoliuk
e4716c9e45 Add command to generate shell completion (#1052)
Co-authored-by: Daniel Chao <daniel.h.chao@gmail.com>
Co-authored-by: Islon Scherer <islonscherer@gmail.com>
2025-05-01 08:39:30 -07:00
Daniel Chao
49a593f5c9 Add release notes for 0.28.2 (#1043) 2025-04-17 08:58:56 -07:00
Daniel Chao
e98b42cffd Fix incorrect substring (#1028)
The relative path should be based off the module name prefix, not the
package name.
2025-04-14 16:22:46 -07:00
Daniel Chao
38c44860d4 Fix compiler error in benchmark (#1040) 2025-04-11 16:08:20 -07:00
Jeroen Soeters
854074e619 Do not crash, but suggest '--multiple-file-output-path' when specifying a directory as output file (#1038)
When specifying a directory instead of a file for the output, pkl won't crash anymore, but instead output an error message, suggesting --multiple-file-output-path.
2025-04-08 10:56:15 -07:00
mbvissers
3119e0781b Fix typo in evolution-and-roadmap.adoc (#1031) 2025-04-01 11:34:47 -07:00
Daniel Chao
b445713b8c Publish executables for pkldoc, pkl-codegen-java, pkl-codegen-kotlin (#1023)
This adds logic to build and publish the other executables related to Pkl.

These are:

* pkl-doc
* pkl-codegen-kotlin
* pkl-codegen-java

pkl-codegen-kotlin and pkl-codegen-java are published as executable JARs, whereas pkldoc is published both as an executable JAR, and also native executables (matching the set of os/arch supported by Pkl).

The reason this only publishes executable JARs for pkl-codegen-kotlin and pkl-codegen-java is because we expect that the Java requirement is not a problem for these users, and that the native executable provides negligible added value.

As part of this, the following changes are made:

* Introduce `pklJavaExecutable` plugin, which sets up building and publishing of executable JAR.
* Introduce `pklNativeExecutable` plugin, which sets up building and publishing of native executables.
* Introduce `NativeImageBuild` Gradle task, which knows how to build native-image executables.
* Introduce `ExecutableSpec` extension, for projects that publish executables to configure how those executables should be published.
* `./griddles buildNative`, by default, will only build the executable of the host OS/Arch, and will no longer cross-build.
* The target arch of `./gradlew buildNative` can be changed using `-Dpkl.targetArch=<aarch64|amd64>`.
* On linux/amd64 only, with `./gradlew buildNative`, a statically linked executable can be built using `-Dpkl.musl=true`
* Make `javaExecutable` a dependency of `assemble`
* Make `testStartJavaExecutable` a dependency of `check`
* Change name `pklNativeBuild` to `pklNativeLifecycle` to better match the plugin's purpose
* Remove Truffle SVM classes from main source set (don't publish these classes as part of the pkl-cli JAR)
* Change CircleCI definition to publish new executables
* Change CircleCI definition to call `buildNative` instead of individual task names
2025-03-19 09:08:12 -07:00
Islon Scherer
aad530b9a8 move parser out of pkl-core (#1024) 2025-03-18 20:23:53 +01:00
Islon Scherer
1cd0549bd6 remove stacking of block comments (#1022) 2025-03-12 18:24:38 +01:00
Kushal Pisavadia
8b7d59e4e4 Build with m2pro.large instances, not macos.m1.large.gen1 (#1020)
* Update `com.circleci.v2` to `1.5.0` and `pkl.impl.circleci` to `1.2.0`

See:
- https://github.com/apple/pkl-pantry/pull/103
- https://github.com/apple/pkl-project-commons/pull/7

* Build with `m2pro.large` instances, not `macos.m1.large.gen1`
2025-03-11 11:20:43 +01:00
Kushal Pisavadia
f7eaeddc78 Alphabetically sort the projects list in settings.gradle.kts (#1015) 2025-03-07 15:06:14 +01:00
Daniel Chao
18e7a7e87e Add optimization for generator bodies that don't introduce new members (#1013)
If a generator object literal doesn't add any object members, we
can simply use the parent in its place.

Co-authored-by: Kushal Pisavadia <kushi.p@gmail.com>
2025-03-05 10:25:54 -08:00
Daniel Chao
bf484b3431 Revert Gradle plugin tests to use deprecated API (#1011)
Using the replacement API fails with:
"DefaultTaskContainer#register(String, Class, Action) on task set cannot be executed in the current context."
2025-03-04 07:58:16 -08:00