diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 24c806300e1f1c8f735872cbf9399682c67c1ac7..8160b8fa22ad048504de4b6877cf26a99896c45d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,14 +23,27 @@ android:build-debug: - echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties - echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties # build flutter app + - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)" + - echo "${VERSION_NAME}" + - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)" + - echo "${VERSION_CODE}" - flutter packages get - flutter clean + - flutter build apk --debug --split-per-abi - flutter build apk --debug # prepare artifact - - find . -name "*.apk" # where is my apk? + - BASE_APK_FOLDER="build/app/outputs/flutter-apk" + - APP_NAME="$(grep 'namespace' android/app/build.gradle | cut -d'"' -f2)" + - > + if [ "$(find "${BASE_APK_FOLDER}" -name "*.apk")" != "" ]; then + for APK in ${BASE_APK_FOLDER}/*.apk; do + mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|" | sed "s|/app-|/${APP_NAME}-|")" + done + fi + - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk? artifacts: paths: - - build/app/outputs/apk/debug + - build/app/outputs/flutter-apk expire_in: 1 week interruptible: true @@ -52,9 +65,12 @@ android:build-release: - echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties - echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties # build flutter app - - VERSION_FILE="$(find . -name 'gradle.properties' | head -n1)" - - VERSION_NAME="$(grep '^app.versionName=' "${VERSION_FILE}" | cut -d'=' -f2)" - - VERSION_CODE="$(grep '^app.versionCode=' "${VERSION_FILE}" | cut -d'=' -f2)" + - BASE_APK_FOLDER="build/app/outputs/flutter-apk" + - echo "${BASE_APK_FOLDER}" + - mkdir -p "${BASE_APK_FOLDER}" + - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)" + - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)" + - APP_NAME="$(grep 'namespace' android/app/build.gradle | cut -d'"' -f2)" - TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}" - echo "${TAG_NAME}" - > @@ -63,13 +79,20 @@ android:build-release: else flutter packages get flutter clean + flutter build apk --release --split-per-abi flutter build apk --release fi # prepare artifact - - find . -name "*.apk" # where is my apk? + - > + if [ "$(find "${BASE_APK_FOLDER}" -name "*.apk")" != "" ]; then + for APK in ${BASE_APK_FOLDER}/*.apk; do + mv -v "${APK}" "$(echo "${APK}" | sed "s|\.apk|_${VERSION_CODE}.apk|" | sed "s|/app-|/${APP_NAME}-|")" + done + fi + - find "${BASE_APK_FOLDER}" -name "*.apk" # where are my apk? artifacts: paths: - - build/app/outputs/apk/release + - build/app/outputs/flutter-apk expire_in: 1 week interruptible: true @@ -89,9 +112,8 @@ application:release: - git config user.email "${GITLAB_USER_EMAIL}" - git config user.name "${GITLAB_USER_NAME}" - git remote set-url origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH} - - VERSION_FILE="$(find . -name 'gradle.properties' | head -n1)" - - VERSION_NAME="$(grep '^app.versionName=' "${VERSION_FILE}" | cut -d'=' -f2)" - - VERSION_CODE="$(grep '^app.versionCode=' "${VERSION_FILE}" | cut -d'=' -f2)" + - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1)" + - VERSION_CODE="$(grep '^version:' pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f2)" - TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}" - echo "${TAG_NAME}" - > diff --git a/android/.gitignore b/android/.gitignore index 0a741cb43d66c6790a2a913fa24c8878fb1ab7b5..55afd919c6591c63bfcfda8a5ce8a60acc7666ca 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -7,5 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle index 26a3890d2622f80fd5ad86f3c5b9d1eab8a03ce5..87a3259ac07738866113a2c0384ba9d293595f7d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,32 +4,6 @@ plugins { id "dev.flutter.flutter-gradle-plugin" } -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def gradleProperties = new Properties() -def gradlePropertiesFile = rootProject.file('gradle.properties') -if (gradlePropertiesFile.exists()) { - gradlePropertiesFile.withReader('UTF-8') { reader -> - gradleProperties.load(reader) - } -} - -def appVersionCode = gradleProperties.getProperty('app.versionCode') -if (appVersionCode == null) { - appVersionCode = '1' -} - -def appVersionName = gradleProperties.getProperty('app.versionName') -if (appVersionName == null) { - appVersionName = '1.0' -} - def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { @@ -37,33 +11,69 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 34 - namespace "org.benoitharrault.puzzlegame" + namespace = "org.benoitharrault.puzzlegame" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } defaultConfig { - applicationId "org.benoitharrault.puzzlegame" - minSdkVersion flutter.minSdkVersion - targetSdkVersion 30 - versionCode appVersionCode.toInteger() - versionName appVersionName - archivesBaseName = "$applicationId" + "_" + "$versionCode" + applicationId = "org.benoitharrault.puzzlegame" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } signingConfigs { release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] + keyAlias = keystoreProperties['keyAlias'] + keyPassword = keystoreProperties['keyPassword'] + storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword = keystoreProperties['storePassword'] } } buildTypes { release { - signingConfig signingConfigs.release + signingConfig = signingConfigs.release + } + } + + splits { + abi { + reset() + include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } } +ext.abiCodes = [ + 'armeabi': 1, + 'armeabi-v7a': 2, + 'arm64-v8a': 3, + 'x86': 4, + 'x86_64': 5, +] + +import com.android.build.OutputFile + +android.applicationVariants.all { variant -> + variant.outputs.each { output -> + def perAbiVersionCodeIncrement = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) + + if (perAbiVersionCodeIncrement != null) { + output.versionCodeOverride = variant.versionCode * 1000 + perAbiVersionCodeIncrement + } + } +} + flutter { - source '../..' + source = "../.." } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 7d56975fa5cb1cad7544bc794beea0c97bcae76f..bbd7ee77760dad3964ef473a1cd012740c6975ec 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,7 +1,3 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.benoitharrault.puzzlegame"> - <!-- Flutter needs it to communicate with the running application - to allow setting breakpoints, to provide hot reload, etc. - --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET"/> </manifest> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a9b03a71c4c02588d6890372106b4ed718a98873..c535fb3c02422be3bdd9559b019778be12fe3e96 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,11 +1,13 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.benoitharrault.puzzlegame"> - <application +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> + <application android:label="puzzlegame" + android:name="${applicationName}" android:icon="@mipmap/ic_launcher"> <activity android:name=".MainActivity" + android:exported="true" android:launchMode="singleTop" + android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" @@ -27,4 +29,10 @@ android:name="flutterEmbedding" android:value="2" /> </application> + <queries> + <intent> + <action android:name="android.intent.action.PROCESS_TEXT"/> + <data android:mimeType="text/plain"/> + </intent> + </queries> </manifest> diff --git a/android/app/src/main/java/org/benoitharrault/puzzlegame/MainActivity.java b/android/app/src/main/java/org/benoitharrault/puzzlegame/MainActivity.java deleted file mode 100644 index 46c07b5babccd3076a2621d676c4b6bccc895cd0..0000000000000000000000000000000000000000 --- a/android/app/src/main/java/org/benoitharrault/puzzlegame/MainActivity.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.benoitharrault.puzzlegame; - -import io.flutter.embedding.android.FlutterActivity; - -public class MainActivity extends FlutterActivity { -} diff --git a/android/app/src/main/kotlin/org/benoitharrault/puzzlegame/MainActivity.kt b/android/app/src/main/kotlin/org/benoitharrault/puzzlegame/MainActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..bf4314ccc7c83cb1b1e19f45f25bc74fd959a19c --- /dev/null +++ b/android/app/src/main/kotlin/org/benoitharrault/puzzlegame/MainActivity.kt @@ -0,0 +1,5 @@ +package org.benoitharrault.puzzlegame + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 7d56975fa5cb1cad7544bc794beea0c97bcae76f..bbd7ee77760dad3964ef473a1cd012740c6975ec 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,7 +1,3 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.benoitharrault.puzzlegame"> - <!-- Flutter needs it to communicate with the running application - to allow setting breakpoints, to provide hot reload, etc. - --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET"/> </manifest> diff --git a/android/build.gradle b/android/build.gradle index bc157bd1a12b9084c8bb65ade59863a6b71818c8..d2ffbffa4cd251cc00b2b93a5efc2a0213460220 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,12 +5,12 @@ allprojects { } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { diff --git a/android/gradle.properties b/android/gradle.properties index 188fa3744d3e88f37f9cf1acfbc7685f34ba58a5..2597170821647d2bd8b150d973a35d27c99a5f44 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true -app.versionName=0.1.1 -app.versionCode=63 diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index b1159fc54f39b3b208f767fd65a460b6016e04ad..7bb2df6ba6ea53ebbee820728a3eef274ddd71bd 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 8cc46c09d77d48509d53e4f5d0825a2b14444403..b9e43bd37614c4e28ab1d41c3d6a262832ce26e4 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -5,10 +5,9 @@ pluginManagement { def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath - } - settings.ext.flutterSdkPath = flutterSdkPath() + }() - includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() @@ -19,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.2.2" apply false - id "org.jetbrains.kotlin.android" version "1.9.22" apply false + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false } include ":app" diff --git a/fastlane/metadata/android/en-US/changelogs/64.txt b/fastlane/metadata/android/en-US/changelogs/64.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ac84b0f4869c53595225d396d23d26494b39583 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/64.txt @@ -0,0 +1 @@ +Improve build process, split packages per ABI. diff --git a/fastlane/metadata/android/fr-FR/changelogs/64.txt b/fastlane/metadata/android/fr-FR/changelogs/64.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c135423f26968ae2a3c72bdf1e5a6a57d2aed34 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/64.txt @@ -0,0 +1 @@ +Amélioration du processus de construction. Éclatement des packages par ABI. diff --git a/pubspec.yaml b/pubspec.yaml index fc52e0d73698e3210bf8534cbddfd9cbe87f6a8a..9930c055c39f32178183949adb9f6e578f46acc1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A puzzle game application. publish_to: "none" -version: 0.1.1+63 +version: 0.2.0+64 environment: sdk: "^3.0.0"