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

Merge branch '1-add-minimal-empty-application' into 'master'

Resolve "Add minimal empty application"

Closes #1

See merge request !1
parents 1cda6c55 ab4146b9
No related branches found
No related tags found
1 merge request!1Resolve "Add minimal empty application"
Pipeline #1911 passed
Showing
with 412 additions and 2 deletions
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
image: cirrusci/flutter:latest
stages:
- update
- build-debug
- build-release
- release
- deploy
update:
stage: update
except:
- tags
script:
- flutter packages get
- flutter packages upgrade
interruptible: true
android:build-debug:
stage: build-debug
except:
- tags
script:
# Flutter local configuration
- echo flutter.sdk=$FLUTTER_PATH > android/local.properties
- echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties
- echo flutter.buildMode=debug >> android/local.properties
# Android signing
- echo "$ANDROID_DEBUG_KEYSTORE_FILE" | base64 -d > android/app/my.keystore
- echo storeFile=my.keystore > android/key.properties
- echo storePassword=$ANDROID_DEBUG_KEYSTORE_PASSWORD >> android/key.properties
- echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties
- echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties
# build flutter app
- flutter packages get
- flutter clean
- flutter build apk --debug
# prepare artifact
- find . -name "*.apk" # where is my apk?
artifacts:
paths:
- build/app/outputs/apk/debug
expire_in: 1 week
interruptible: true
android:build-release:
stage: build-release
only:
- master
except:
- tags
dependencies:
- android:build-debug
script:
# Flutter local configuration
- echo flutter.sdk=$FLUTTER_PATH > android/local.properties
- echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties
- echo flutter.buildMode=release >> android/local.properties
# Android signing
- echo "$ANDROID_KEYSTORE_FILE" | base64 -d > android/app/my.keystore
- echo storeFile=my.keystore > android/key.properties
- echo storePassword=$ANDROID_KEYSTORE_PASSWORD >> android/key.properties
- 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)"
- TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}"
- echo "${TAG_NAME}"
- >
if [ $(git tag -l "${TAG_NAME}") ]; then
echo "Tag ${TAG_NAME} already exists. Skipping build release."
else
flutter packages get
flutter clean
flutter build apk --release
fi
# prepare artifact
- find . -name "*.apk" # where is my apk?
artifacts:
paths:
- build/app/outputs/apk/release
expire_in: 1 week
interruptible: true
application:release:
stage: release
image:
name: alpine/git
entrypoint: [""]
only:
- master
except:
- tags
dependencies:
- android:build-release
script:
- apk --no-cache add curl
- 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)"
- TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}"
- echo "${TAG_NAME}"
- >
if [ $(git tag -l "${TAG_NAME}") ]; then
echo "Tag ${TAG_NAME} already exists. Skipping release and tag creation."
else
git tag -a "${TAG_NAME}" -m "Release ${VERSION_NAME} (${VERSION_CODE})"
git push origin "${TAG_NAME}"
curl --silent -d "{\"token\": \"${JABBER_NOTIFICATION_TOKEN}\", \"message\": \"New tag for ${CI_PROJECT_PATH}: ${TAG_NAME}\"}" -H "Content-Type: application/json" -X POST ${JABBER_NOTIFICATION_URL}
fi
android:deploy:
stage: deploy
only:
- tags
dependencies:
- application:release
script:
- curl "${REPOSITORY_UPDATE_WEBHOOK}?token=${REPOSITORY_TOKEN}"
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 5bedb7b1d5698ce2c1c67aaf9afae7b3948b172a
channel: beta
project_type: app
# org.benoitharrault.reversi
# Reversi game
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
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 flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def appVersionCode = gradleProperties.getProperty('app.versionCode')
if (appVersionCode == null) {
appVersionCode = '1'
}
def appVersionName = gradleProperties.getProperty('app.versionName')
if (appVersionName == null) {
appVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "org.benoitharrault.reversi"
minSdkVersion 16
targetSdkVersion 30
versionCode appVersionCode.toInteger()
versionName appVersionName
archivesBaseName = "$applicationId" + "_" + "$versionCode"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.reversi">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.reversi">
<application
android:label="reversi"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
package org.benoitharrault.reversi;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
android/app/src/main/res/mipmap-hdpi/ic_launcher.png

1.95 KiB

android/app/src/main/res/mipmap-mdpi/ic_launcher.png

1.27 KiB

android/app/src/main/res/mipmap-xhdpi/ic_launcher.png

2.94 KiB

android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png

4.64 KiB

android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

6.45 KiB

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.benoitharrault.reversi">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
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