-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Changed drift web database to the wasm version. - Removed `x86` from the Android ABI list since flutter cannot release build to this target. - Created build scripts
- Loading branch information
1 parent
a21521b
commit 6160012
Showing
14 changed files
with
215 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
import 'package:drift/web.dart'; | ||
import 'package:drift/drift.dart'; | ||
import 'package:drift/wasm.dart'; | ||
|
||
import '../database.dart'; | ||
|
||
LighthouseDatabase constructDb({final bool logStatements = false}) { | ||
return LighthouseDatabase( | ||
WebDatabase('LighthouseDatabase', logStatements: logStatements)); | ||
final connection = DatabaseConnection.delayed(Future(() async { | ||
final result = await WasmDatabase.open( | ||
databaseName: 'LighthouseDatabase', | ||
sqlite3Uri: Uri.parse('sqlite3.wasm'), | ||
driftWorkerUri: Uri.parse('drift_worker.js'), | ||
); | ||
|
||
if (result.missingFeatures.isNotEmpty) { | ||
// Depending how central local persistence is to your app, you may want | ||
// to show a warning to the user if only unreliable implementations | ||
// are available. | ||
databaseLogger | ||
.info('Using ${result.chosenImplementation} due to missing browser ' | ||
'features: ${result.missingFeatures}'); | ||
} | ||
|
||
return result.resolvedExecutor; | ||
})); | ||
|
||
return LighthouseDatabase(connection); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
|
||
cd "$SCRIPT_DIR/../" || exit | ||
|
||
patch -p1 -d "${SCRIPT_DIR}/../" <"${SCRIPT_DIR}/split-per-abi-build.gradle.patch" | ||
|
||
flutter build apk --release --no-obfuscate \ | ||
--flavor=defaultVersion \ | ||
--dart-define=includeGooglePlayInAppPurchases=false \ | ||
--dart-define=includeSupportButtons=true \ | ||
--dart-define=includeSupportPage=true \ | ||
--dart-define=includePaypal=true \ | ||
--dart-define=includeGithubSponsor=true \ | ||
--split-per-abi \ | ||
--target-platform=android-arm,android-arm64,android-x64 | ||
|
||
EXIT_CODE=$? | ||
|
||
patch -p1 -R -d "${SCRIPT_DIR}/../" <"${SCRIPT_DIR}/split-per-abi-build.gradle.patch" | ||
|
||
if [ $EXIT_CODE != 0 ]; then | ||
echo 'Could not build' | ||
exit $EXIT_CODE | ||
fi | ||
|
||
set -e | ||
|
||
mkdir -p "$SCRIPT_DIR/../output" | ||
|
||
VERSION=$(grep -oP 'version: \K\d+\.\d+\.\d+\+\d+' "${SCRIPT_DIR}/../pubspec.yaml") | ||
|
||
function copy_result() { | ||
VERSION=$1 | ||
ABI=$2 | ||
NEW_ABI=$3 | ||
ORIGINAL_PATH="${SCRIPT_DIR}/../build/app/outputs/flutter-apk/app-${ABI}-defaultversion-release.apk" | ||
NEW_PATH="${SCRIPT_DIR}/../output/lighthouse_pm-${VERSION}.${NEW_ABI}.apk" | ||
cp -vrf "$ORIGINAL_PATH" "$NEW_PATH" | ||
} | ||
|
||
copy_result "$VERSION" "armeabi-v7a" "arm" | ||
copy_result "$VERSION" "arm64-v8a" "arm64" | ||
copy_result "$VERSION" "x86_64" "X64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
|
||
cd "$SCRIPT_DIR/../" || exit | ||
|
||
flutter build appbundle --release --no-obfuscate \ | ||
--flavor=googlePlay \ | ||
--dart-define=includeGooglePlayInAppPurchases=true \ | ||
--dart-define=includeSupportButtons=true \ | ||
--dart-define=includeSupportPage=true \ | ||
--dart-define=includePaypal=false \ | ||
--dart-define=includeGithubSponsor=false \ | ||
--target-platform=android-arm,android-arm64,android-x64 | ||
|
||
EXIT_CODE=$? | ||
|
||
if [ $EXIT_CODE != 0 ]; then | ||
echo 'Could not build' | ||
exit $EXIT_CODE | ||
fi | ||
|
||
set -e | ||
|
||
mkdir -p "$SCRIPT_DIR/../output" | ||
|
||
VERSION=$(grep -oP 'version: \K\d+\.\d+\.\d+\+\d+' "${SCRIPT_DIR}/../pubspec.yaml") | ||
|
||
cp -vrf "${SCRIPT_DIR}/../build/app/outputs/bundle/googlePlayRelease/app-googlePlay-release.aab" "$SCRIPT_DIR/../output/googlePlay-${VERSION}.aab" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
|
||
cd "$SCRIPT_DIR/../" || exit | ||
|
||
flutter build web --release \ | ||
--dart-define=includeGooglePlayInAppPurchases=false \ | ||
--dart-define=includeSupportButtons=true \ | ||
--dart-define=includeSupportPage=true \ | ||
--dart-define=includePaypal=true \ | ||
--dart-define=includeGithubSponsor=true \ | ||
--base-href="/lighthouse_pm/" \ | ||
--pwa-strategy=offline-first | ||
|
||
EXIT_CODE=$? | ||
|
||
if [ $EXIT_CODE != 0 ]; then | ||
echo 'Could not build' | ||
exit $EXIT_CODE | ||
fi | ||
|
||
set -e | ||
|
||
cp -vrf "${SCRIPT_DIR}/../build/web/" "${SCRIPT_DIR}/../output/web/" | ||
|
||
perl -pi -e 's/"\/":/"\/lighthouse_pm\/":/' "${SCRIPT_DIR}/../output/web/flutter_service_worker.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- ./android/app/build.gradle 2023-12-08 11:17:36.130601770 +0100 | ||
+++ ./android/app/build_split_abi.gradle 2023-12-08 11:21:11.144304948 +0100 | ||
@@ -79,9 +79,9 @@ | ||
buildTypes { | ||
release { | ||
signingConfig signingConfigs.release | ||
- ndk { | ||
- abiFilters "armeabi-v7a", "arm64-v8a", "x86_64" | ||
- } | ||
+// ndk { | ||
+// abiFilters "armeabi-v7a", "arm64-v8a", "x86_64" | ||
+// } | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters