Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"name": "Android Kotlin Dev Environment",
// Java 21 is already bundled in the base image — no need for the SDKMAN feature.
// Adding it again causes a conflict because SDKMAN can't locate "ms/21" in its registry.
"image": "mcr.microsoft.com/devcontainers/java:1-21-bullseye",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "21",
"jdkDistribution": "ms",
"gradleVersion": "latest"
}
},
"remoteEnv": {
"ANDROID_HOME": "/usr/local/lib/android/sdk",
"ANDROID_SDK_ROOT": "/usr/local/lib/android/sdk",
Expand Down
71 changes: 53 additions & 18 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

# Set target Android SDK directory
SDK_DIR="/usr/local/lib/android/sdk"
CMDLINE_VERSION="11076708"
GRADLE_VERSION="8.7"

echo "──────────────────────────────────────────"
echo " Android SDK setup"
echo "──────────────────────────────────────────"

# ── 1. SDK directory ────────────────────────────────────────────────────────
sudo mkdir -p "$SDK_DIR/cmdline-tools"
sudo chown -R vscode:vscode "$SDK_DIR"
sudo chown -R vscode:vscode /usr/local/lib/android

# Download Android Command-Line Tools
CMDLINE_VERSION="11076708" # Latest command-line tools version
# ── 2. Command-line tools ───────────────────────────────────────────────────
echo "→ Downloading Android cmdline-tools ${CMDLINE_VERSION}…"
cd /tmp
wget -q "https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_VERSION}_latest.zip"
unzip -q "commandlinetools-linux-${CMDLINE_VERSION}_latest.zip"

# Move tools to the expected structure ($ANDROID_HOME/cmdline-tools/latest/bin)
wget -q "https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_VERSION}_latest.zip" \
-O cmdline-tools.zip
unzip -q cmdline-tools.zip
mkdir -p "$SDK_DIR/cmdline-tools/latest"
mv cmdline-tools/* "$SDK_DIR/cmdline-tools/latest/" 2>/dev/null || true
rm -rf "commandlinetools-linux-${CMDLINE_VERSION}_latest.zip" cmdline-tools
mv cmdline-tools/* "$SDK_DIR/cmdline-tools/latest/"
rm -rf cmdline-tools.zip cmdline-tools

# ── 3. SDK packages ─────────────────────────────────────────────────────────
SDKMANAGER="$SDK_DIR/cmdline-tools/latest/bin/sdkmanager"
echo "→ Accepting licenses…"
yes | "$SDKMANAGER" --licenses > /dev/null 2>&1 || true

echo "→ Installing SDK packages…"
"$SDKMANAGER" \
"platform-tools" \
"platforms;android-34" \
"build-tools;34.0.0"

# ── 4. Gradle (standalone, no SDKMAN needed) ────────────────────────────────
if ! command -v gradle &> /dev/null; then
echo "→ Installing Gradle ${GRADLE_VERSION}…"
cd /tmp
wget -q "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
-O gradle.zip
sudo unzip -q gradle.zip -d /opt
sudo ln -sf "/opt/gradle-${GRADLE_VERSION}/bin/gradle" /usr/local/bin/gradle
rm gradle.zip
echo " Gradle $(gradle --version | head -1) installed."
else
echo "→ Gradle already available: $(gradle --version | head -1)"
fi

# Accept licenses & install platforms/build-tools
yes | "$SDK_DIR/cmdline-tools/latest/bin/sdkmanager" --licenses
"$SDK_DIR/cmdline-tools/latest/bin/sdkmanager" "platform-tools" "platforms;android-34" "build-tools;34.0.0"
# ── 5. Gradle wrapper ───────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [ -f "$SCRIPT_DIR/gradlew" ]; then
chmod +x "$SCRIPT_DIR/gradlew"
echo "→ gradlew made executable."
fi

# Make Gradle wrapper executable if present
if [ -f "./gradlew" ]; then
chmod +x ./gradlew
fi
echo ""
echo "✓ Android dev environment ready."
echo " Java : $(java -version 2>&1 | head -1)"
echo " Gradle : $(gradle --version 2>/dev/null | head -1)"
echo " SDK : $SDK_DIR"
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ object Versions {
const val ktor = "2.3.12"
const val coil = "3.5.0"
const val serialization = "1.6.3"
const val immutableCollections = "0.3.8"
const val immutableCollections = "0.3.8"
const val castle = "1.80"

// AndroidX / Google
const val annotationJvm = "1.10.0"
Expand Down
5 changes: 4 additions & 1 deletion utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ dependencies {
implementation("androidx.annotation:annotation-jvm:1.10.0")
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
implementation("org.bouncycastle:bcpkix-jdk18on:${Versions.castle}")
implementation("org.bouncycastle:bcprov-jdk18on:${Versions.castle}")
implementation("org.bouncycastle:bcpqc-jdk18on:${Versions.castle}")
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.junit5}")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
}

tasks.test { useJUnitPlatform() }
Loading
Loading