Skip to content

Commit

Permalink
Bump Flutter, Gradle dependencies to latest stable versions (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia authored Mar 21, 2024
2 parents a4d214a + 61fbebe commit 45fbe04
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 109 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
env:
PROPERTIES_PATH: "android/key.properties"
JAVA_VERSION: "17.x"
FLUTTER_VERSION: "3.13.7"
APP_VERSION_PATH: "app_version.txt"
PUBSPEC_PATH: "pubspec.yaml"
defaults:
Expand Down Expand Up @@ -106,9 +105,19 @@ jobs:
with:
java-version: ${{env.JAVA_VERSION}}
distribution: "zulu"
- uses: subosito/flutter-action@v2

- uses: mikefarah/yq@master
name: Get Flutter version
id: get_flutter_version
with:
cmd: yq '.environment.flutter' uni/pubspec.yaml

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
flutter-version: ${{ steps.get_flutter_version.outputs.result }}
cache: true

- name: Download Android keystore
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > /tmp/key.jks
Expand Down Expand Up @@ -174,4 +183,4 @@ jobs:
if: github.ref == 'refs/heads/master'
run: |
echo '${{ secrets.NIAEFEUPBOT_PAT }}' | gh auth login --with-token
gh workflow run 'Deploy Action' --ref develop
gh workflow run 'Deploy Action' --ref develop
63 changes: 44 additions & 19 deletions .github/workflows/format_lint_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,67 @@ on:
branches: [master, develop]

env:
FLUTTER_VERSION: 3.13.7
JAVA_VERSION: 17.x

jobs:
format:
name: "Format"
name: Format
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./uni
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- name: Clone repository
uses: actions/checkout@v4

- uses: mikefarah/yq@master
name: Get Flutter version
id: get_flutter_version
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cmd: yq '.environment.flutter' uni/pubspec.yaml

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ steps.get_flutter_version.outputs.result }}
cache: true

- run: dart format $(find . -type f -name "*.dart" -a -not -name "*.g.dart" -a -not -name "*.mocks.dart") --set-exit-if-changed

lint:
name: "Lint"
name: Lint
runs-on: ubuntu-latest
needs: format
defaults:
run:
working-directory: ./uni
steps:
- uses: actions/checkout@v4
- name: Clone repository
uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: "zulu"
- uses: subosito/flutter-action@v2
distribution: zulu

- uses: mikefarah/yq@master
name: Get Flutter version
id: get_flutter_version
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cmd: yq '.environment.flutter' uni/pubspec.yaml

- name: Cache pub dependencies
uses: actions/cache@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
path: ${{ env.FLUTTER_HOME }}/.pub-cache
key: ${{ runner.os }}-pub-${{ github.ref }}-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-${{ github.ref }}-
channel: stable
flutter-version: ${{ steps.get_flutter_version.outputs.result }}
cache: true

- run: flutter analyze .

test:
name: "Test"
name: Test
runs-on: ubuntu-latest
needs: lint
defaults:
Expand All @@ -60,10 +75,20 @@ jobs:
- uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: "zulu"
- uses: subosito/flutter-action@v2
distribution: zulu

- uses: mikefarah/yq@master
name: Get Flutter version
id: get_flutter_version
with:
cmd: yq '.environment.flutter' uni/pubspec.yaml

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
flutter-version: ${{ steps.get_flutter_version.outputs.result }}
cache: true

- name: Test with coverage
run: flutter test --coverage
Expand Down
62 changes: 32 additions & 30 deletions uni/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,71 +1,69 @@
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
id "org.jetbrains.kotlin.android"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.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 flutterVersionCode = localProperties.getProperty('flutter.versionCode')
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = '1'
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = '1.0'
flutterVersionName = "1.0"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
if (project.android.hasProperty("namespace")) {
namespace "pt.up.fe.ni.uni"
}
namespace "pt.up.fe.ni.uni"

compileSdkVersion 34 // default is flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

// This is required by flutter_local_notifications. See its README.
coreLibraryDesugaringEnabled true
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = "1.8"
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.java.srcDirs += "src/main/kotlin"
}

defaultConfig {
applicationId "pt.up.fe.ni.uni"
minSdkVersion 21 // default is flutter.minSdkVersion
targetSdkVersion 34 // default is flutter.targetSdkVersion
minSdkVersion 21
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

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"]
}
}

Expand All @@ -77,9 +75,13 @@ android {
}

flutter {
source '../..'
source "../.."
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// The following 3 lines are a workaround for the Flutter issue.
// Learn more: https://github.com/flutter/flutter/issues/110658
implementation "androidx.window:window:1.0.0"
implementation "androidx.window:window-java:1.0.0"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.2"
}
3 changes: 1 addition & 2 deletions uni/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pt.up.fe.ni.uni">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
3 changes: 1 addition & 2 deletions uni/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pt.up.fe.ni.uni">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="uni"
android:name="${applicationName}"
Expand Down
3 changes: 1 addition & 2 deletions uni/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pt.up.fe.ni.uni">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
19 changes: 2 additions & 17 deletions uni/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
buildscript {
ext.kotlin_version = '1.9.0'
ext.android_plugin_version = '8.0.0'

repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:$android_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

rootProject.buildDir = '../build'
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
Expand Down
2 changes: 1 addition & 1 deletion uni/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
30 changes: 22 additions & 8 deletions uni/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader"
id "com.android.application" version "8.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
}

include ":app"
8 changes: 5 additions & 3 deletions uni/lib/view/bug_report/widgets/form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ class BugReportFormState extends State<BugReportForm> {
/// report is created in the project repository.
/// If unsuccessful, the user receives an error message.
Future<void> submitBugReport() async {
final s = S.of(context);

setState(() {
_isButtonTapped = true;
});
Expand All @@ -256,18 +258,18 @@ class BugReportFormState extends State<BugReportForm> {
try {
await submitSentryEvent(bugReport);
Logger().i('Successfully submitted bug report.');
if (context.mounted) toastMsg = S.of(context).success;
if (context.mounted) toastMsg = s.success;
status = true;
} catch (e, stackTrace) {
await Sentry.captureException(e, stackTrace: stackTrace);
Logger().e('Error while posting bug report:$e');
if (context.mounted) toastMsg = S.of(context).sent_error;
if (context.mounted) toastMsg = s.sent_error;
status = false;
}

clearForm();

if (context.mounted) {
if (mounted) {
FocusScope.of(context).requestFocus(FocusNode());
status
? await ToastMessage.success(context, toastMsg)
Expand Down
Loading

0 comments on commit 45fbe04

Please sign in to comment.