add piston nix pkg for openjdk-java

This commit is contained in:
Dan Vargas 2022-02-11 10:45:31 -07:00
parent c3d1ece81e
commit 93cf2319f3
7 changed files with 35 additions and 30 deletions

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
# Put instructions to build your package in here
curl "https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz" -o java.tar.gz
tar xzf java.tar.gz --strip-components=1
rm java.tar.gz

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "java",
"version": "15.0.2",
"aliases": []
}

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
mv $1 $1.java
filename=$1.java
shift
java $filename "$@"

View File

@ -1,5 +0,0 @@
public class HelloWorld {
public static void main(String[] args) {
System.out.println("OK");
}
}

View File

@ -40,4 +40,5 @@ args: {
"jvm-kotlin" = import ./jvm-kotlin.nix args;
"julia" = import ./julia.nix args;
"jelly" = import ./jelly.nix args;
"openjdk-java" = import ./openjdk-java.nix args;
}

34
runtimes/openjdk-java.nix Normal file
View File

@ -0,0 +1,34 @@
{pkgs, piston, ...}:
let
pkg = pkgs.openjdk;
in piston.mkRuntime {
language = "java";
version = pkg.version;
runtime = "openjdk";
aliases = [];
run = ''
mv $1 $1.java
filename=$1.java
shift
${pkg}/bin/java $filename "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.java" = ''
public class PrinOK {
public static void main(String[] args) {
System.out.println("OK");
}
}
'';
};
args = [];
stdin = "";
packages = [];
main = "test.java";
})
];
}