Commit Graph

148 Commits

Author SHA1 Message Date
Stefan M
033db30b04 Convert CODE_OF_CONDUCT to Markdown (#417) 2024-04-11 21:25:53 -07:00
translatenix
bba5387f17 Update dependencies (#350)
* Update various dependencies
* Freeze kotlinx.html and kotlinx.serialization versions until Kotlin itself is updated.
2024-04-11 20:54:01 -07:00
Philip K.F. Hölzenspies
309e3ff4f6 Update expected test outcome 2024-04-10 14:02:36 +01:00
luuvish
375b88f53e Fix the sequence length in the YAML parser
The initialSize in EconomicsMaps.create() is not the actual stored size,
hence the accurate size is not determined until ObjectMembers are added
after addMembers() called.

Since the size set during the creation of VmListing cannot be changed
afterwards, the size of node.getValue() is used instead of members'
size.
2024-04-10 14:02:36 +01:00
translatenix
3c6df1fe34 Turn EvalTask into a tracked Gradle task
Rationale: "Output file names are known only after execution"
isn't a legitimate reason to make this task untracked
because the output directory is known in this case.
This is no different from (say) the `JavaCompile` task,
where only the class file output directory is known upfront.
Forum discussion didn't reveal another reason why this task
should be untracked.
2024-04-05 15:04:48 +01:00
translatenix
2392a3c22f Add quick link to standard library docs
Motivation:
The standard library docs are some of the most important docs
but currently very hard to find. I've noticed that even advanced
users have never heard of them and complain about "zero docs".
2024-04-05 12:38:55 +01:00
Jungwoo
0f9ef53126 fix: add test 2024-04-05 11:18:02 +01:00
Jungwoo Yang
35490dc559 Fix MergeSort.java 2024-04-05 11:18:02 +01:00
translatenix
d916345d2c Use Files.newInputStream()/newOutputStream() where appropriate (#383)
Use `Files.newInputStream(path)` instead of `new FileInputStream(path.toFile())`
and `Files.newOutputStream(path)` instead of `new FileOutputStream(path.toFile())`.
2024-04-04 16:04:14 -07:00
translatenix
57f45c80c6 Update to Gradle 8.7 (#396)
Update Gradle by running the following command:
gw wrapper --gradle-version latest --gradle-distribution-sha256-sum
544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d

Manually verify wrapper JAR according to:
https://docs.gradle.org/current/userguide/gradle_wrapper.html#manually_verifying_the_gradle_wrapper_jar
2024-04-04 16:02:22 -07:00
Daniel Chao
58ed8242af Fix links for downloading snapshot executables (#391)
Also, quote the URLs for better shell compatibility
2024-04-04 07:43:42 -07:00
translatenix
3bd91b92ee Fix "amends declaration vs. expression" mistakes in language reference 2024-04-03 19:06:54 +01:00
Daniel Chao
28448b5512 Ensure owner and receiver are reset after executing alias (#373)
This fixes an issue where the frame's owner/receiver are not reset
if a type test on a typealias fails.
2024-03-28 07:58:22 -07:00
Daniel Chao
759d4806c0 Fix java/kotlin usage examples (#372)
Co-authored-by: Fruxz <28064149+TheFruxz@users.noreply.github.com>
2024-03-28 07:57:28 -07:00
Daniel Chao
c28e478d5a Fix links to pkl-go and pkl-swift repos (#364)
Using `xref` turns these links into fragments.
2024-03-27 12:30:41 -07:00
Daniel Chao
4bdfe40816 Import release notes for 0.25.3 (#365)
This adds the release notes for 0.25.3 into CHANGELOG.
2024-03-27 11:56:29 -07:00
Philip K.F. Hölzenspies
e347b26cf6 Avoid resolving paths on fragments (#357)
Fixes an issue where modules with fragment paths are resolved against the URI path.
2024-03-26 08:16:02 -07:00
Daniel Chao
c9ed183891 Fix source links in pkldoc (#362)
Fixes an issue where source links are incorrectly URI encoded; i.e. `https%3A//github.com` instead of `https://github.com`.

This was causing the browser to resolve these as relative to the enclosing page.
2024-03-26 07:48:55 -07:00
translatenix
11a2343a65 Change HttpClientInitException to extend RuntimeException (#359)
PklException is mainly used to indicate errors during evaluation of Pkl code.
It isn't a suitable superclass for HttpClientInitException.
2024-03-22 16:32:16 -07:00
translatenix
deaf6983c4 Follow HTTP redirects (#328)
- Change HttpClient to follow all redirects except HTTPS to HTTP.
- Run language snippet tests with --no-cache and real PackageServer
  instead of pre-seeded cache.
  This increases HTTP test coverage and enables testing of package redirects.
- Change PackageServer to return 301 for request paths starting with /HTTP301/
  and 307 for request paths starting with /HTTP307/.
- Update some outdated test package checksums that apparently weren't verified.
2024-03-21 10:26:07 -07:00
translatenix
60bcd56672 Eliminate unnecessary use of GregorianCalendar (#344)
Switch from `java.util.GregorianCalendar` to `java.time.LocalDateTime`
2024-03-21 08:50:14 -07:00
Daniel Chao
1a16619522 Re-enable gradle compatibility tests (#349) 2024-03-21 08:14:08 -07:00
Stefan M
7584fb8d25 Enable Gradle caching (#324) 2024-03-20 10:48:19 -07:00
translatenix
dfe85b786e Replace magic test port 12110 with 0 (#345)
Also introduce constants for some test package SHAs
to make them easier to update.
2024-03-20 10:47:28 -07:00
Islon Scherer
2aa60eaf1f change security file to markdown (#347) 2024-03-20 14:39:51 +01:00
Daniel Chao
7e948d317c Add workaround for configuration error during maven publish (#342)
The maven publish plugin isn't setting up dependencies correctly,
and we are getting errors like:

 "Task ':pkl-config-java:publishFatJarPublicationToMavenLocal' uses
  this output of task ':pkl-config-java:signLibraryPublication' without
   declaring an explicit or implicit dependency."

This adds a workaround for this type of error.
2024-03-19 11:40:13 -07:00
Stefan M
46d65506d5 Do not package empty directories (#330)
Changes the packager to exclude any empty directories.

This change means that pkl project package for an already published packages will fail. The packager checks for an existing package at this version, and compares checksums. It will then error if the checksum has changed.

This is technically a breaking change, albeit a minor one. The workaround is to publish new versions of packages.

Published packages should still be compatible with Pkl 0.25.
2024-03-19 09:34:47 -07:00
Malix
5d0d2ce7a1 Add TOML to comparison page (#337)
Puts TOML next to JSON, XML, YAML
2024-03-19 09:14:56 -07:00
Zihlu Wang
2bf1fa215a Update pkl-config-java.adoc (#340)
Remove unpaired back curly bracket.
2024-03-19 09:13:46 -07:00
Zihlu Wang
4ce7a82db5 Removed undeclared method reference in examples. (#341)
There is no method `evaluateText` in `ConfigEvaluator` or `ConfigEvaluatorImpl`.
2024-03-19 09:13:33 -07:00
Daniel Chao
76f3890cff Fix buildSrc Kotlin/Java compat (#339)
This fixes an issue where Gradle fails to build because of
Java/Kotlin getting mismatching versions when targeting macOS/aarch64.
2024-03-19 08:38:42 -07:00
Daniel Chao
e4ccf517fa Use layout.buildDirectory (#326)
This switches Gradle scripts to use `layout.buildDirectory` instead
of hard-coded "build".
2024-03-18 21:42:16 -07:00
Daniel Chao
1f68cf0251 Add approval for release/x.x branch (#338)
Temporary workaround for now because our CI policy requires it.
2024-03-18 15:17:22 -07:00
Daniel Chao
4be03b0eaf Add CI to release/x.x branch (#333)
Adds logic to build (but not deploy) commits on the release branch.

This is so we have CI coverage for new patch releases of older versions.
2024-03-18 09:45:51 -07:00
translatenix
6264f4b631 Fix build issue where test fixtures weren't generated (#327)
Make sure that declaring a dependency on project `pkl-commons-test`
suffices to have its test fixtures generated.

This fix should work reliably.
However, there may be a more idiomatic way to achieve the same result.
2024-03-15 22:08:37 -07:00
translatenix
496e064caf Update to Gradle 8.6 (#245)
- Fix and clean up the pkl-commons-test build script.
- Change tests to read test packages/certs directly from
  the file system instead of packaging and reading them
  from the class path.
- Update expected checksums of some test packages.
- Fix a conflict between Pkl's and Gradle's
  Kotlin libraries in the pkl-gradle project.
- Fix build deprecation warnings.
- Ensure Gradle distribution integrity with `distributionSha256Sum`.
- Manually verify integrity of Gradle wrapper added by this commit.
2024-03-15 17:00:23 -07:00
Daniel Chao
faa7ac69bb Fix amending module with abstract class (#319)
This fixes an assertion error that gets thrown if:
1. A module declares a class as abstract
2. An amending module does not use that abstract class as a type

Underneath the hood, the modifiers of the class/typelias object member
is considered different from the modifiers on the VmClass/VmTypeAlias
values.

The object model skips forcing any explicitly members that are explicitly
declared hidden, abstract, or local.
However, it _should_ evaluate any abstract classes found in a module.
So, it's incorrect to apply the same modifiers on the class to the object member.
2024-03-15 07:53:09 -07:00
Daniel Chao
9c1ae0d683 Use smaller compute resource for patch test (#315)
Change resource size to "small".
2024-03-13 16:04:45 -07:00
translatenix
014b3a8816 Bind PackageServer to ephemeral port to avoid port conflicts (#227)
This is a comprehensive solution to the "flaky PackageServer tests"
problem. It rules out port conflicts and imposes no limits on test
parallelism. The same solution can be used for other test servers
in the future.

Major changes:
- Turn `PackageServer` from a singleton into a class that is
  instantiated per test class or test method.
- Start the server the first time its `port` property is read.
  Bind the server to an ephemeral port instead of port 12110.
- For every test that uses `PackageServer`, pass the server port to
  `--test-port`, `HttpClient.Builder.setTestPort`, the `CliBaseOptions`
  or `ExecutorOptions` constructor, or the Gradle plugin's `testPort` property.
  Wire all of these to `RequestRewritingClient`'s `testPort` constructor parameter.
- Enhance `RequestRewritingClient` to replace port 12110 with `testPort`
  in request URIs unless `testPort` is -1 (its default).
- Introduce `ExecutorOptions.Builder`.
  This makes executor options more comfortable to create
  and allows to hide options such as `testPort`.
- Deprecate the `ExecutorOptions` constructor to steer users towards the builder.
- Get rid of `ExecutorOptions2`, which is no longer needed.
- Clean up `EmbeddedExecutorTest` with the help of the builder.
2024-03-13 10:40:55 -07:00
Kushal Pisavadia
1e608b2aae Persist jpkl to the workspace for releases (#314)
This is something that was published to Maven but not as a GitHub release.
 Persist it so that it can go out with a release.
2024-03-13 10:00:04 -07:00
Islon Scherer
8dc258ef7d fix bug with for generator variables in mixin (#297) 2024-03-07 20:47:21 +01:00
Daniel Chao
9defe868c0 Clean up http-client changes (#295)
* pkl-excutor tests: symlink 0.25.0 distribution into pkl-executable/build
* Use `IoUtils.getPklHomeDir` in HttpClientBuilder
* Simplify Exceptions.java
* Enable testing for older pkl-executor distribution
2024-03-07 10:43:04 -08:00
d4wae89d498
3fb1f03780 Fix missing closing quotes in Local dependencies #298 (#299)
Fix missing closing quotes in 'Local Dependencies' section of index.adoc to ensure syntax correctness.
2024-03-07 10:42:10 -08:00
translatenix
3f3dfdeb1e Use java.net.http.HttpClient instead of java.net.Http(s)URLConnection (#217)
Moving to java.net.http.HttpClient brings many benefits, including
HTTP/2 support and the ability to make asynchronous requests.

Major additions and changes:
- Introduce a lightweight org.pkl.core.http.HttpClient API.
  This keeps some flexibility and allows to enforce behavior
  such as setting the User-Agent header.
- Provide an implementation that delegates to java.net.http.HttpClient.
- Use HttpClient for all HTTP(s) requests across the codebase.
  This required adding an HttpClient parameter to constructors and
  factory methods of multiple classes, some of which are public APIs.
- Manage CA certificates per HTTP client instead of per JVM.
  This makes it unnecessary to set JVM-wide system/security properties
  and default SSLSocketFactory's.
- Add executor v2 options to the executor SPI
- Add pkl-certs as a new artifact, and remove certs from pkl-commons-cli artifact

Each HTTP client maintains its own connection pool and SSLContext.
For efficiency reasons, It's best to reuse clients whenever feasible.
To avoid memory leaks, clients are not stored in static fields.

HTTP clients are expensive to create. For this reason,
EvaluatorBuilder defaults to a "lazy" client that creates the underlying
java.net.http.HttpClient on the first send (which may never happen).
2024-03-06 10:25:56 -08:00
Daniel Chao
106743354c Improve CircleCI builds (#294)
* Prevent build_artifacts.txt files from being published as
  GitHub releases
* Bump version to 1.0.2; make PRBs not depend on flakey pr-approval job
2024-03-06 09:25:40 -08:00
Daniel Chao
11f07d1ce8 Revert "Add setting for Kotlin package to codegen (#194)" (#271)
This reverts commit 7f404fff49.

The package is derived from the module name.
Having `module com.example.Foo` in Pkl
will create Kotlin `package com.example`.

Eventually, we may want to introduce a way to map
Pkl names to package names that provides finer
controls to the code generator.
2024-03-04 07:51:39 -08:00
Daniel Chao
4f3858aaaf Docs fix: Container is not a type, add more types (#282)
Adjusts documentation to remove legacy `Container` type,
and add the rest of the generic types in the stdlib.
2024-03-04 07:49:44 -08:00
Daniel Chao
d7196e1207 Docs fix: Java 8 is not supported (#283)
Java 11 is the minimum version, rather than 8.
2024-03-04 07:49:20 -08:00
Islon Scherer
9c3a761cfa add test for checking out of sync snippets (#240) 2024-03-01 16:44:36 +01:00
Daniel Chao
0ae9e0c5c0 Add homebrew instructions to docs (#270) 2024-02-29 11:02:36 -08:00