feat: 初始化跨平台远程编译服务与 Android Studio 插件
This commit is contained in:
commit
9eba4556db
44 files changed
+2802
No files matched your search
@@ -0,0 +1,24 @@
|
||||
$ErrorActionPreference='Stop'
|
||||
$candidates=New-Object 'System.Collections.Generic.List[string]'
|
||||
foreach($base in @('C:\Program Files','D:\Program Files','D:\ProgramFiles')) {
|
||||
foreach($folder in @(Get-ChildItem -LiteralPath $base -Directory -ErrorAction SilentlyContinue | Where-Object {$_.Name -match 'Java|JDK|Android|Studio|JetBrains|Microsoft|Eclipse|BellSoft'})) {
|
||||
$candidates.Add($folder.FullName)
|
||||
$candidates.Add((Join-Path $folder.FullName 'jbr'))
|
||||
foreach($child in @(Get-ChildItem -LiteralPath $folder.FullName -Directory -ErrorAction SilentlyContinue)) {
|
||||
$candidates.Add($child.FullName)
|
||||
$candidates.Add((Join-Path $child.FullName 'jbr'))
|
||||
}
|
||||
}
|
||||
}
|
||||
$selected=$null
|
||||
foreach($candidate in $candidates) {
|
||||
$release=Join-Path $candidate 'release'
|
||||
if((Test-Path -LiteralPath "$candidate\bin\java.exe") -and (Test-Path -LiteralPath $release)) {
|
||||
$version=Get-Content -LiteralPath $release | Where-Object {$_ -match '^JAVA_VERSION="(17|21)\.'}
|
||||
if($version){$selected=$candidate;break}
|
||||
}
|
||||
}
|
||||
if(-not $selected){$selected='C:\Program Files\Java\jdk-25.0.3';Write-Output 'Only JDK25 detected; older Gradle projects require configuring a compatible JDK.'}
|
||||
Write-Output "Selected JAVA_HOME=$selected"
|
||||
& "$PSScriptRoot\install.ps1" -JavaHome $selected
|
||||
& "$PSScriptRoot\verify.ps1"
|
||||
Reference in new issue
Block a user