-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathrebuild_kotlin_library.ps1
More file actions
65 lines (51 loc) · 2.37 KB
/
rebuild_kotlin_library.ps1
File metadata and controls
65 lines (51 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# PowerShell script to rebuild the Kotlin camera library and copy it to Unity
Write-Host "=== Rebuilding QuestCameraLib ===" -ForegroundColor Cyan
# Check if we're in the right directory
if (-not (Test-Path "QuestCameraLib")) {
Write-Host "Error: QuestCameraLib directory not found!" -ForegroundColor Red
Write-Host "Make sure you run this script from the project root directory." -ForegroundColor Yellow
exit 1
}
# Step 1: Build the Kotlin library
Write-Host "`n[1/3] Building Kotlin library..." -ForegroundColor Green
Push-Location QuestCameraLib
try {
if ($IsWindows -or $env:OS -eq "Windows_NT") {
& .\gradlew.bat assembleRelease
} else {
& ./gradlew assembleRelease
}
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Gradle build failed!" -ForegroundColor Red
Pop-Location
exit 1
}
} finally {
Pop-Location
}
# Step 2: Check if the .aar was created
$aarPath = "QuestCameraLib\app\build\outputs\aar\app-release.aar"
if (-not (Test-Path $aarPath)) {
Write-Host "Error: .aar file not found at $aarPath" -ForegroundColor Red
exit 1
}
Write-Host "`n[2/3] .aar file built successfully!" -ForegroundColor Green
Write-Host "Location: $aarPath" -ForegroundColor Gray
# Step 3: Backup old .aar and copy new one
$unityPluginPath = "Assets\Plugins\Android\questcameralib.aar"
$backupPath = "Assets\Plugins\Android\questcameralib.aar.backup"
if (Test-Path $unityPluginPath) {
Write-Host "`n[3/3] Backing up old .aar file..." -ForegroundColor Green
Copy-Item $unityPluginPath $backupPath -Force
Write-Host "Backup saved to: $backupPath" -ForegroundColor Gray
}
Write-Host "Copying new .aar to Unity plugins..." -ForegroundColor Green
Copy-Item $aarPath $unityPluginPath -Force
Write-Host "New .aar copied to: $unityPluginPath" -ForegroundColor Gray
Write-Host "`n=== SUCCESS ===" -ForegroundColor Green
Write-Host "Kotlin library rebuilt and copied to Unity!" -ForegroundColor Cyan
Write-Host "`nNext steps:" -ForegroundColor Yellow
Write-Host " 1. Open Unity and wait for it to reimport the .aar file" -ForegroundColor White
Write-Host " 2. Build your Android APK (File > Build Settings > Build)" -ForegroundColor White
Write-Host " 3. Install on Quest: adb install -r Build\QuestRealityCapture.apk" -ForegroundColor White
Write-Host "`nOr use Unity's 'Build and Run' to do steps 2-3 automatically." -ForegroundColor Gray