Skip to content

Commit 407d0af

Browse files
authored
Merge pull request #63 from EUCPilots/microsoft-openjdk
Add support for Microsoft OpenJDK installer downloads
2 parents 9e455bb + 20a01fb commit 407d0af

8 files changed

+103
-2
lines changed

Apps/Get-MicrosoftOpenJDK11.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ function Get-MicrosoftOpenJDK11 {
1313
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
1414
)
1515

16+
# Output the results from Get-AdoptiumTemurin
1617
$Output = Get-AdoptiumTemurin -res $res
1718
Write-Output -InputObject $Output
19+
20+
if ($Output -and $Output.Count -gt 0) {
21+
# Capture the version number from the first output object
22+
$Output[0].Version -match $res.Get.Download.VersionPattern | Out-Null
23+
$Version = $Matches[0]
24+
25+
# Output the download links for additional file types
26+
foreach ($Uri in $res.Get.Download.Uri) {
27+
[PSCustomObject]@{
28+
Version = $Output[0].Version
29+
Date = $Output[0].Date
30+
ImageType = $Output[0].ImageType
31+
Architecture = Get-Architecture -String $Uri
32+
Type = Get-FileType -File $Uri
33+
URI = (Resolve-SystemNetWebRequest -Uri ($Uri -replace "#version", $Version)).ResponseUri.AbsoluteUri
34+
}
35+
}
36+
}
1837
}

Apps/Get-MicrosoftOpenJDK17.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ function Get-MicrosoftOpenJDK17 {
1313
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
1414
)
1515

16+
# Output the results from Get-AdoptiumTemurin
1617
$Output = Get-AdoptiumTemurin -res $res
1718
Write-Output -InputObject $Output
19+
20+
if ($Output -and $Output.Count -gt 0) {
21+
# Capture the version number from the first output object
22+
$Output[0].Version -match $res.Get.Download.VersionPattern | Out-Null
23+
$Version = $Matches[0]
24+
25+
# Output the download links for additional file types
26+
foreach ($Uri in $res.Get.Download.Uri) {
27+
[PSCustomObject]@{
28+
Version = $Output[0].Version
29+
Date = $Output[0].Date
30+
ImageType = $Output[0].ImageType
31+
Architecture = Get-Architecture -String $Uri
32+
Type = Get-FileType -File $Uri
33+
URI = (Resolve-SystemNetWebRequest -Uri ($Uri -replace "#version", $Version)).ResponseUri.AbsoluteUri
34+
}
35+
}
36+
}
1837
}

Apps/Get-MicrosoftOpenJDK21.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ function Get-MicrosoftOpenJDK21 {
1313
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
1414
)
1515

16+
# Output the results from Get-AdoptiumTemurin
1617
$Output = Get-AdoptiumTemurin -res $res
1718
Write-Output -InputObject $Output
19+
20+
if ($Output -and $Output.Count -gt 0) {
21+
# Capture the version number from the first output object
22+
$Output[0].Version -match $res.Get.Download.VersionPattern | Out-Null
23+
$Version = $Matches[0]
24+
25+
# Output the download links for additional file types
26+
foreach ($Uri in $res.Get.Download.Uri) {
27+
[PSCustomObject]@{
28+
Version = $Output[0].Version
29+
Date = $Output[0].Date
30+
ImageType = $Output[0].ImageType
31+
Architecture = Get-Architecture -String $Uri
32+
Type = Get-FileType -File $Uri
33+
URI = (Resolve-SystemNetWebRequest -Uri ($Uri -replace "#version", $Version)).ResponseUri.AbsoluteUri
34+
}
35+
}
36+
}
1837
}

Apps/Get-MicrosoftOpenJDK25.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ function Get-MicrosoftOpenJDK25 {
1313
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
1414
)
1515

16+
# Output the results from Get-AdoptiumTemurin
1617
$Output = Get-AdoptiumTemurin -res $res
1718
Write-Output -InputObject $Output
19+
20+
if ($Output -and $Output.Count -gt 0) {
21+
# Capture the version number from the first output object
22+
$Output[0].Version -match $res.Get.Download.VersionPattern | Out-Null
23+
$Version = $Matches[0]
24+
25+
# Output the download links for additional file types
26+
foreach ($Uri in $res.Get.Download.Uri) {
27+
[PSCustomObject]@{
28+
Version = $Output[0].Version
29+
Date = $Output[0].Date
30+
ImageType = $Output[0].ImageType
31+
Architecture = Get-Architecture -String $Uri
32+
Type = Get-FileType -File $Uri
33+
URI = (Resolve-SystemNetWebRequest -Uri ($Uri -replace "#version", $Version)).ResponseUri.AbsoluteUri
34+
}
35+
}
36+
}
1837
}

Manifests/MicrosoftOpenJDK11.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"ContentType": "application/json",
88
"MatchImage": "jdk|jre",
99
"ResolveUri": true
10+
},
11+
"Download": {
12+
"Uri": [
13+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-x64.exe",
14+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-aarch64.exe"
15+
],
16+
"VersionPattern": "^(.*?)(?=\\+)"
1017
}
1118
},
1219
"Install": {

Manifests/MicrosoftOpenJDK17.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"ContentType": "application/json",
88
"MatchImage": "jdk|jre",
99
"ResolveUri": true
10+
},
11+
"Download": {
12+
"Uri": [
13+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-x64.exe",
14+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-aarch64.exe"
15+
],
16+
"VersionPattern": "^(.*?)(?=\\+)"
1017
}
1118
},
1219
"Install": {

Manifests/MicrosoftOpenJDK21.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
"ContentType": "application/json",
99
"MatchImage": "jdk|jre",
1010
"ResolveUri": true
11+
},
12+
"Download": {
13+
"Uri": [
14+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-x64.exe"
15+
],
16+
"VersionPattern": "^(.*?)(?=\\+)"
1117
}
1218
},
1319
"Install": {

Manifests/MicrosoftOpenJDK25.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{
32
"Name": "Microsoft OpenJDK 25",
43
"Source": "https://www.microsoft.com/openjdk",
@@ -8,6 +7,12 @@
87
"ContentType": "application/json",
98
"MatchImage": "jdk|jre",
109
"ResolveUri": true
10+
},
11+
"Download": {
12+
"Uri": [
13+
"https://aka.ms/download-jdk/microsoft-jdk-#version-windows-x64.exe"
14+
],
15+
"VersionPattern": "^(.*?)(?=\\+)"
1116
}
1217
},
1318
"Install": {
@@ -21,4 +26,4 @@
2126
"PostInstall": []
2227
}
2328
}
24-
}
29+
}

0 commit comments

Comments
 (0)