From 632671919b37e1af6b6748c705f3a19d5636ece8 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Mon, 13 May 2024 17:30:47 +0500 Subject: [PATCH 1/5] Update plugin for compatibility with new openedx mobile repositories and upgrade dependencies --- tutorandroid/plugin.py | 4 +-- .../templates/android/build/Dockerfile | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tutorandroid/plugin.py b/tutorandroid/plugin.py index 41a69ff..255e079 100644 --- a/tutorandroid/plugin.py +++ b/tutorandroid/plugin.py @@ -116,9 +116,9 @@ def _build_custom_android_app( mounts: list[tuple[str, str]], host_path: str ) -> list[tuple[str, str]]: path_basename = os.path.basename(host_path) - if path_basename == "edx-app-android": + if path_basename == "openedx-app-android": # Bind-mount repo at build-time - mounts.append(("android", "edx-app-android")) + mounts.append(("android", "openedx-app-android")) return mounts diff --git a/tutorandroid/templates/android/build/Dockerfile b/tutorandroid/templates/android/build/Dockerfile index 0352dc4..bc610c3 100644 --- a/tutorandroid/templates/android/build/Dockerfile +++ b/tutorandroid/templates/android/build/Dockerfile @@ -16,7 +16,8 @@ FROM base AS sdk # Install Android SDK # Inspired from https://github.com/LiveXP/docker-android-sdk/blob/master/Dockerfile # Get sdk version from here: https://developer.android.com/studio#command-tools -ENV ANDROID_SDK_VERSION 10406996 +# ENV ANDROID_SDK_VERSION 10406996 +ENV ANDROID_SDK_VERSION 11076708 ENV ANDROID_SDK_PATH /app/android-sdk ENV ANDROID_HOME /app/android-sdk RUN mkdir ${ANDROID_HOME} @@ -28,27 +29,26 @@ RUN wget --quiet https://dl.google.com/android/repository/commandlinetools-linux # Accept licenses # https://developer.android.com/studio/command-line/sdkmanager # Check target version: https://github.com/edx/edx-app-android/blob/master/constants.gradle -ARG ANDROID_API_LEVEL=33 +ARG ANDROID_API_LEVEL=34 RUN yes | /app/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --install "platforms;android-$ANDROID_API_LEVEL" 1> /dev/null ###### Checkout code FROM base AS code # Install android app repo -ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/edx-app-android.git - -# Please add ANDROID_APP_VERSION value in tutor config from release version https://github.com/openedx/edx-app-android/tags -ARG ANDROID_APP_VERSION={% if OPENEDX_COMMON_VERSION == "master" %}master{% else %}release/{{ ANDROID_APP_VERSION }}{% endif %} -ADD --keep-git-dir $ANDROID_APP_REPOSITORY#$ANDROID_APP_VERSION /app/edx-app-android +ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/openedx-app-android.git +# Always use the 'main' branch +ARG ANDROID_APP_VERSION=main +ADD --keep-git-dir $ANDROID_APP_REPOSITORY#$ANDROID_APP_VERSION /app/openedx-app-android ###### Empty layer to mount custom repo at build time -FROM scratch AS edx-app-android -COPY --from=code /app/edx-app-android / +FROM scratch AS openedx-app-android +COPY --from=code /app/openedx-app-android / ###### Common layer, which will be used to build the user-specific image later FROM sdk AS common -COPY --from=edx-app-android / /app/edx-app-android -WORKDIR /app/edx-app-android +COPY --from=openedx-app-android / /app/openedx-app-android +WORKDIR /app/openedx-app-android # Install gradle and all dependencies RUN ./gradlew -v @@ -68,10 +68,11 @@ RUN cat ./gradle.properties.tutor >> ./gradle.properties # uncomment this line for for release APK. # RUN sed -i "s/APPLICATION_ID = .*/APPLICATION_ID = \"{{ LMS_HOST|reverse_host|replace("-", "_") }}\"/g" constants.gradle -RUN ./gradlew assembleProd{{ "Release" if ANDROID_ENABLE_RELEASE_MODE else "Debuggable" }} +RUN ./gradlew assembleProd{{ "Release" if ANDROID_ENABLE_RELEASE_MODE else "Debug" }} +# ./gradlew assembleProdRelease #### File server to serve apk file # https://hub.docker.com/_/caddy?tab=tags FROM docker.io/caddy:2.6.4-alpine as production -COPY --from=build /app/edx-app-android/OpenEdXMobile/build/outputs/apk/prod/{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debuggable" }}/edx-{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debuggable" }}-{{ ANDROID_APP_VERSION }}.apk /srv/app.apk +COPY --from=build /app/openedx-app-android/app/build/outputs/apk/prod/{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debug" }}/app-prod-{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debug" }}.apk /srv/app.apk CMD caddy file-server --listen=:8000 --root=/srv From 1f1da5b1c04e964e20d985163799d43c79817a75 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Mon, 13 May 2024 17:38:05 +0500 Subject: [PATCH 2/5] update readme --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 1e5825e..b334a54 100644 --- a/README.rst +++ b/README.rst @@ -23,16 +23,16 @@ The ``.apk`` file will then be available for download at http(s)://mobile.LMS_HO Building a custom Android app ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The Android app is built from the `official edx-app-android repository `__. To change this repository or the app version, you can simply build a different docker image with:: +The Android app is built from the `official openedx-app-android repository `__. To change this repository or the app version, you can simply build a different docker image with:: tutor images build \ - --build-arg ANDROID_APP_REPOSITORY=https://github.com/mycustomfork/edx-app-android \ + --build-arg ANDROID_APP_REPOSITORY=https://github.com/mycustomfork/openedx-app-android \ --build-arg ANDROID_APP_VERSION=master \ android -Alternatively, you can build an image from a local checked-out fork of edx-app-android:: +Alternatively, you can build an image from a local checked-out fork of openedx-app-android:: - tutor mounts add /path/to/edx-app-android + tutor mounts add /path/to/openedx-app-android tutor local launch Making courses visible in app From e41bf64542bdd118fa04084595c32ba9dcdff6cd Mon Sep 17 00:00:00 2001 From: hamza shafique Date: Wed, 22 May 2024 18:11:27 +0500 Subject: [PATCH 3/5] Update config path --- tutorandroid/templates/android/build/Dockerfile | 7 ++++--- .../templates/android/build/config/gradle.properties | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tutorandroid/templates/android/build/Dockerfile b/tutorandroid/templates/android/build/Dockerfile index bc610c3..d50fdd0 100644 --- a/tutorandroid/templates/android/build/Dockerfile +++ b/tutorandroid/templates/android/build/Dockerfile @@ -16,7 +16,6 @@ FROM base AS sdk # Install Android SDK # Inspired from https://github.com/LiveXP/docker-android-sdk/blob/master/Dockerfile # Get sdk version from here: https://developer.android.com/studio#command-tools -# ENV ANDROID_SDK_VERSION 10406996 ENV ANDROID_SDK_VERSION 11076708 ENV ANDROID_SDK_PATH /app/android-sdk ENV ANDROID_HOME /app/android-sdk @@ -58,8 +57,10 @@ RUN ./gradlew tasks FROM common as build # User-customized config -COPY ./config/edx.properties ./OpenEdXMobile/default_config/edx.properties -COPY ./config/tutor.yaml ./OpenEdXMobile/default_config/tutor.yaml +# COPY ./config/edx.properties ./OpenEdXMobile/default_config/edx.properties +COPY ./config/tutor.yaml ./default_config/dev/config.yaml +COPY ./config/tutor.yaml ./default_config/stage/config.yaml +COPY ./config/tutor.yaml ./default_config/prod/config.yaml {% if ANDROID_ENABLE_RELEASE_MODE %} # Add release settings COPY ./config/gradle.properties ./gradle.properties.tutor diff --git a/tutorandroid/templates/android/build/config/gradle.properties b/tutorandroid/templates/android/build/config/gradle.properties index f915656..4fa7cb0 100644 --- a/tutorandroid/templates/android/build/config/gradle.properties +++ b/tutorandroid/templates/android/build/config/gradle.properties @@ -1,4 +1,4 @@ -RELEASE_STORE_FILE=/app/edx-app-android/OpenEdXMobile/app.keystore +RELEASE_STORE_FILE=/app/openedx-app-android/OpenEdXMobile/app.keystore RELEASE_STORE_PASSWORD={{ ANDROID_RELEASE_STORE_PASSWORD }} RELEASE_KEY_PASSWORD={{ ANDROID_RELEASE_KEY_PASSWORD }} RELEASE_KEY_ALIAS={{ ANDROID_RELEASE_KEY_ALIAS }} From 939e89aadfc8bf6a9986be4787ebfc6501ff1b9e Mon Sep 17 00:00:00 2001 From: hamza shafique Date: Mon, 27 May 2024 18:39:36 +0500 Subject: [PATCH 4/5] Update RELEASE_STORE_FILE path --- tutorandroid/templates/android/build/Dockerfile | 1 - tutorandroid/templates/android/build/config/gradle.properties | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tutorandroid/templates/android/build/Dockerfile b/tutorandroid/templates/android/build/Dockerfile index d50fdd0..f74a3dd 100644 --- a/tutorandroid/templates/android/build/Dockerfile +++ b/tutorandroid/templates/android/build/Dockerfile @@ -57,7 +57,6 @@ RUN ./gradlew tasks FROM common as build # User-customized config -# COPY ./config/edx.properties ./OpenEdXMobile/default_config/edx.properties COPY ./config/tutor.yaml ./default_config/dev/config.yaml COPY ./config/tutor.yaml ./default_config/stage/config.yaml COPY ./config/tutor.yaml ./default_config/prod/config.yaml diff --git a/tutorandroid/templates/android/build/config/gradle.properties b/tutorandroid/templates/android/build/config/gradle.properties index 4fa7cb0..9ebedea 100644 --- a/tutorandroid/templates/android/build/config/gradle.properties +++ b/tutorandroid/templates/android/build/config/gradle.properties @@ -1,4 +1,4 @@ -RELEASE_STORE_FILE=/app/openedx-app-android/OpenEdXMobile/app.keystore +RELEASE_STORE_FILE=/app/openedx-app-android/app.keystore RELEASE_STORE_PASSWORD={{ ANDROID_RELEASE_STORE_PASSWORD }} RELEASE_KEY_PASSWORD={{ ANDROID_RELEASE_KEY_PASSWORD }} RELEASE_KEY_ALIAS={{ ANDROID_RELEASE_KEY_ALIAS }} From f534e4fa07e97504e9b0eda565e167ce7dd91595 Mon Sep 17 00:00:00 2001 From: hamza shafique Date: Wed, 5 Jun 2024 16:18:14 +0500 Subject: [PATCH 5/5] Add changelog entry --- ...0240605_161642_hamzashafique_update_dependencies_new_repos.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md diff --git a/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md b/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md new file mode 100644 index 0000000..781dc8a --- /dev/null +++ b/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md @@ -0,0 +1 @@ +- [Feature] Upgrade the deprecated [edx-app-android](https://github.com/openedx-unsupported/edx-app-android) to [openedx-app-android](https://github.com/openedx/openedx-app-android). (by @hamza-56)