Skip to content

Commit

Permalink
Merge pull request #1567 from paketo-buildpacks/update-actions-for-arm64
Browse files Browse the repository at this point in the history
Add arm64 support to Actions
  • Loading branch information
dmikusa authored Apr 17, 2024
2 parents 71af707 + cde8c7d commit 637f8b6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions actions/oracle-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ func main() {
panic(fmt.Errorf("version must be specified"))
}

arch, ok := inputs["arch"]
if !ok {
arch = "x64"
}

if arch == "arm64" {
arch = "aarch64" // cause Oracle needs it this way
}

var pattern *regexp.Regexp
var key string
var urlTemplate string
switch typeName {
case "jdk":
pattern = regexp.MustCompile(`^JDK Development Kit (\d+\.\d+\.\d+) downloads$`)
key = fmt.Sprintf("java%s", versionBranch)
urlTemplate = "https://download.oracle.com/java/%s/archive/jdk-%s_linux-x64_bin.tar.gz"
urlTemplate = "https://download.oracle.com/java/%s/archive/jdk-%s_linux-%s_bin.tar.gz"
case "graalvm":
pattern = regexp.MustCompile(`^GraalVM for JDK (\d+\.\d+\.\d+) downloads$`)
key = fmt.Sprintf("graalvmjava%s", versionBranch)
urlTemplate = "https://download.oracle.com/graalvm/%s/archive/graalvm-jdk-%s_linux-x64_bin.tar.gz"
urlTemplate = "https://download.oracle.com/graalvm/%s/archive/graalvm-jdk-%s_linux-%s_bin.tar.gz"
default:
panic(fmt.Errorf("unsupported type %s", typeName))
}
Expand All @@ -61,7 +70,7 @@ func main() {
foundVersions := pattern.FindStringSubmatch(element.Text)
if len(foundVersions) == 2 {
foundVersion := foundVersions[1] // there should only ever be one
versions[foundVersion] = fmt.Sprintf(urlTemplate, versionBranch, foundVersion)
versions[foundVersion] = fmt.Sprintf(urlTemplate, versionBranch, foundVersion, arch)
}
})

Expand Down

0 comments on commit 637f8b6

Please sign in to comment.