From 4929d063516947f6c9410a1dc3860ce29b07b53f Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 8 Jul 2024 15:46:30 -0700 Subject: [PATCH 1/3] deps: Bump GitHub action actions/checkout to v4.1.7, the latest --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f346aa0d82..c022cae950 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.7 - name: Clone Flutter SDK # We can't do a depth-1 clone, because we need the most recent tag From 37421d78b1f50d7a9f4d142d2aa8f6f2a82d09dc Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 8 Jul 2024 13:42:22 -0700 Subject: [PATCH 2/3] check: Add suite android And give it the necessary prerequisites in CI. By default the build worker supplies JDK 11, apparently, and that's too old. --- .github/workflows/ci.yml | 6 ++++++ tools/check | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c022cae950..3db05e8dfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,12 @@ jobs: steps: - uses: actions/checkout@v4.1.7 + - name: Set up JDK + uses: actions/setup-java@v4.2.1 + with: + java-version: 17 + distribution: temurin + - name: Clone Flutter SDK # We can't do a depth-1 clone, because we need the most recent tag # so that Flutter knows its version and sees the constraint in our diff --git a/tools/check b/tools/check index 49df5cdc0a..3acb65a725 100755 --- a/tools/check +++ b/tools/check @@ -24,7 +24,12 @@ this_dir=${BASH_SOURCE[0]%/*} ## CLI PARSING -default_suites=(analyze test build_runner drift pigeon icons) +default_suites=( + analyze test + build_runner drift pigeon icons + android # This takes multiple minutes in CI, so do it last. +) + extra_suites=( shellcheck # Requires its own dependency, from outside the pub system. ) @@ -77,7 +82,7 @@ while (( $# )); do --all) opt_files=all; opt_all=1; shift;; --fix) opt_fix=1; shift;; --verbose) opt_verbose=1; shift;; - analyze|test|build_runner|drift|pigeon|icons|shellcheck) + analyze|test|build_runner|drift|pigeon|icons|android|shellcheck) opt_suites+=("$1"); shift;; *) usage;; esac @@ -351,6 +356,18 @@ run_icons() { check_no_changes "icon updates" "${outputs[@]}" } +run_android() { + # Omitted from this check: + # pubspec.{yaml,lock} tools/check + files_check android/ \ + || return 0 + + flutter build apk \ + || return + + flutter build appbundle +} + run_shellcheck() { # Omitted from this check: nothing (nothing known, anyway). files_check tools/ '!*.'{dart,js,json} \ @@ -424,6 +441,7 @@ for suite in "${opt_suites[@]}"; do drift) run_drift ;; pigeon) run_pigeon ;; icons) run_icons ;; + android) run_android ;; shellcheck) run_shellcheck ;; *) echo >&2 "Internal error: unknown suite $suite" ;; esac || failed+=( "$suite" ) From b2def8e3bfa450c8d3a71e866b1c335f1bf3d861 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 8 Jul 2024 15:05:22 -0700 Subject: [PATCH 3/3] android build: Treat Kotlin warnings as errors, in release builds In particular this applies to the new `tools/check android`. A StackOverflow question that had a couple of helpful answers: https://stackoverflow.com/questions/34562200/how-do-i-make-the-kotlin-compiler-treat-warnings-as-errors --- android/app/build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4a8b1eb783..529221630b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,6 +74,16 @@ android { } } +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + // Compile Kotlin with `-Werror`... but only in release builds, so that it + // doesn't get in the way of quick local experiments for debugging. + // + // The string-searching makes this a bit of a mess, but it works. + // Better would be if we can add this to android.buildTypes.release above; + // but on a first attempt that didn't work (it affected debug builds too). + kotlinOptions.allWarningsAsErrors = name.contains("Release") +} + flutter { source '../..' }