Skip to content

Commit

Permalink
cleanup parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLuje committed Jun 24, 2023
1 parent e131f58 commit eaee9a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public class GraalVMModule extends AbstractModule {
private final boolean isLegacyGraalVm;

private static final String TEMPLATE = """
--mount=type=bind,source=%s,target=/tmp/%s \\
--mount=type=bind,source=%s,target=%s \\
tar xzf %s -C /opt \\
&& mv /opt/graalvm-ce-*-%s* /opt/graalvm \\
&& %s/bin/gu --auto-yes install native-image""";

private static final String NEW_TEMPLATE = """
--mount=type=bind,source=%s,target=/tmp/%s \\
--mount=type=bind,source=%s,target=%s \\
tar xzf %s -C /opt \\
&& mv /opt/graalvm-community-openjdk-%s* /opt/graalvm""";
private final String graalvmVersion;
Expand Down Expand Up @@ -71,13 +71,13 @@ public List<Command> commands(BuildContext bc) {
String script;
if (isLegacyGraalVm) {
script = TEMPLATE.formatted(
artifact.path, artifact.name, // mount bind
artifact.path, "/tmp/" + artifact.name, // mount bind
"/tmp/" + artifact.name, // tar
graalvmVersion, // mv
GRAALVM_HOME); // gu
} else {
script = NEW_TEMPLATE.formatted(
artifact.path, artifact.name, // mount bind
artifact.path, "/tmp/" + artifact.name, // mount bind
"/tmp/" + artifact.name, // tar
graalvmVersion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MandrelModule extends AbstractModule {
private final String filename;

private static final String TEMPLATE = """
--mount=type=bind,source=%s,target=/tmp/%s \\
--mount=type=bind,source=%s,target=%s \\
mkdir -p %s \\
&& tar xzf %s -C %s --strip-components=1""";

Expand All @@ -39,7 +39,7 @@ public MandrelModule(String version, String arch, String javaVersion, String sha
public List<Command> commands(BuildContext bc) {
Artifact artifact = bc.addArtifact(new Artifact(filename, url, sha));
String script = TEMPLATE.formatted(
artifact.path, artifact.name, // mount bind
artifact.path, "/tmp/" + artifact.name, // mount bind
MANDREL_HOME, // mkdir
"/tmp/" + artifact.name, MANDREL_HOME, //tar
"/tmp/" + artifact.name); //rm
Expand Down

0 comments on commit eaee9a5

Please sign in to comment.