diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47111cd3..d3e5f196 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,17 +4,38 @@ stages:
- staging
- prod
-build:
+build-site:
stage: build
image: node:14.5.0
variables:
NODE_OPTIONS: "--max_old_space_size=2048"
script:
- cd ./src
- - make build
+ - make build-site
artifacts:
paths:
- ./src/dist/dynamicbible
+ needs: ["test"]
+
+build-android:
+ stage: build
+ image: gradle:6.1.1-jdk8
+ before_script:
+ - curl -sL https://deb.nodesource.com/setup_14.x | bash -
+ - apt-get install -y nodejs
+ - cd ./src/android
+ - bash ./install-sdk.sh
+ - cd ..
+ script:
+ - npm ci
+ - npm run-script build
+ - npm run-script copy
+ - cd android
+ - gradle assembleRelease
+ artifacts:
+ paths:
+ - ./src/android/app/build/outputs
+ needs: ["test"]
test:
stage: test
@@ -35,8 +56,9 @@ deploy-staging:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
allow_failure: false
+ needs: ["build-site"]
-deploy-prod:
+deploy-prod-site:
stage: prod
image: google/cloud-sdk
script:
@@ -46,3 +68,4 @@ deploy-prod:
- if: '$CI_COMMIT_BRANCH == "main"'
when: manual
allow_failure: false
+ needs: ["build-site"]
diff --git a/src/Makefile b/src/Makefile
index 69a30016..fbc52aec 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,10 +5,17 @@ test:
npm run-script lint
npm run-script test-headless
-build:
+build-site:
npm ci
npm run-script build
+build-android:
+ npm run-script copy
+ cd android/
+ ./gradlew assembleRelease
+
+build: build-site build-android
+
authorize-service-account:
gcloud auth activate-service-account ${gcloud_service_account_email} --key-file=${gcloud_service_account_key} | tee authorize.log
diff --git a/src/android/.gitignore b/src/android/.gitignore
index 64a88fbc..cbe44eec 100644
--- a/src/android/.gitignore
+++ b/src/android/.gitignore
@@ -84,8 +84,8 @@ lint/outputs/
lint/tmp/
# lint/reports/
-# Cordova plugins for Capacitor
-capacitor-cordova-android-plugins
-
# Copied web assets
app/src/main/assets/public
+
+# Android SDK downloads
+android-sdk/
diff --git a/src/android/.idea/codeStyles/Project.xml b/src/android/.idea/codeStyles/Project.xml
deleted file mode 100644
index 681f41ae..00000000
--- a/src/android/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- xmlns:android
-
- ^$
-
-
-
-
-
-
-
-
- xmlns:.*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*:id
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- .*:name
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- name
-
- ^$
-
-
-
-
-
-
-
-
- style
-
- ^$
-
-
-
-
-
-
-
-
- .*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*
-
- http://schemas.android.com/apk/res/android
-
-
- ANDROID_ATTRIBUTE_ORDER
-
-
-
-
-
-
- .*
-
- .*
-
-
- BY_NAME
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/.idea/jarRepositories.xml b/src/android/.idea/jarRepositories.xml
deleted file mode 100644
index e34606cc..00000000
--- a/src/android/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/.idea/misc.xml b/src/android/.idea/misc.xml
deleted file mode 100644
index b6ea2b11..00000000
--- a/src/android/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/.idea/runConfigurations.xml b/src/android/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460d..00000000
--- a/src/android/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/build.gradle b/src/android/build.gradle
index 03f2b8cf..fc069ba1 100644
--- a/src/android/build.gradle
+++ b/src/android/build.gradle
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
-
+
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.0'
+ classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/src/android/capacitor-cordova-android-plugins/build.gradle b/src/android/capacitor-cordova-android-plugins/build.gradle
new file mode 100644
index 00000000..304a4c3f
--- /dev/null
+++ b/src/android/capacitor-cordova-android-plugins/build.gradle
@@ -0,0 +1,57 @@
+ext {
+ cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '7.0.0'
+}
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.6.1'
+ }
+}
+
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
+ defaultConfig {
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
+ targetSdkVersion targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
+ versionCode 1
+ versionName "1.0"
+ }
+ lintOptions {
+ abortOnError false
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ flatDir{
+ dirs 'src/main/libs', 'libs'
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])
+ implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
+ // SUB-PROJECT DEPENDENCIES START
+
+ // SUB-PROJECT DEPENDENCIES END
+}
+
+// PLUGIN GRADLE EXTENSIONS START
+apply from: "cordova.variables.gradle"
+// PLUGIN GRADLE EXTENSIONS END
+
+for (def func : cdvPluginPostBuildExtras) {
+ func()
+}
\ No newline at end of file
diff --git a/src/android/capacitor-cordova-android-plugins/cordova.variables.gradle b/src/android/capacitor-cordova-android-plugins/cordova.variables.gradle
new file mode 100644
index 00000000..68a95df9
--- /dev/null
+++ b/src/android/capacitor-cordova-android-plugins/cordova.variables.gradle
@@ -0,0 +1,6 @@
+// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
+ext {
+ cdvMinSdkVersion = project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
+ // Plugin gradle extensions can append to this to have code run at the end.
+ cdvPluginPostBuildExtras = []
+}
\ No newline at end of file
diff --git a/src/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml b/src/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..8f3bd61d
--- /dev/null
+++ b/src/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep b/src/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/src/android/capacitor-cordova-android-plugins/src/main/res/.gitkeep b/src/android/capacitor-cordova-android-plugins/src/main/res/.gitkeep
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/src/android/capacitor-cordova-android-plugins/src/main/res/.gitkeep
@@ -0,0 +1 @@
+
diff --git a/src/android/gradle/wrapper/gradle-wrapper.properties b/src/android/gradle/wrapper/gradle-wrapper.properties
index 49a904cb..4e1cc9db 100644
--- a/src/android/gradle/wrapper/gradle-wrapper.properties
+++ b/src/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Mon Aug 17 14:57:20 EDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/src/android/gradlew.bat b/src/android/gradlew.bat
index 9618d8d9..24467a14 100644
--- a/src/android/gradlew.bat
+++ b/src/android/gradlew.bat
@@ -1,100 +1,100 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/android/install-sdk.sh b/src/android/install-sdk.sh
new file mode 100644
index 00000000..3c06dc8a
--- /dev/null
+++ b/src/android/install-sdk.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip"
+ANDROID_HOME="$(pwd)/android-sdk"
+ANDROID_VERSION=28
+ANDROID_BUILD_TOOLS_VERSION=27.0.3
+
+# Download Android SDK
+mkdir "$ANDROID_HOME" .android \
+ && cd "$ANDROID_HOME" \
+ && curl -o sdk.zip $SDK_URL \
+ && unzip sdk.zip \
+ && rm sdk.zip \
+ && mkdir "$ANDROID_HOME/licenses" || true \
+ && echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" \
+ && yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
+
+# Install Android Build Tool and Libraries
+$ANDROID_HOME/tools/bin/sdkmanager --update
+$ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
+ "platforms;android-${ANDROID_VERSION}" \
+ "platform-tools"
+
+# to prevent annoying warnings...
+touch /root/.android/repositories.cfg
+
+# Install Build Essentials
+echo sdk.dir=$ANDROID_HOME > ../local.properties