From 93cf2319f3be2662a0fe0cf04d7c66b123eb3516 Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Fri, 11 Feb 2022 10:45:31 -0700 Subject: [PATCH] add piston nix pkg for openjdk-java --- packages/java/15.0.2/build.sh | 9 -------- packages/java/15.0.2/environment | 4 ---- packages/java/15.0.2/metadata.json | 5 ----- packages/java/15.0.2/run | 7 ------ packages/java/15.0.2/test.java | 5 ----- runtimes/default.nix | 1 + runtimes/openjdk-java.nix | 34 ++++++++++++++++++++++++++++++ 7 files changed, 35 insertions(+), 30 deletions(-) delete mode 100755 packages/java/15.0.2/build.sh delete mode 100644 packages/java/15.0.2/environment delete mode 100644 packages/java/15.0.2/metadata.json delete mode 100644 packages/java/15.0.2/run delete mode 100644 packages/java/15.0.2/test.java create mode 100644 runtimes/openjdk-java.nix diff --git a/packages/java/15.0.2/build.sh b/packages/java/15.0.2/build.sh deleted file mode 100755 index aef09a6..0000000 --- a/packages/java/15.0.2/build.sh +++ /dev/null @@ -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 - diff --git a/packages/java/15.0.2/environment b/packages/java/15.0.2/environment deleted file mode 100644 index 780b668..0000000 --- a/packages/java/15.0.2/environment +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export PATH=$PWD/bin:$PATH diff --git a/packages/java/15.0.2/metadata.json b/packages/java/15.0.2/metadata.json deleted file mode 100644 index 9c3a298..0000000 --- a/packages/java/15.0.2/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "java", - "version": "15.0.2", - "aliases": [] -} diff --git a/packages/java/15.0.2/run b/packages/java/15.0.2/run deleted file mode 100644 index 505e4e4..0000000 --- a/packages/java/15.0.2/run +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Put instructions to run the runtime -mv $1 $1.java -filename=$1.java -shift -java $filename "$@" diff --git a/packages/java/15.0.2/test.java b/packages/java/15.0.2/test.java deleted file mode 100644 index 2dc0eaa..0000000 --- a/packages/java/15.0.2/test.java +++ /dev/null @@ -1,5 +0,0 @@ -public class HelloWorld { - public static void main(String[] args) { - System.out.println("OK"); - } -} \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 48e2e52..ec6e596 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -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; } diff --git a/runtimes/openjdk-java.nix b/runtimes/openjdk-java.nix new file mode 100644 index 0000000..98e8f97 --- /dev/null +++ b/runtimes/openjdk-java.nix @@ -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"; + }) + ]; +} \ No newline at end of file