Commit Graph

125 Commits

Author SHA1 Message Date
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
Daniel Chao
6746040362 Fix: add missing "const" and "fixed" modifiers to reflect API (#265)
This fixes an issue where the reflect API does not show fixed or const modifiers on a property.
2024-02-29 07:02:09 -08:00
Daniel Chao
ddfab2a280 Add CI check to test patch file (#253)
This tests that the patch file can apply in CI.
2024-02-28 08:10:54 -08:00
Daniel Chao
b0161a4777 Add specification for language binding API (#257)
This adds documentation for how the language bindings works, for those that wish to create their own bindings.
2024-02-28 08:10:16 -08:00
Daniel Chao
2499e2c493 Fix patch file (#252)
This fixes an issue that is perventing our patch from from being
applied.
2024-02-27 07:50:00 -08:00
translatenix
813572f0d2 Add Pkl logo to README (#242) 2024-02-26 18:28:29 +01:00
Islon Scherer
90dedb7837 remove file with \ on the name as windows does not support it (#251) 2024-02-26 15:03:46 +01:00
translatenix
b7b0e65cc6 Delete unused image (#243)
This image is not used anywhere.
2024-02-23 14:50:48 -08:00
Daniel Chao
96c0e5fb03 Add com.oracle.truffle to shaded libs (#238)
This allows two libraries that use Truffle to coexist
in a host application.
2024-02-23 09:07:18 -08:00
translatenix
32bc75bf50 Add targets for org.pkl.core.util.Nullable (#235)
Also, change `java.time.@Nullable Duration` to `@Nullable java.time.Duration` to reduce the chance
of false positive errors in IDEs.
2024-02-23 07:07:08 -08:00
Sam Gammon
7f404fff49 Add setting for Kotlin package to codegen (#194) 2024-02-23 11:54:05 +01:00
translatenix
48a000aa1a Fix Gradle test tasks in pkl-server (#176)
Before: "test" runs no tests, "unitTests" runs all tests
After : "test" runs all tests
2024-02-22 19:58:06 -08:00
translatenix
2c54643037 Breaking: rename some CLI classes for consistency (#169)
CliDownloadPackageCommand -> CliPackageDownloader (consistent with CliProjectPackager/CliProjectResolver)
CliAbstractProjectCommand -> CliProjectCommand (consistent with CliCommand)
2024-02-22 19:53:01 -08:00
translatenix
a85ffd3cab Order entries alphabetically (as stated) (#236)
Also remove an obsolete comment.
2024-02-22 17:04:20 -08:00
translatenix
115e775d1b Fix Gradle build warning (#232)
The warning was introduced by 1e502009.
2024-02-22 15:06:17 -08:00
translatenix
d756dff0e7 Delete stale files in LanguageSnippetTests/output
When I delete pkl-core/src/test/files/LanguageSnippetTests/output and
run "gw test", most output files are regenerated, but 46 of them aren't.
I assume these are stale files that should be deleted.
2024-02-22 15:05:14 +00:00
Mitch Capper
9cc1796429 Minor development/contributing/ci doc links / additions 2024-02-22 15:04:12 +00:00
Sam Gammon
eb170017f6 Fix dropped implementSerializable flag
Fixes and closes apple/pkl#191

Signed-off-by: Sam Gammon <sam@elide.ventures>
2024-02-22 13:23:09 +00:00
Zack McCauley
8f130d8d49 Fix multiple output example code (#205) 2024-02-22 10:28:23 +01:00
Islon Scherer
c652bbe5cd fix typo in doc for Listing default (#224) 2024-02-21 18:56:11 +01:00
Sam Gammon
ca31185302 Move tool versions to Version Catalog
- fix: make version catalog accessible from `buildSrc` plugins
- chore: declare `googleFormatVersion` in version catalog
- chore: declare `ktfmt` in version catalog

Relates-To: apple/pkl#204
Signed-off-by: Sam Gammon <sam@elide.ventures>
2024-02-21 12:01:49 +00:00
translatenix
21e0e149ac Tweak User-Agent header
It is customary to separate elements with a semicolon.
2024-02-21 11:40:46 +00:00
Sam Gammon
1e50200969 Use Gradle typed project accessors
This change activates the `TYPESAFE_PROJECT_ACCESSORS` feature
preview in Gradle, and switches to such accessors instead of
string-based project references, where possible

Relates-To: apple/pkl#204
Signed-off-by: Sam Gammon <sam@elide.ventures>
2024-02-21 11:36:02 +00:00
Sam Gammon
cb33a7cdb0 Skip POM validation for unpublished projects
This small change fixes a bug introduced by the `validatePom` task
within the `pklPublishLibrary` plugin. When running project-wide
tasks like `./gradle tasks`, projects which don't provide a POM
fail the build, because the `generatePomFileForLibraryPublication`
cannot be found, but it is expected to be present.

Fixes and closes apple/pkl#215

Signed-off-by: Sam Gammon <sam@elide.ventures>
2024-02-21 11:32:47 +00:00