-
Notifications
You must be signed in to change notification settings - Fork 6
docs: add local development guide and improve Android build setup #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
02d7f6d
4fdf8c7
31c4777
06a8b92
92e7ef0
2ed2c73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,7 @@ subprojects { | |
|
|
||
| java { | ||
| toolchain { | ||
| languageVersion.set(JavaLanguageVersion.of(11)) | ||
| languageVersion.set(JavaLanguageVersion.of(17)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 Auto Review Issue: Java version mismatch between toolchain and compile options Severity: MEDIUM Context:
Recommendation: Update compile options to match toolchain: compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure about this? Java compilers can produce bytecode for older versions (that's what targetCompatibility does)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @claude review |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,73 @@ fi | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Using ANDROID_NDK_HOME: $ANDROID_NDK_HOME" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| check_prerequisites() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local has_error=0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check cargo-ndk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ! command -v cargo-ndk &> /dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "ERROR: cargo-ndk is not installed!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Please install it with:" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " cargo install cargo-ndk" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| has_error=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check Rust Android targets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local required_targets=("aarch64-linux-android" "armv7-linux-androideabi" "x86_64-linux-android") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local installed_targets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| installed_targets=$(rustup target list --installed 2>/dev/null || echo "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local missing_targets=() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for target in "${required_targets[@]}"; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ! echo "$installed_targets" | grep -q "^${target}$"; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| missing_targets+=("$target") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ ${#missing_targets[@]} -gt 0 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "ERROR: Missing Rust Android targets: ${missing_targets[*]}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Please install them with:" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " rustup target add ${missing_targets[*]}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| has_error=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check Java version (need Java 17+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if command -v java &> /dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local java_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Extract major version, handling various JDK output formats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| java_version=$(java -version 2>&1 | awk -F'"' '/version/ {print $2}' | cut -d. -f1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Fallback for non-standard outputs (e.g., "17.0.1" without quotes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -z "$java_version" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| java_version=$(java -version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1 | cut -d. -f1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+54
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Extract major version, handling various JDK output formats | |
| java_version=$(java -version 2>&1 | awk -F'"' '/version/ {print $2}' | cut -d. -f1) | |
| # Fallback for non-standard outputs (e.g., "17.0.1" without quotes) | |
| if [ -z "$java_version" ]; then | |
| java_version=$(java -version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1 | cut -d. -f1) | |
| local java_version_raw | |
| # Extract full version string, handling standard JDK output formats (e.g., "1.8.0_402", "17.0.1") | |
| java_version_raw=$(java -version 2>&1 | awk -F'"' '/version/ {print $2}') | |
| if [ -n "$java_version_raw" ]; then | |
| # Handle legacy "1.x" format (Java 8 and earlier) by taking the second component as major | |
| if [[ "$java_version_raw" == 1.* ]]; then | |
| java_version=$(echo "$java_version_raw" | cut -d. -f2) | |
| else | |
| java_version=$(echo "$java_version_raw" | cut -d. -f1) | |
| fi | |
| fi | |
| # Fallback for non-standard outputs (e.g., version without quotes) | |
| if [ -z "$java_version" ]; then | |
| java_version_raw=$(java -version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1) | |
| if [ -n "$java_version_raw" ]; then | |
| if [[ "$java_version_raw" == 1.* ]]; then | |
| java_version=$(echo "$java_version_raw" | cut -d. -f2) | |
| else | |
| java_version=$(echo "$java_version_raw" | cut -d. -f1) | |
| fi | |
| fi |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Java version extraction fails completely (both primary and fallback methods), the variable java_version will be empty, and the version check will be silently skipped, allowing the script to proceed. While Gradle itself will catch Java version issues later, it would be more user-friendly to provide early feedback with a warning when version detection fails. Consider adding:
if [ -z "$java_version" ] || ! [[ "$java_version" =~ ^[0-9]+$ ]]; then
echo "WARNING: Could not determine Java version"
echo "The build may fail if Java 17+ is not installed"
echo ""
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message shown in the prerequisites table does not match the actual error message generated by the script. The script outputs "ERROR: Java 17 or higher is required (found Java X)" (line 57 of generate_kotlin_locally.sh), but the table shows "Android Gradle plugin requires Java 17" which is a different error that might come from Gradle itself, not from the prerequisite check. Consider updating the table to show the actual error from the check_prerequisites function, or clarify that this is the Gradle build error (which would occur if the prerequisite check is skipped).