Support babashka.process reload for exec fn (#1558)

* Support babashka.process reload for exec fn

Exposed GraalVM `ProcessProperties/exec` signature used by
babashka.process/exec.

Add new `graal?` feature (on by default) to allow folks to build/use
babashka without this specific Graal API.

On my linux dev box bb executable increased by 8kb.

Closes #1557

* Respond to PR review feedback

1. Allow all Graal ProcessProperties/exec signatures

2. Instead of a feature flag, simply check if Graal ProcessProperties
class is available before including ProcessProperties/exec.
I did not see the value of adding a has-graal-process-properties fn, so
left that part out. Lemme know if you want/need that.

* Respond to PR review feedback

Because resolves can bloat GraalVM native-image size, we like to keep
the together and obvious instead of buried and non-obvious.
This commit is contained in:
Lee Read 2023-05-13 17:22:18 -04:00 committed by GitHub
parent b22092a318
commit 342cedbcfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -14,6 +14,7 @@ in the CfP!
## Unreleased
- [#1524](https://github.com/babashka/babashka/issues/1524): Remove dynamic builds for linux-aarch64 ([@lispyclouds](https://github.com/lispyclouds))
- [#1577](https://github.com/babashka/babashka/issues/1557): Add support for `babashka.process/exec` after namespace reload of `babashka.process` ([@lread](https://github.com/lread))
## 1.3.179 (2023-04-26)

View file

@ -15,6 +15,9 @@
(def has-domain-sockets?
(resolve 'java.net.UnixDomainSocketAddress))
(def has-graal-process-properties?
(resolve 'org.graalvm.nativeimage.ProcessProperties))
(def base-custom-map
`{clojure.lang.LineNumberingPushbackReader {:allPublicConstructors true
:allPublicMethods true}
@ -182,7 +185,11 @@
`java.util.ResourceBundle
{:methods [{:name "getBundle"
:parameterTypes ["java.lang.String","java.util.Locale",
"java.lang.ClassLoader"]}]})))
"java.lang.ClassLoader"]}]})
has-graal-process-properties?
(assoc `org.graalvm.nativeimage.ProcessProperties
{:methods [{:name "exec"}]})))
(def java-net-http-classes
"These classes must be initialized at run time since GraalVM 22.1"