Skip to content

Commit e9b41b5

Browse files
committed
chore: how-it-works section for readme
Signed-off-by: Sam Gammon <[email protected]>
1 parent 4b87549 commit e9b41b5

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Experimental plugin for using [Elide](https://github.com/elide-dev/elide) from w
1616
3) **That's it! Enjoy faster dependency resolution and Java compilation.**
1717
1818
> [!NOTE]
19-
> We hope to eliminate this shim soon.
19+
> We hope to eliminate the `JAVA_HOME` shim soon.
2020
2121
### Usage
2222
@@ -90,3 +90,41 @@ Learn more about Elide at [elide.dev](https://elide.dev).
9090
- [ ] Augment project metadata for reporting
9191
- [ ] Generate dependency manifests
9292
93+
### How does it work?
94+
95+
[Elide](https://github.com/elide-dev/elide) is a [GraalVM](https://graalvm.org) native image which functions as a Node-
96+
like runtime. It speaks multiple languages, including Java, Kotlin, Python, JavaScript, TypeScript, WASM, and Pkl.
97+
98+
In addition to features which run code (i.e. the runtime!), Elide _also_ is a full batteries-included toolchain for
99+
supported languages, including:
100+
101+
- A drop-in replacement for `javac` and `kotlinc`
102+
- A drop-in replacement for `jar` and `javadoc`
103+
- Maven-compatible dependency resolution and fetching
104+
105+
This plugin configures your Gradle build to use Elide's dependency and/or compile features instead of Gradle's.
106+
107+
#### Compiling Java with Elide + Gradle
108+
109+
Gradle's `JavaCompile` tasks are configured to use Elide through `isFork = true` and `forkOptions.executable`. These
110+
point to a shim in the `JAVA_HOME` which invokes `elide javac -- ...` instead of `javac ...`.
111+
112+
As a result, JIT warmup is entirely skipped when compiling Java. **Projects under 10,000 classes may see better compiler
113+
performance, in some cases up to 20x faster than stock `javac`.**
114+
115+
#### Fetching Dependencies with Elide + Gradle
116+
117+
Elide resolves and fetches Maven dependencies with identical semantics to Maven's own resolver, but again in a native
118+
image, and with an optimized resolution step (through the use of a checked-in lockfile).
119+
120+
When activated for use with Gradle, a few changes are made to your build:
121+
122+
- **An invocation of `elide install`** is added before any Java compilation tasks.
123+
- **Gradle is configured for a local Maven repo** at `.dev/dependencies/m2`, which is where Elide puts JARs.
124+
- Thus, when Gradle resolves dependencies, they are _already on disk_ and ready to be used in a classpath.
125+
126+
In this mode, dependencies are downloaded once and then can be used with both Elide and Gradle.
127+
128+
> [!WARNING]
129+
> Fetching dependencies with Elide currently requires an `elide.pkl` manifest listing your Maven dependencies. This will
130+
> change in the future.

0 commit comments

Comments
 (0)