Skip to content

Commit

Permalink
better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Jul 16, 2024
1 parent 23009ce commit 2e5aaa4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 5 additions & 5 deletions build_android.nims
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const

# mode = ScriptMode.Verbose

task setupAndroid, "Set up raylib project for Android":
task setupAndroid, "Prepare raylib project for Android development":
# Create required temp directories for APK building
mkDir(ProjectBuildPath / "src/com" / AppCompanyName / AppProductName)
for cpu in AndroidCPUs: mkDir(ProjectBuildPath / "lib" / cpu.toArchName)
Expand Down Expand Up @@ -126,7 +126,7 @@ public class NativeLoader extends android.app.NativeActivity {{
",O=Android,C=ES\" -keystore " & keystorePath & " -storepass " & AppKeystorePass &
" -keypass " & AppKeystorePass & " -alias " & ProjectName & "Key -keyalg RSA -keysize 2048")

task buildAndroid, "Build raylib project for Android":
task buildAndroid, "Compile and package raylib project for Android":
# Config project package and resource using AndroidManifest.xml and res/values/strings.xml
let androidResourcePath = AndroidHome / ("platforms/android-" & $AndroidApiVersion) / "android.jar"
exec(AndroidBuildTools / "aapt" & " package -f -m -S " & ProjectBuildPath / "res" & " -J " &
Expand Down Expand Up @@ -171,20 +171,20 @@ task buildAndroid, "Build raylib project for Android":
" --ks-pass pass:" & AppKeystorePass & " --key-pass pass:" & AppKeystorePass &
" --out " & ProjectName & ".apk" & " --ks-key-alias " & ProjectName & "Key" & " " & alignedApkPath)

task info, "Check information about the device":
task info, "Retrieve device compatibility information":
# Check supported ABI for the device (armeabi-v7a, arm64-v8a, x86, x86_64)
echo "Checking supported ABI for the device..."
exec(AndroidPlatformTools / "adb shell getprop ro.product.cpu.abi")
# Check supported API level for the device (31, 32, 33, ...)
echo "Checking supported API level for the device..."
exec(AndroidPlatformTools / "adb shell getprop ro.build.version.sdk")

task logcat, "Monitorize output log coming from device, only raylib tag":
task logcat, "Display raylib-specific logs from the Android device":
# Monitorize output log coming from device, only raylib tag
exec(AndroidPlatformTools / "adb logcat -c")
exec(AndroidPlatformTools / "adb logcat raylib:V *:S")

task deploy, "Install and monitorize raylib project to default emulator/device":
task deploy, "Install and monitor raylib project on Android device/emulator":
# Install and monitorize {ProjectName}.apk to default emulator/device
exec(AndroidPlatformTools / "adb install " & ProjectName & ".apk")
logcatTask()
13 changes: 10 additions & 3 deletions setup_build_env.nims
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,32 @@ elif defined(linux):
AndroidNdkZip = "android-ndk-r26d-linux.zip"
AndroidNdkSha1 = "fcdad75a765a46a9cf6560353f480db251d14765"

task setupBuildEnv, "Set up Android SDK/NDK":
# Set up Android SDK
task setupBuildEnv, "Set up Android SDK and NDK for development":
# Download the Android SDK Command Line Tools
myExec "wget -nv https://dl.google.com/android/repository/" & CommandLineToolsZip, cache = "1.0"
# Verify the integrity of the downloaded file
verifySha256(CommandLineToolsZip, CommandLineToolsSha256)
# Extract the tools to the specified Android home directory
myExec "unzip -q " & CommandLineToolsZip & " -d " & AndroidHome, input = "A"
let sdkmanagerPath = AndroidHome / "cmdline-tools/bin" / "sdkmanager".toBat
# Accept SDK licenses automatically
myExec sdkmanagerPath & " --licenses --sdk_root=" & AndroidHome, input = "y\n".repeat(8)
# Install specific Android SDK components
exec sdkmanagerPath & " --update --sdk_root=" & AndroidHome
exec sdkmanagerPath & " --install \"build-tools;34.0.0\" --sdk_root=" & AndroidHome
exec sdkmanagerPath & " --install \"platform-tools\" --sdk_root=" & AndroidHome
exec sdkmanagerPath & " --install \"platforms;android-" & $AndroidApiVersion & "\" --sdk_root=" & AndroidHome
when not defined(GitHubCI) and defined(windows):
exec sdkmanagerPath & " --install extras;google;usb_driver --sdk_root=" & AndroidHome
# Set up Android NDK
# Download the Android NDK
myExec "wget -nv https://dl.google.com/android/repository/" & AndroidNdkZip, cache = "1.0"
# Verifie the integrity of the downloaded file.
verifySha1(AndroidNdkZip, AndroidNdkSha1)
# Extract and move the NDK to the appropriate directory
myExec "unzip -q " & AndroidNdkZip, input = "A"
# AndroidNdkZip[0..<rfind(AndroidNdkZip, '-')]
mvDir(thisDir() / "android-ndk-r26d", AndroidNdk)
# Set up environment variables
when defined(GitHubCI):
appendToGithubFile("GITHUB_ENV", {"ANDROID_HOME": AndroidHome, "ANDROID_NDK": AndroidNdk})
else:
Expand Down

0 comments on commit 2e5aaa4

Please sign in to comment.