We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba6f26f commit 9148233Copy full SHA for 9148233
app/controllers/HooksController.scala
@@ -80,6 +80,16 @@ class HooksController @Inject() (cc: ControllerComponents)
80
case (Pre, _, _, _, _) =>
81
Ok(views.txt.default_pre(candidate, version, platform))
82
83
+ //RELOCATE
84
+ case (Relocate, Java, _, MacX64 | MacARM64, _) =>
85
+ Ok(views.txt.java_relocate_osx_tarball(candidate, version, platform))
86
+ case (Relocate, JMC, _, MacX64 | MacARM64, _) =>
87
+ Ok(views.txt.jmc_relocate_unix_tarball(candidate, version, vendor, jmcBinaryExec(vendor, MacX64)))
88
+ case (Relocate, JMC, _, LinuxX32 | LinuxX64 | LinuxARM64 | LinuxARM32HF | LinuxARM32SF, _) =>
89
+ Ok(views.txt.jmc_relocate_unix_tarball(candidate, version, vendor, jmcBinaryExec(vendor, platform)))
90
+ case (Relocate, JMC, _, Windows64, _) =>
91
+ Ok(views.txt.jmc_relocate_win_zip(candidate, version, vendor, jmcBinaryExec(vendor, Windows64)))
92
+
93
case (_, _, _, _, _) => NotFound
94
}
95
app/domain/domain.scala
@@ -71,6 +71,7 @@ object Hooks {
71
def from(phase: String) = phase match {
72
case Post.phase => Post
73
case Pre.phase => Pre
74
+ case Relocate.phase => Relocate
75
76
77
case object Post extends Hooks {
@@ -79,3 +80,6 @@ case object Post extends Hooks {
79
case object Pre extends Hooks {
override val phase = "pre"
+case object Relocate extends Hooks {
+ override val phase = "relocate"
+}
app/views/java_relocate_osx_tarball.scala.txt
@@ -0,0 +1,25 @@
1
+@import domain._
2
+@(candidate: Candidate, version: String, platform: Platform)#!/bin/bash
3
+#Relocation Hook: osx-java
4
+function __sdkman_relocate_installation_hook {
5
+ __sdkman_echo_debug "A @{platform.name} relocation hook was found for @{candidate.name} @{version}-openjdk."
6
7
+ local present_dir="$(pwd)"
8
+ local candidate_dir="${SDKMAN_CANDIDATE_DIR}/@{candidate.name}/@{version}"
9
+ local work_jdk_dir="${SDKMAN_DIR}/tmp/@{candidate.name}-@{version}"
10
11
+ echo ""
12
+ __sdkman_echo_green "Relocating @{candidate.name} @version..."
13
14
+ #Move ./Contents/Home to temp location
15
+ cd "$candidate_dir"/*/Contents
16
+ mv -f Home "$work_jdk_dir"
17
18
+ #Replace candidate
19
+ cd "$present_dir"
20
+ rm -rf "$candidate_dir"
21
+ mv -f "$work_jdk_dir" "$candidate_dir"
22
23
24
+ __sdkman_echo_green "Done relocating..."
25
app/views/jmc_relocate_unix_tarball.scala.txt
@@ -0,0 +1,29 @@
+@(candidate: Candidate, version: String, vendor: String, executableBinary: String)#!/bin/bash
+#Relocation Hook: unix-jmc-tarball
+ __sdkman_echo_debug "A unix relocate hook was found for JMC @vendor @version."
+ local executable_binary="@{executableBinary}"
+ __sdkman_echo_green "Relocating JMC @vendor @version..."
+ @if(vendor == "zulu") {
+ # deal with zulu folder structure
+ cd "$candidate_dir"/*
+ } else {
+ # deal with jmc flat structure
+ cd "$candidate_dir"
+ }
+ mkdir bin
+ cd bin
+ ln -s ../"${executable_binary}" jmc
26
27
28
29
app/views/jmc_relocate_win_zip.scala.txt
+#Relocation Hook: win-jmc-zip
+ __sdkman_echo_debug "A Windows relocate hook was found for JMC @vendor @version."
features/relocate_hooks.feature
@@ -0,0 +1,23 @@
+Feature: Relocate Hooks
+ Scenario: A Relocate Hook request for java OSX served
+ When a hook is requested at /hooks/relocate/java/8.0.161-zulu/darwinx64
+ Then a 200 status code is received
+ And the response script contains "Relocation Hook: osx-java"
+ Scenario: A Relocate Hook request for java Linux is not served
+ When a hook is requested at /hooks/relocate/java/9.0.4-open/linuxx64
+ Then a 404 status code is received
+ Scenario Outline:
+ When a hook is requested at <uri>
+ And the response script contains "<contains>"
+ Examples:
+ | uri | contains |
+ | /hooks/relocate/jmc/8.0.0.17-zulu/linuxx64 | Relocation Hook: unix-jmc-tarball |
+ | /hooks/relocate/jmc/8.0.0-adpt/linuxx64 | Relocation Hook: unix-jmc-tarball |
+ | /hooks/relocate/jmc/8.0.0.17-zulu/darwinx64 | Relocation Hook: unix-jmc-tarball |
+ | /hooks/relocate/jmc/8.0.0-adpt/darwinx64 | Relocation Hook: unix-jmc-tarball |
+ | /hooks/relocate/jmc/8.0.0-adpt/cygwin | Relocation Hook: win-jmc-zip |
+ | /hooks/relocate/jmc/8.0.0-adpt/msys_nt-10.0 | Relocation Hook: win-jmc-zip |
0 commit comments