Skip to content

Commit 50a181e

Browse files
committed
set JAVA_HOME environment variable
1 parent 6a235ce commit 50a181e

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description = "Set up your CI/CD Pipeline with a specific version of Java"
66
edition = "2021"
77
license = "MIT"
88
name = "java"
9-
version = "0.1.1"
9+
version = "0.1.2"
1010

1111
[lib]
1212
crate-type = [

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ fluentci run --wasm java setup zulu-17.46.19 # or any other version
1616
| ----- | ------------------------------------ |
1717
| setup | Installs a specific version of Java. |
1818

19+
## Code Usage
20+
21+
Add `fluentci-pdk` crate to your `Cargo.toml`:
22+
23+
```toml
24+
[dependencies]
25+
fluentci-pdk = "0.1.9"
26+
```
27+
28+
Use the following code to call the plugin:
29+
30+
```rust
31+
use fluentci_pdk::dag;
32+
33+
// ...
34+
35+
dag().call("https://pkg.fluentci.io/java@v0.1.2", "setup", vec!["zulu-17.46.19"])?;
36+
```
37+
1938
## 📚 Examples
2039

2140
Github Actions:

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,16 @@ pub fn setup(version: String) -> FnResult<String> {
2424
.with_exec(vec!["mise", "install", &format!("java{}", version)])?
2525
.with_exec(vec!["mise", "use", "-g", &format!("java{}", version)])?
2626
.stdout()?;
27+
28+
let version = match version.as_str() {
29+
"" => "latest".into(),
30+
_ => version.replace("@", ""),
31+
};
32+
33+
dag().set_envs(vec![(
34+
"JAVA_HOME".into(),
35+
format!("{}/.local/share/mise/installs/java/{}", home, version),
36+
)])?;
37+
2738
Ok(stdout)
2839
}

0 commit comments

Comments
 (0)