-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_and_build.ps1
More file actions
73 lines (65 loc) · 3.22 KB
/
setup_and_build.ps1
File metadata and controls
73 lines (65 loc) · 3.22 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
62
63
64
65
66
67
68
69
70
71
72
# WalletConnect V2 DApp Setup and Build Script
# This script will help you install Java and build the project
Write-Host "=== WalletConnect V2 DApp Setup Script ===" -ForegroundColor Green
# Check if Java is installed
Write-Host "Checking Java installation..." -ForegroundColor Yellow
try {
$javaVersion = java -version 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "Java is already installed:" -ForegroundColor Green
Write-Host $javaVersion
} else {
throw "Java not found"
}
} catch {
Write-Host "Java is not installed or not in PATH." -ForegroundColor Red
Write-Host ""
Write-Host "Please follow these steps to install Java JDK 17:" -ForegroundColor Yellow
Write-Host "1. Download Java JDK 17 from: https://adoptium.net/temurin/releases/?version=17" -ForegroundColor Cyan
Write-Host "2. Install the downloaded .exe file" -ForegroundColor Cyan
Write-Host "3. Set JAVA_HOME environment variable:" -ForegroundColor Cyan
Write-Host " - Press Win+R, type 'sysdm.cpl', press Enter" -ForegroundColor Cyan
Write-Host " - Go to Advanced tab → Environment Variables" -ForegroundColor Cyan
Write-Host " - Under System Variables, click New" -ForegroundColor Cyan
Write-Host " - Variable name: JAVA_HOME" -ForegroundColor Cyan
Write-Host " - Variable value: C:\Program Files\Eclipse Adoptium\jdk-17.x.x-hotspot" -ForegroundColor Cyan
Write-Host "4. Add %JAVA_HOME%\bin to your PATH variable" -ForegroundColor Cyan
Write-Host "5. Restart your terminal and run this script again" -ForegroundColor Cyan
Write-Host ""
Write-Host "Press any key to exit..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit 1
}
# Check if JAVA_HOME is set
Write-Host "Checking JAVA_HOME..." -ForegroundColor Yellow
if ($env:JAVA_HOME) {
Write-Host "JAVA_HOME is set to: $env:JAVA_HOME" -ForegroundColor Green
} else {
Write-Host "JAVA_HOME is not set. Please set it to your Java installation directory." -ForegroundColor Red
Write-Host "Example: C:\Program Files\Eclipse Adoptium\jdk-17.x.x-hotspot" -ForegroundColor Cyan
Write-Host ""
Write-Host "Press any key to exit..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit 1
}
# Clean and build the project
Write-Host "Cleaning project..." -ForegroundColor Yellow
.\gradlew clean
Write-Host "Building project..." -ForegroundColor Yellow
.\gradlew build
if ($LASTEXITCODE -eq 0) {
Write-Host "Build successful!" -ForegroundColor Green
Write-Host ""
Write-Host "To run the app:" -ForegroundColor Yellow
Write-Host "1. Connect an Android device or start an emulator" -ForegroundColor Cyan
Write-Host "2. Run: .\gradlew installDebug" -ForegroundColor Cyan
Write-Host ""
Write-Host "To generate APK for deployment:" -ForegroundColor Yellow
Write-Host "Run: .\gradlew assembleDebug" -ForegroundColor Cyan
Write-Host "APK will be generated in: app\build\outputs\apk\debug\" -ForegroundColor Cyan
} else {
Write-Host "Build failed! Please check the error messages above." -ForegroundColor Red
}
Write-Host ""
Write-Host "Press any key to exit..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")