Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Remove flutter_flavorizr by dart defines
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong0993 committed Oct 26, 2021
1 parent c0a4896 commit a52eabe
Show file tree
Hide file tree
Showing 37 changed files with 227 additions and 1,569 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Build
branches:
- master
env:
flutter_version: 2.5.2
flutter_version: 2.5.3
jobs:
build:
name: Build
Expand All @@ -23,7 +23,7 @@ jobs:
flutter-version: '${{ env.flutter_version }}'
- uses: actions/setup-java@v1
with:
java-version: '12.x'
java-version: 12.x
- name: Get dependencies
run: flutter pub get
- name: Format source code
Expand All @@ -47,5 +47,7 @@ jobs:
- name: Build stage application
run: >-
flutter build apk --obfuscate
--split-debug-info=build/app/outputs/symbols --flavor stage
--split-per-abi --target lib/main-stage.dart
--split-debug-info=build/app/outputs/symbols --split-per-abi
--dart-define=ENV_APP_NAME="Hit Notes Stage"
--dart-define=ENV_FLAVOR=stage
--dart-define=ENV_FACEBOOK_APP_ID=134284937214878
22 changes: 13 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Release
tags:
- '*'
env:
flutter_version: 2.5.2
flutter_version: 2.5.3
jobs:
build:
name: Build
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
flutter-version: '${{ env.flutter_version }}'
- uses: actions/setup-java@v1
with:
java-version: '12.x'
java-version: 12.x
- name: Get dependencies
run: flutter pub get
- name: Add config files
Expand Down Expand Up @@ -70,25 +70,29 @@ jobs:
- name: Build stage application
run: >-
flutter build apk --obfuscate
--split-debug-info=build/app/outputs/symbols --flavor stage --target lib/main-stage.dart
--split-debug-info=build/app/outputs/symbols
--dart-define=ENV_APP_NAME="Hit Notes Stage"
--dart-define=ENV_FLAVOR=stage
--dart-define=ENV_FACEBOOK_APP_ID=134284937214878
- name: Build production application
run: >-
flutter build apk --obfuscate
--split-debug-info=build/app/outputs/symbols --flavor prod
--split-per-abi --target lib/main-prod.dart
--split-debug-info=build/app/outputs/symbols --split-per-abi
--dart-define=ENV_APP_NAME="Hit Notes" --dart-define=ENV_FLAVOR=prod
--dart-define=ENV_FACEBOOK_APP_ID=134284937214878
- name: Upload production to Google Play internal track
run: >-
cd android; fastlane supply --track=internal
--apk_paths=../build/app/outputs/flutter-apk/app-armeabi-v7a-prod-release.apk,../build/app/outputs/flutter-apk/app-arm64-v8a-prod-release.apk,../build/app/outputs/flutter-apk/app-x86_64-prod-release.apk
--apk_paths=../build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk,../build/app/outputs/flutter-apk/app-arm64-v8a-release.apk,../build/app/outputs/flutter-apk/app-x86_64-release.apk
- name: Setup firebase
uses: pocket-apps/action-setup-firebase@v2
with:
firebase-token: '${{ secrets.FIREBASE_TOKEN }}'
- name: Distribute stage via Firebase
run: >-
firebase appdistribution:distribute
build/app/outputs/flutter-apk/app-stage-release.apk --app
"${{ secrets.STAGE_APP_ID }}" --release-notes "$(git log -1
build/app/outputs/flutter-apk/app-release.apk --app "${{
secrets.STAGE_APP_ID }}" --release-notes "$(git log -1
--pretty=short)" --groups testers
- name: Build iOS
run: flutter build ios --debug --flavor=dev --no-codesign --target lib/main-dev.dart
run: flutter build ios --debug --no-codesign
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ app.*.map.json
google-services.json
service_account.json

/ios/Flutter/Environment.xcconfig
GoogleService-Info.plist
/ios/build/

/flavor/
7 changes: 0 additions & 7 deletions .run/Debug.run.xml

This file was deleted.

7 changes: 7 additions & 0 deletions .run/DebugDev.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="DebugDev" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="additionalArgs" value="--dart-define=ENV_APP_NAME=&quot;Hit Notes Dev&quot; --dart-define=ENV_FLAVOR=dev --dart-define=ENV_FACEBOOK_APP_ID=134284937214878" />
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" />
</configuration>
</component>
7 changes: 0 additions & 7 deletions .run/Release.run.xml

This file was deleted.

54 changes: 28 additions & 26 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,38 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def dartEnvironmentVariables = [:]
if (project.hasProperty('dart-defines')) {
dartEnvironmentVariables = dartEnvironmentVariables + project.property('dart-defines')
.split(',')
.collectEntries { entry ->
def pair = new String(entry.decodeBase64(), 'UTF-8').split('=')
[(pair.first()): pair.last()]
}
}

task copyGoogleServicesJson(type: Copy) {
from "src/${dartEnvironmentVariables.ENV_FLAVOR}/google-services.json"
into './'
}

tasks.whenTaskAdded { task ->
if (task.name == 'processDebugGoogleServices') {
task.dependsOn copyGoogleServicesJson
}
if (task.name == 'processReleaseGoogleServices') {
task.dependsOn copyGoogleServicesJson
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {

// ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) -----
flavorDimensions "default"

productFlavors {
dev {
dimension "default"
applicationId "com.chaomao.hittick"
resValue "string", "app_name", "Hit Notes Dev"
}
stage {
dimension "default"
applicationId "com.chaomao.hittick"
resValue "string", "app_name", "Hit Notes Stage"
}
prod {
dimension "default"
applicationId "com.chaomao.hittick"
resValue "string", "app_name", "Hit Notes"
}
}

// ----- END flavorDimensions (autogenerated by flutter_flavorizr) -----

compileSdkVersion = 30
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -64,9 +64,11 @@ android {
}

defaultConfig {
resValue "string", "app_name", dartEnvironmentVariables.ENV_APP_NAME ? dartEnvironmentVariables.ENV_APP_NAME : "hittick"
resValue "string", "facebook_app_id", dartEnvironmentVariables.ENV_FACEBOOK_APP_ID ? dartEnvironmentVariables.ENV_FACEBOOK_APP_ID : ""
applicationId "com.chaomao.hittick"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
multiDexEnabled true
versionCode 32
versionName "1.2.9"
Expand Down
13 changes: 7 additions & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:screenOrientation="landscape"
Expand Down Expand Up @@ -41,16 +42,16 @@
</activity>

<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="flutterEmbedding"
android:value="2"/>
android:name="flutterEmbedding"
android:value="2" />
</application>
<queries>
<intent>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>
</manifest>
4 changes: 0 additions & 4 deletions android/app/src/main/res/values/strings.xml

This file was deleted.

4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.5.30'
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
Expand Down
1 change: 1 addition & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
Expand Down
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include "Environment.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
#include "Environment.xcconfig"
6 changes: 0 additions & 6 deletions ios/Flutter/devDebug.xcconfig

This file was deleted.

6 changes: 0 additions & 6 deletions ios/Flutter/devRelease.xcconfig

This file was deleted.

6 changes: 0 additions & 6 deletions ios/Flutter/prodDebug.xcconfig

This file was deleted.

6 changes: 0 additions & 6 deletions ios/Flutter/prodRelease.xcconfig

This file was deleted.

6 changes: 0 additions & 6 deletions ios/Flutter/stageDebug.xcconfig

This file was deleted.

6 changes: 0 additions & 6 deletions ios/Flutter/stageRelease.xcconfig

This file was deleted.

3 changes: 0 additions & 3 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ post_install do |installer|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"

# https://github.com/flutter/flutter/issues/57839
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,6 @@ SPEC CHECKSUMS:
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649

PODFILE CHECKSUM: 2b69b992653b5b0372b3ed3993c7a9eb102a4095
PODFILE CHECKSUM: 52850884bc4fe89b720ca304751837c651c6cba9

COCOAPODS: 1.11.2
Loading

0 comments on commit a52eabe

Please sign in to comment.