Skip to content
Snippets Groups Projects
Commit cf9aa666 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '15-improve-build-process' into 'master'

Resolve "Improve build process"

Closes #15

See merge request !12
parents 02813f85 ae7bd41f
No related branches found
No related tags found
1 merge request!12Resolve "Improve build process"
Pipeline #6280 passed
Showing
with 114 additions and 82 deletions
......@@ -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}"
- >
......
......@@ -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
......@@ -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.midisynth"
namespace = "org.benoitharrault.midisynth"
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.midisynth"
minSdkVersion flutter.minSdkVersion
targetSdkVersion 30
versionCode appVersionCode.toInteger()
versionName appVersionName
archivesBaseName = "$applicationId" + "_" + "$versionCode"
applicationId = "org.benoitharrault.midisynth"
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 = "../.."
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.midisynth">
<!-- 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>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.midisynth">
<application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="midisynth"
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>
package org.benoitharrault.midisynth;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
package org.benoitharrault.midisynth
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.midisynth">
<!-- 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>
......@@ -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) {
......
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.11
app.versionCode=11
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
......@@ -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"
Improve build process, split packages per ABI.
Amélioration du processus de construction. Éclatement des packages par ABI.
......@@ -3,7 +3,7 @@ description: MIDI Synth
publish_to: "none"
version: 0.0.11+11
version: 0.1.0+12
environment:
sdk: "^3.0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment