Commit Graph

224 Commits

Author SHA1 Message Date
Philip K.F. Hölzenspies
64bfcfdc4f Resolve project dirs from working dir by default 2024-06-25 13:13:48 +01:00
Daniel Chao
5c950d2e73 docs: add contributor for 0.26 release (#546)
Add a contributor name who was missing from acknowledgements.
2024-06-24 07:47:26 -07:00
Philip K.F. Hölzenspies
0ef22a73fb Start next dev iteration 2024-06-17 19:53:30 +01:00
Philip K.F. Hölzenspies
4a27ac5bda Prepare 0.26.0 release 2024-06-17 19:53:30 +01:00
Daniel Chao
570c2085b3 Recover if rm command removes no files (#538) 2024-06-17 10:47:58 -07:00
Philip K.F. Hölzenspies
d55866a04b Fix commitish detection in LanguageSnippetTest to also cover release versions (#537) 2024-06-17 18:21:22 +01:00
Philip K.F. Hölzenspies
600939457a Set Windows build to use compatibility mode for native-image builds (#536) 2024-06-17 17:25:17 +01:00
Philip K.F. Hölzenspies
e996a342cc Remove links from headers in release notes (#535) 2024-06-17 16:43:22 +01:00
Daniel Chao
00c2e00bb9 Add release notes for 0.26 (#529)
This adds release notes for 0.26.

Also:

* Adjust IJ settings to ignore certain http: strings
* Add note about http introduced in 0.26 in message passing api

Co-authored-by: Philip K.F. Hölzenspies <holzensp@gmail.com>
2024-06-17 08:03:41 -07:00
Philip K.F. Hölzenspies
bcee291fdc Fix release build gradle setup (#533) 2024-06-17 16:01:28 +01:00
Alan Scherger
4a7f90157a Documentation fix: const cannot be assigned/amended (#485) 2024-06-14 10:10:41 -07:00
Daniel Chao
f15ad6ec06 Change CLI flag and Gradle name for proxy options (#526)
Rationale: "proxy" can mean very different things (e.g. java.lang.reflect.Proxy in Java).
This makes the flag name more specific.

CLI:
* `--proxy` -> `--http-proxy`
* `--no-proxy` -> `--http-no-proxy`

Gradle:
* `proxyAddress` -> `httpProxy`
* `noProxy` -> `httpNoProxy`
2024-06-14 08:08:21 -07:00
Daniel Chao
380095c8a7 Change Gradle property to "rename" (#528)
This changes the property to match the name of the CLI flag.
2024-06-14 07:36:28 -07:00
Daniel Chao
9c287a2e48 Catch PklException errors coming from project load (#527)
This fixes an issue where an error coming from loading a project file is shown as a PklBugException.

There were two problems here:

1. proxyAddress needs to be a lazy value, because it can try to load a PklProject
2. accessing proxyAddress can throw a PklException, so it needs to be within the try/catch
2024-06-14 07:33:44 -07:00
Daniel Chao
3bd9214858 Adjust docs for proxying (#523)
Update/polish up the documentation around http proxying
2024-06-13 09:46:21 -07:00
Daniel Chao
919de4838c Improve handling of CA certificates (#518)
Instead of bundling Pkl's built-in CA certificates as a class path resource and loading them at runtime,
pass them to the native image compiler as the default SSL context's trust store.
This results in faster SSL initialization and is more consistent with how default certificates
are handled when running on the JVM.

Further related improvements:
- Remove HttpClientBuilder methods `addDefaultCliCertificates` and `addBuiltInCertificates`.
- Remove pkl-certs subproject and the optional dependencies on it.
- Move `PklCARoots.pem` to `pkl-cli/src/certs`.
- Fix certificate related error messages that were missing an argument.
- Prevent PklBugException if initialization of `CliBaseOptions.httpClient` fails.
- Add ability to set CA certificates as a byte array
- Add CA certificates option to message passing API
2024-06-12 17:53:03 -07:00
Vladimir Matveev
d7a1778199 Allow renaming Java/Kotlin classes/packages during code generation (#499)
Adds a `rename` field to the Java/Kotlin code generators that allows renaming packages and classes during codegen.

* Add `--rename` flag to CLIs
* Add `rename` property to Gradle API
2024-06-12 15:43:43 -07:00
Philip K.F. Hölzenspies
b03530ed1f Add support for HTTP proxying (#506)
* Add `--proxy` and `--no-proxy` CLI flags
* Add property `http` to `pkl:settings`
* Move `EvaluatorSettings` from `pkl:Project` to its own module and add property `http`
* Add support for proxying in server mode, and through Gradle
* Add `setProxy()` to `HttpClient`
* Add documentation
2024-06-12 11:54:22 -07:00
Daniel Chao
a520ae7d04 Fix missing paragraph in Windows installation docs (#520) 2024-06-11 08:00:37 -07:00
Daniel Chao
21749f5c82 Use Pkl syntax highlighting instead of Groovy (#519)
Now that Pkl syntax highlighting is available on GitHub,
we can remove the Groovy association with these files.

This also adds changes to mark `*.pcf` and `PklProject` files as Pkl.
2024-06-11 07:58:24 -07:00
Daniel Chao
a4c0a271b4 Require references from typealiases to be const (#516)
This adds a language change that requires references from typealiases
to the enclosing module to be `const`.

This is required because typealiases are not late-bound.

Rationale is laid out in SPICE-0007.

Also:
* Update documentation to reflect new rules.
* Fix `Project.pkl`; mark method `const` to not break said rule.
2024-06-10 09:01:05 -07:00
Daniel Chao
9cc9816440 Fix native tests in CircleCI (#514)
Fix an issue where the CI job attempts to install the wrong executable
when on macOS/aarch64.

Also, adjusts native test definitions in pkl-server to match pkl-core.
2024-06-05 09:05:16 -07:00
Daniel Chao
d5ba8fa736 Support scheme-agnostic projects (#486)
This adds changes to support loading project dependencies in non-file based projects.

The design for this feature can be found in SPICE-0005: https://github.com/apple/pkl-evolution/pull/6

Changes:
* Consider all imports prefixed with `@` as dependency notation.
* Bugfix: fix resolution of glob expressions in a local dependency.
* Adjust pkl.Project:
  - Allow local dependencies from a scheme-local paths.
  - Disallow certain evaluator settings if not loaded as a file-based module.
* Breaking API change: `ProjectDependenciesManager` constructor now requires `ModuleResolver` and `SecurityManager`.
2024-06-04 16:52:20 -07:00
Daniel Chao
c0a7080287 Fix line endings (#513)
* Adjust gitattributes file (mark some files binary, mark bat files as using crlf endings)
* Fix remaining line endings issues
2024-06-04 07:55:33 -07:00
translatenix
207d0c78f0 Fix globbed read/import bugs (#449)
* Split MemberNode into (Regular/Shared)MemberNode

SharedMemberNode enables generating non-constant object members
at run time without generating an unbounded number of Truffle root nodes.

* Invert shouldRunTypeCheck to match its name

* Introduce VmObjectBuilder

Introduce VmObjectBuilder, a uniform way to build `VmObject`s
whose `ObjectMember`s are determined at run time.
Replace some manual object building code with VmObjectBuilder.
Add some assertions to fix IntelliJ warnings.

* Improve implementation of globbed read/import nodes

- Leverage SharedMemberNode to have a single Truffle root node per globbed
  read/import expression instead of one root node per resolved glob element.
- Remove caching in ReadGlobNode because it only works correctly if glob pattern is a string *constant*.
- Remove caching in StaticReadNode (now ReadGlobElementNode/ImportGlobElementNode)
  because it seems unnecessary and the implementation doesn't look quite right.

* Simplify code

* Fix ClassCastException when reflecting on globbed import

* Fix caching of globbed reads

Problem:
The result of a globbed read depends not only on the glob pattern but also on the current module URI.
However, ResourceManager does not take this into account when caching globbed reads, causing wrong results.

Changes:
- Cache globbed reads per read expression.
  This is also how globbed imports are cached, except that import URIs are constant.
- Make ReadGlobNode and ImportGlobNode code as similar as possible.
- Reduce code duplication by inheriting from AbstractReadNode.
- Add some tests.
2024-06-03 17:10:56 -07:00
Daniel Chao
d81a12352c Improve configuration and tests for native-image (#509)
* Don't expose JDK internal classes; instead solve msgpack issue with `--initialize-at-run-time`.
* Use quick build mode for non-release builds:  40% faster compilation, 20% smaller executable.
* Remove options that were commented out.
* Also run ServerTest against native executable
2024-06-03 17:08:30 -07:00
Kushal Pisavadia
a48748cb9c Remove documentation references to packageInfos (#512)
It references something that isn't present and should be removed.
2024-06-03 09:19:28 -07:00
Daniel Chao
5b7123131f Change line endings from CRLF to LF (#511) 2024-05-30 08:41:21 -07:00
Daniel Chao
8ec06e631f Add support for Windows (#492)
This adds support for Windows.
The in-language path separator is still `/`, to ensure Pkl programs are cross-platform.

Log lines are written using CRLF endings on Windows.
Modules that are combined with `--module-output-separator` uses LF endings to ensure
consistent rendering across platforms.

`jpkl` does not work on Windows as a direct executable.
However, it can work with `java -jar jpkl`.

Additional details:

* Adjust git settings for Windows
* Add native executable for pkl cli
* Add jdk17 windows Gradle check in CI
* Adjust CI test reports to be staged within Gradle rather than by shell script.
* Fix: encode more characters that are not safe Windows paths
* Skip running tests involving symbolic links on Windows (these require administrator privileges to run).
* Introduce custom implementation of `IoUtils.relativize`
* Allow Gradle to initialize ExecutableJar `Property` values
* Add Gradle flag to enable remote JVM debugging

Co-authored-by: Philip K.F. Hölzenspies <holzensp@gmail.com>
2024-05-28 15:56:20 -07:00
Daniel Chao
5e4ccfd4e8 Omit showing stdlib as dependency in pkldoc (#503)
The stdlib is an implicit dependency for every package.
Showing this as a dependency is unnecessary noise.
2024-05-28 13:42:57 -07:00
Daniel Chao
47f161a211 Clean up unnecessary CI (#502) 2024-05-21 08:48:02 -07:00
Nikola Irinchev
c1949a99b0 Update amending example in tutorial (#491)
* Update amending example

* Make sure wood pigeon amends stock pigeon

Co-authored-by: Philip K.F. Hölzenspies <holzensp@gmail.com>

---------

Co-authored-by: Philip K.F. Hölzenspies <holzensp@gmail.com>
2024-05-17 13:05:28 +01:00
Daniel Chao
d0def765a2 Make http(s) URIs their own module key (#495)
GenericUrl is a catch-all that uses URL.openConnection().
Since we now have special handling of HTTP urls, it makes more sense to
put it in its own module key.
2024-05-16 08:38:43 -07:00
Daniel Chao
5f4d475d84 Fix local dependency globbing (#496)
This fixes an issue where globbing resources within a local dependency
fails to match anything.
2024-05-16 08:36:37 -07:00
Dan Chao
a5c13e325a Encode filepaths to be safe on Windows
This changes the file paths to use characters that are safe for Windows.

Channges the output of the following:
* Package cache directory
* Generated pkl-doc files
* Kotlin generated code

Unsafe characters are encoded as (<hex>).
For example, the colon character `:` is encoded as `(3a)`.

Additionally, this changes the cache directory prefix (package-1 to
package-2).

Follows the design of https://github.com/apple/pkl-evolution/pull/3
2024-05-13 14:06:28 -07:00
Dan Chao
110dc89e86 Improve URI encoding in pkldoc
Only encode characters that are strictly necessary in URI paths.

This removes encoding for parentheses, for example.
2024-05-13 14:06:28 -07:00
Gary Sassano
2d31bc5ef5 Adjust filename according to style guide (#484) 2024-05-13 10:09:43 -07:00
Daniel Chao
7da643fc8f Handle null pathElements gracefully in message passing API (#480)
In messages "List Resources Response" and "List Modules Response",
if `pathElements` and `error` are both null, default to an empty list.
2024-05-08 07:22:57 -07:00
Daniel Chao
21aa44cfc4 Require global settings file to use pkl:settings (#477)
This is technically a breaking change, but follows the intended use-case
and documentation of settings.

* Require that the global settings file at `~/.pkl/settings.pkl`
amends stdlib module `pkl:settings`, or otherwise sets `output.value`
to an instance of `pkl.Settings`.
* Simplify the object mapping of `PklSettings.java`
2024-05-07 07:49:00 -07:00
translatenix
aeb17588b3 Simplify implementation of RequestCapturingClient (#473) 2024-05-06 12:02:45 +02:00
Daniel Chao
d28313bca8 Declare members of http package NonnullByDefault (#471)
* Add a package-info.java with NonnullByDefault annotation
* Make RequestCapturingClient return a response to satisfy the type checker
2024-05-03 09:58:01 -07:00
Islon Scherer
27d8a030b1 Remove hidden modifier from many reflect properties for better equality/rendering (#470) 2024-05-03 11:04:15 +02:00
Philip K.F. Hölzenspies
b5208a2b5b Swap Kotlin/Groovy tab order in documentation (#469)
* Swap Kotlin/Groovy tab order in documentation

* Use Kotlin DSL repository extension function
2024-05-02 15:26:43 +01:00
kuu(Fumiya Kume)
c959888f0b Fix CI to use JDK17 in deployment jobs (#468) 2024-05-01 09:09:36 -07:00
translatenix
ea3e8f115b Improve conditional configuration of native build tasks (#465)
- Move all conditional configuration to the `assembleNative` and `testNative` "root" tasks
- Don't build aarch64 executable on Intel Mac
2024-04-30 15:57:39 -07:00
translatenix
e49a36e318 Make Java classes final if possible
Also add private no-arg constructors for classes that aren't meant to be instantiated.
2024-04-30 15:14:14 -07:00
translatenix
ae69e4776f Fix IntelliJ warnings in Java code
Fix all IntelliJ warnings in Java production code except for
bogus spelling warnings and warnings about unused public methods.
Also fix some warnings emitted by Code->Inspect Code.

Changes made:
- use text block instead of string concatenation
- extract method to avoid code duplication
- use switch expression
- fix Javadoc syntax and spelling
- fix spelling in comment
- increase class visibility to match visibility of use site
- delete overriding method with same implementation
- use String.isEmpty() and StringBuilder.isEmpty()
- add @Serial annotation
- make field final
- remove unused field
- remove unused private method
- remove exceptions that aren't thrown from throws clause
- insert non-null assertion
- annotate overriding method with @Nonnull
- suppress warning
- delete unused class (WriteAuxiliarySlotNode)
- add final modifier
- remove unused error message
- repeat @Nullable modifier in overriding method
- remove never thrown exception from throws clause
- remove redundant suppression
2024-04-30 15:14:14 -07:00
translatenix
5feaa2aaf7 Remove remnants of Alpine Linux workaround (#466) 2024-04-30 15:12:30 -07:00
Daniel Chao
ed1b317801 Fix formatting error (#463) 2024-04-30 07:33:36 -07:00
Daniel Chao
0d3400fb59 Don't install GraalVM for an architecture that can't be built (#452)
This fixes an issue where the build native tasks will try
to install GraalVM for an architecture that it can't build.
2024-04-29 15:36:27 -07:00