Skip to content

Commit

Permalink
Android - Added separation for development/production builds
Browse files Browse the repository at this point in the history
  • Loading branch information
PartyDonut committed Oct 18, 2024
1 parent 6d8f182 commit b1f49a3
Show file tree
Hide file tree
Showing 101 changed files with 377 additions and 73 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,25 @@ jobs:
flutter build apk --release \
--build-name=$VERSION_NAME \
--build-number=$GITHUB_RUN_NUMBER \
--dart-define=FLAVOR=release
--flavor production
# Build AAB
flutter build appbundle --release \
--build-name=$VERSION_NAME \
--build-number=$GITHUB_RUN_NUMBER \
--dart-define=FLAVOR=release
--flavor production
- name: Rename APK and AAB
run: |
mv build/app/outputs/flutter-apk/app-release.apk "build/app/outputs/flutter-apk/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.apk"
mv build/app/outputs/bundle/release/app-release.aab "build/app/outputs/bundle/release/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.aab"
mkdir -p build/app/outputs/android_artifacts
mv build/app/outputs/flutter-apk/app-production-release.apk "build/app/outputs/android_artifacts/${{ env.APP_NAME }}-Android-${{ env.VERSION_NAME }}.apk"
mv build/app/outputs/bundle/productionRelease/app-production-release.aab "build/app/outputs/android_artifacts/${{ env.APP_NAME }}-Android-${{ env.VERSION_NAME }}.aab"
- name: Archive Android artifacts
uses: actions/[email protected]
with:
name: ${{ env.APP_NAME }}-Android-${{ env.VERSION_NAME }}
path: |
build/app/outputs/flutter-apk/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.apk
build/app/outputs/bundle/release/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.aab
path: build/app/outputs/android_artifacts/

build-windows:
#Use windows-2019, latest(2022) causes MSVCP140.dll related crashes
Expand Down Expand Up @@ -274,6 +273,7 @@ jobs:
path: build/web

- name: Deploy to ghcr.io
if: startsWith(github.ref, 'refs/tags/v')
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: fladder
Expand All @@ -283,9 +283,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Github pages web
if: startsWith(github.ref, 'refs/tags/v')
run: flutter build web --base-href /${{ github.event.repository.name }}/ --release --build-number=$GITHUB_RUN_NUMBER

- name: Deploy to GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
Expand Down
66 changes: 31 additions & 35 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,62 @@
"version": "0.2.0",
"configurations": [
{
"name": "fladder",
"name": "Fladder Development (debug)",
"request": "launch",
"type": "dart",
"args": [
"--web-port",
"8096"
],
"--flavor",
"development"
]
},
{
"name": "fladder (profile mode)",
"name": "Fladder Production (debug)",
"request": "launch",
"type": "dart",
"flutterMode": "profile",
"args": [
"--web-port",
"9090"
],
"--flavor",
"production"
]
},
{
"name": "fladder (release mode)",
"name": "Fladder Development (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release",
"flutterMode": "profile",
"args": [
"--web-port",
"9090"
],
"--flavor",
"development"
]
},
{
"name": "Android",
"name": "Fladder Production (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile",
"args": [
"--flavor",
"production"
]
},
{
"name": "iPhone",
"name": "Fladder Development (release mode)",
"request": "launch",
"type": "dart",
"deviceId": "iphone"
"flutterMode": "release",
"args": [
"--flavor",
"development"
]
},
{
"name": "Windows",
"name": "Fladder Production (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"deviceId": "windows"
"flutterMode": "release",
"args": [
"--flavor",
"production"
]
},
{
"name": "Web",
Expand All @@ -72,20 +83,5 @@
"9090"
],
},
{
"name": "AndroidTV",
"request": "launch",
"program": "lib/android_tv/main.dart",
"type": "dart",
},
],
"compounds": [
{
"name": "All Devices",
"configurations": [
"Windows",
"Android"
],
}
]
}
11 changes: 8 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@
"command": "dart",
"args": [
"run",
"icons_launcher:create"
"icons_launcher:create",
"--flavors",
"development,production"
],
"label": "dart: generate launcher icons",
"detail": ""
"label": "dart: generate icons_launcher",
"detail": "",
"options": {
"cwd": "${workspaceFolder}"
}
}
],
}
18 changes: 15 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,24 @@ android {

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug{
applicationIdSuffix = ".debug"
}
}

flavorDimensions "default"
productFlavors {
development {
dimension "default"
applicationIdSuffix ".dev"
}
production {
dimension "default"
applicationIdSuffix ""
}
}
}

flutter {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions android/app/src/development/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FF21013A</color>
</resources>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
4 changes: 4 additions & 0 deletions android/app/src/production/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FF3A2101</color>
</resources>
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ allprojects {

rootProject.buildDir = '../build'

buildscript {
ext.kotlin_version = '1.8.0'
}

//[Fixes AAPT: error: resource android:attr/lStar not found]
subprojects {
afterEvaluate { project ->
Expand Down
Binary file added icons/development/fladder_adaptive_icon.png
Binary file added icons/development/fladder_icon.png
Binary file added icons/development/fladder_icon_desktop.png
Binary file added icons/development/fladder_macos_icon.png
Binary file added icons/development/fladder_store_icon.jpg
Binary file added icons/fladder_icon.afphoto
Binary file not shown.
Binary file removed icons/macos_icon.afphoto
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
24 changes: 24 additions & 0 deletions icons_launcher-development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
icons_launcher:
image_path: "icons/development/fladder_icon.png"
platforms:
android:
adaptive_foreground_image: "icons/development/fladder_icon.png"
adaptive_background_color: "#21013a"
adaptive_monochrome_image: "icons/development/fladder_adaptive_icon.png"
notification_image: icons/fladder_notification_icon.png
enable: true
ios:
image_path: "icons/development/fladder_store_icon.jpg"
enable: true
windows:
image_path: "icons/development/fladder_icon_desktop.png"
enable: true
macos:
image_path: "icons/development/fladder_macos_icon.png"
enable: true
linux:
image_path: "icons/development/fladder_icon_desktop.png"
enable: true
web:
favicon_path: "icons/development/fladder_icon_desktop.png"
enable: true
24 changes: 24 additions & 0 deletions icons_launcher-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
icons_launcher:
image_path: "icons/production/fladder_icon.png"
platforms:
android:
adaptive_foreground_image: "icons/production/fladder_icon.png"
adaptive_background_color: "#3a2101"
adaptive_monochrome_image: "icons/production/fladder_adaptive_icon.png"
notification_image: icons/fladder_notification_icon.png
enable: true
ios:
image_path: "icons/production/fladder_store_icon.jpg"
enable: true
windows:
image_path: "icons/production/fladder_icon_desktop.png"
enable: true
macos:
image_path: "icons/production/fladder_macos_icon.png"
enable: true
linux:
image_path: "icons/production/fladder_icon_desktop.png"
enable: true
web:
favicon_path: "icons/production/fladder_icon_desktop.png"
enable: true
24 changes: 0 additions & 24 deletions icons_launcher.yaml

This file was deleted.

Loading

0 comments on commit b1f49a3

Please sign in to comment.