From 78ebeb6a5ac75f97b3a2ad27ace31ad35670fe97 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 14 Sep 2023 15:59:33 -0600 Subject: [PATCH] Ladybird/Android: Move gradle files to Ladybird/Android directory And add documentation for how to use the thing --- Documentation/AndroidStudioConfiguration.md | 25 ++++++++++++++++++ Documentation/BuildInstructionsLadybird.md | 5 ++++ Ladybird/Android/build.gradle.kts | 7 ++--- .../Android/gradle.properties | 0 .../gradle}/wrapper/gradle-wrapper.jar | Bin .../gradle}/wrapper/gradle-wrapper.properties | 0 gradlew => Ladybird/Android/gradlew | 0 .../Android/settings.gradle.kts | 2 -- Meta/Azure/Lagom.yml | 2 +- build.gradle.kts | 5 ---- 10 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 Documentation/AndroidStudioConfiguration.md rename gradle.properties => Ladybird/Android/gradle.properties (100%) rename {gradle => Ladybird/Android/gradle}/wrapper/gradle-wrapper.jar (100%) rename {gradle => Ladybird/Android/gradle}/wrapper/gradle-wrapper.properties (100%) rename gradlew => Ladybird/Android/gradlew (100%) rename settings.gradle.kts => Ladybird/Android/settings.gradle.kts (79%) delete mode 100644 build.gradle.kts diff --git a/Documentation/AndroidStudioConfiguration.md b/Documentation/AndroidStudioConfiguration.md new file mode 100644 index 00000000000..845ce427435 --- /dev/null +++ b/Documentation/AndroidStudioConfiguration.md @@ -0,0 +1,25 @@ +## Android Studio Project Configuration + +The Android port of Ladybird has straightforward integration with the Android Studio IDE. + +After opening the ``serenity`` directory in Android Studio (NOT the Ladybird/Android directory!) +there should be a pop-up in the bottom left indicating that an Android Gradle project was detected +in ``Ladybird/Android``. + +In the top left of the screen in the Project view, navigate to ``Ladybird/Android``. Or, click the +highlighted text in the notification for that path. Open the ``settings.gradle.kts`` file. At the +top of the file should be a banner that says ``Code Insight unavailable (related Gradle project not +linked).`` Click the ``Link Gradle project`` text on the right side of the banner. After the IDE +loads the Gradle view to the right of the code window, go back to the banner at the top of the +``settings.gradle.kts`` file and click ``Load Script Configurations`` to finish loading the Gradle +project. + +Gradle will index the project, and download all the required plugins. If it complains about no NDK, +follow the instructions in Android Studio to install an appropriate NDK version. If it still +complains about the NDK version, open ``File->Invalidate Caches...`` and click ``Invalidate and +Restart``. + +## Getting the most out of the IDE + +See the sections in the [CLionConfiguration](CLionConfiguration.md) for [Excluding Build Artifacts](CLionConfiguration.md#excluding-build-artifacts), +and [Code Generation Settings](CLionConfiguration.md#code-generation-settings). diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index c649aed7141..fc622cd9e43 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -63,6 +63,11 @@ On Windows: WSL2/WSLg are preferred, as they provide a linux environment that matches one of the above distributions. MinGW/MSYS2 are not supported, but may work with sufficient elbow grease. Native Windows builds are not supported with either clang-cl or MSVC. +For Android: + +On a Unix-like platform, install the prerequisites for that platform and then see the [Android Studio guide](AndroidStudioConfiguration.md). +Or, download a version of Gradle >= 8.0.0, and run the ``gradlew`` program in ``Ladybird/Android`` + ## Build steps ### Using serenity.sh diff --git a/Ladybird/Android/build.gradle.kts b/Ladybird/Android/build.gradle.kts index ea80094b160..90a9c51f01f 100644 --- a/Ladybird/Android/build.gradle.kts +++ b/Ladybird/Android/build.gradle.kts @@ -1,8 +1,8 @@ import com.android.build.gradle.internal.tasks.factory.dependsOn plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") + id("com.android.application") version "8.1.1" + id("org.jetbrains.kotlin.android") version "1.9.0" } var cacheDir = System.getenv("SERENITY_CACHE_DIR") ?: "$buildDir/caches" @@ -11,11 +11,12 @@ task("buildLagomTools") { commandLine = listOf("./BuildLagomTools.sh") environment = mapOf( "BUILD_DIR" to "$buildDir", - "CACHE_DIR" to "$cacheDir", + "CACHE_DIR" to cacheDir, "PATH" to System.getenv("PATH")!! ) } tasks.named("preBuild").dependsOn("buildLagomTools") +tasks.named("prepareKotlinBuildScriptModel").dependsOn("buildLagomTools") android { namespace = "org.serenityos.ladybird" diff --git a/gradle.properties b/Ladybird/Android/gradle.properties similarity index 100% rename from gradle.properties rename to Ladybird/Android/gradle.properties diff --git a/gradle/wrapper/gradle-wrapper.jar b/Ladybird/Android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from gradle/wrapper/gradle-wrapper.jar rename to Ladybird/Android/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/Ladybird/Android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradle/wrapper/gradle-wrapper.properties rename to Ladybird/Android/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew b/Ladybird/Android/gradlew similarity index 100% rename from gradlew rename to Ladybird/Android/gradlew diff --git a/settings.gradle.kts b/Ladybird/Android/settings.gradle.kts similarity index 79% rename from settings.gradle.kts rename to Ladybird/Android/settings.gradle.kts index d9d42c85763..5895af3dc53 100644 --- a/settings.gradle.kts +++ b/Ladybird/Android/settings.gradle.kts @@ -14,5 +14,3 @@ dependencyResolutionManagement { } rootProject.name = "Ladybird" -include("Ladybird") -project(":Ladybird").projectDir = file("Ladybird/Android") diff --git a/Meta/Azure/Lagom.yml b/Meta/Azure/Lagom.yml index 35a54f64ecd..5641999a7bd 100644 --- a/Meta/Azure/Lagom.yml +++ b/Meta/Azure/Lagom.yml @@ -83,7 +83,7 @@ jobs: - task: Gradle@2 inputs: - workingDirectory: '' + workingDirectory: 'Ladybird/Android' gradleWrapperFile: 'gradlew' gradleOptions: '-Xmx3072m' jdkVersionOption: '17' diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 95cbdb3cac3..00000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id("com.android.application") version "8.1.1" apply false - id("org.jetbrains.kotlin.android") version "1.9.0" apply false -}