From e44735c00da75f921d63f23fefd99a25cd5b0bde Mon Sep 17 00:00:00 2001 From: Maximilian Betz <Maximilian.Betz@awi.de> Date: Fri, 1 Apr 2022 16:17:49 +0200 Subject: [PATCH] include .git folder for gradle to access git commit hash info --- android/settings.gradle | 4 ++++ lib/datamodel.dart | 3 +-- pubspec.lock | 14 +++++++------- pubspec.yaml | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bc..6ae885c 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -9,3 +9,7 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 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" + +import org.apache.tools.ant.DirectoryScanner +DirectoryScanner.removeDefaultExclude('**/.git') +DirectoryScanner.removeDefaultExclude('**/.git/**') \ No newline at end of file diff --git a/lib/datamodel.dart b/lib/datamodel.dart index 29893e0..798da3b 100644 --- a/lib/datamodel.dart +++ b/lib/datamodel.dart @@ -511,8 +511,7 @@ class EventStoreInstance extends EventStoreBase { String gitVersionHash = ''; Future<void> loadGitInfo() async { - //final commitHash = await rootBundle.loadString('.git/refs/heads/main'); - final commitHash = await rootBundle.loadString('.git/refs/remotes/origin/main'); + final commitHash = await rootBundle.loadString('.git/refs/heads/main'); gitVersionHash = commitHash.substring(0,8); //Use the short version debugPrint("Commit ID: $gitVersionHash"); diff --git a/pubspec.lock b/pubspec.lock index 63af8e5..44adf8a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -117,7 +117,7 @@ packages: name: flutter_login url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.2.0" flutter_secure_storage: dependency: "direct main" description: @@ -190,28 +190,28 @@ packages: name: geolocator url: "https://pub.dartlang.org" source: hosted - version: "8.1.1" + version: "8.2.0" geolocator_android: dependency: transitive description: name: geolocator_android url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.1.4" geolocator_apple: dependency: transitive description: name: geolocator_apple url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.1.1+1" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.0.2" + version: "4.0.4" geolocator_web: dependency: transitive description: @@ -393,7 +393,7 @@ packages: name: shared_preferences_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.1.0" shared_preferences_linux: dependency: transitive description: @@ -573,7 +573,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.11" + version: "2.5.1" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8ea662b..8d0dbca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,8 +69,8 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/awi_logo.png - - .git/HEAD # This file points out the current branch of the project. - - .git/ORIG_HEAD # This file points to the commit id at origin (last commit id of the remote repository). + #- .git/HEAD # This file points out the current branch of the project. + #- .git/ORIG_HEAD # This file points to the commit id at origin (last commit id of the remote repository). - .git/refs/heads/main -- GitLab