diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 000000000..cf7449069 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "3.22.3" +} \ No newline at end of file diff --git a/.github/scripts/check-outdated-files.sh b/.github/scripts/check-outdated-files.sh deleted file mode 100755 index a6e2934a1..000000000 --- a/.github/scripts/check-outdated-files.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -if [ -n "$(git status --porcelain)" ]; then - git diff -- ':!**/pubspec.lock' - outdated=$(git ls-files --modified -- ':!**/pubspec.lock') - for f in $outdated; do - echo "::warning ::$f may be outdated" - done - untracked=$(git ls-files --others --exclude-standard) - for f in $untracked; do - echo "::warning ::$f may be untracked" - done - if [ -n "$outdated" ] || [ -n "$untracked" ]; then - exit 1 - fi -fi diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 809f52a66..44dff78b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v2 - run: melos analyze --fatal-infos @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v2 - run: melos format:exclude @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v3 - run: melos generate - name: Check for outdated mocks @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v2 - run: melos gen-l10n - name: Check for outdated l10n @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v2 - run: sudo apt update && sudo apt install -y lcov - run: melos coverage diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index 93eb3e029..2f559d583 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 + - uses: Atsumi3/actions-setup-fvm@0.0.3 - uses: bluefireteam/melos-action@v3 - run: sudo apt update - run: sudo apt install -y clang cmake debhelper libblkid-dev libglib2.0-dev libgtk-3-dev liblzma-dev network-manager ninja-build packagekit pkg-config polkitd xvfb diff --git a/.gitignore b/.gitignore index 538241a81..8f125c67a 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,6 @@ pubspec.lock /build/ coverage/ /doc/ -.fvm **/build/ # Symbolication related @@ -50,3 +49,6 @@ app.*.map.json # Melos generated files **/pubspec_overrides.yaml + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index ad48629da..000000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -flutter 3.19.6-stable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd8adb36e..fc7bce254 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,12 +70,17 @@ Translations are managed using [Weblate](https://hosted.weblate.org/projects/ubu ### Required dependencies -[Install Flutter](https://flutter.dev/docs/get-started/install/linux) - the currently used version is specified in `.tool-versions`. If you're using [asdf](https://asdf-vm.com/) to manage your Flutter SDK, you can simply run `asdf install` to install the required version. +[Install Flutter](https://flutter.dev/docs/get-started/install/linux) - the currently used version is specified in `.fvmrc`. If you're using [fvm](https://fvm.app) to manage your Flutter SDK, you can simply run `fvm install` to install the required version. Install the [Flutter Linux prerequisites](https://docs.flutter.dev/get-started/install/linux#linux-prerequisites) We provide a [Melos](https://docs.page/invertase/melos) configuration to make it straightforward to execute common tasks. +Install fvm (you can also install it from the scripts directory in the repository): +``` +curl -fsSL https://fvm.app/install.sh | bash +``` + Install Melos: ``` dart pub global activate melos @@ -92,7 +97,7 @@ melos bootstrap You can run the application with ``` -flutter run +fvm flutter run ``` and build a release version with diff --git a/melos.yaml b/melos.yaml index ef1d589c5..c34b7584b 100644 --- a/melos.yaml +++ b/melos.yaml @@ -1,4 +1,5 @@ name: app_center +sdkPath: .fvm/flutter_sdk packages: - packages/** @@ -16,12 +17,12 @@ scripts: # build all packages build: > melos exec -c 1 --fail-fast --flutter --dir-exists=linux -- \ - flutter build linux + fvm flutter build linux # collect coverage information for all packages coverage: > melos exec -c 1 --fail-fast --dir-exists=test -- \ - flutter test --coverage && melos run coverage:cleanup + fvm flutter test --coverage && melos run coverage:cleanup # cleanup generated files from coverage coverage:cleanup: > @@ -43,27 +44,27 @@ scripts: ! -path '*/l10n/*.dart' \ ! -name '*.pb*.dart' \ ! -path '*/.*/*' \ - | xargs dart format --set-exit-if-changed + | xargs fvm dart format --set-exit-if-changed # run build_runner to generate code in all packages generate: > melos exec -c 1 --fail-fast --depends-on=build_runner -- \ - dart run build_runner build --delete-conflicting-outputs + fvm dart run build_runner build --delete-conflicting-outputs # run gen-l10n to generate localizations in all packages gen-l10n: > melos exec -c 1 --fail-fast --depends-on=flutter_localizations -- \ - flutter gen-l10n + fvm flutter gen-l10n # run integration tests in all packages integration_test: > melos exec -c 1 --fail-fast --dir-exists=integration_test -- \ - flutter test integration_test + fvm flutter test integration_test # runs "flutter pub " in all packages - pub: melos exec -c 1 -- flutter pub "$@" + pub: melos exec -c 1 -- fvm flutter pub "$@" # run tests in all packages test: > melos exec -c 1 --fail-fast --dir-exists=test -- \ - flutter test + fvm flutter test diff --git a/packages/app_center/.gitignore b/packages/app_center/.gitignore new file mode 100644 index 000000000..9e366fe3b --- /dev/null +++ b/packages/app_center/.gitignore @@ -0,0 +1,3 @@ + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/packages/app_center/pubspec.yaml b/packages/app_center/pubspec.yaml index f371ad6d7..407b410e7 100644 --- a/packages/app_center/pubspec.yaml +++ b/packages/app_center/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: flutter_html: ^3.0.0-beta.2 flutter_localizations: sdk: flutter - flutter_markdown: ^0.6.16 + flutter_markdown: ^0.7.3+1 flutter_riverpod: ^2.5.1 flutter_svg: ^2.0.10+1 freezed_annotation: ^2.4.1 @@ -32,10 +32,10 @@ dependencies: gtk: ^2.1.0 handy_window: ^0.4.0 http: ^1.2.1 - intl: ^0.18.1 + intl: ^0.19.0 jwt_decode: ^0.3.1 meta: ^1.11.0 - package_info_plus: ^4.2.0 + package_info_plus: ^8.0.2 packagekit: ^0.2.6 path: ^1.9.0 riverpod_annotation: ^2.3.5 @@ -43,11 +43,11 @@ dependencies: snapcraft_launcher: ^0.1.0 snapd: ^0.6.3 snowball_stemmer: ^0.1.0 - ubuntu_localizations: ^0.3.6 + ubuntu_localizations: ^0.4.0 ubuntu_logger: ^0.1.1 ubuntu_service: ^0.3.2 ubuntu_test: ^0.1.0-beta.9 - ubuntu_widgets: ^0.5.0 + ubuntu_widgets: ^0.6.0 url_launcher: ^6.2.6 xdg_directories: ^1.0.4 yaru: ^4.1.0 diff --git a/scripts/install_fvm.sh b/scripts/install_fvm.sh new file mode 100644 index 000000000..474f69571 --- /dev/null +++ b/scripts/install_fvm.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +# Function to log messages with date and time +log_message() { + echo -e "$1" +} + +# Detect OS and architecture +OS="$(uname -s)" +ARCH="$(uname -m)" + +# Map to FVM naming +case "$OS" in + Linux*) OS='linux' ;; + Darwin*) OS='macos' ;; + *) log_message "Unsupported OS"; exit 1 ;; +esac + +case "$ARCH" in + x86_64) ARCH='x64' ;; + arm64) ARCH='arm64' ;; + armv7l) ARCH='arm' ;; + *) log_message "Unsupported architecture"; exit 1 ;; +esac + +# Terminal colors setup +Color_Off='\033[0m' # Reset +Green='\033[0;32m' # Green +Red='\033[0;31m' + +success() { + log_message "${Green}$1${Color_Off}" +} + +error() { + log_message "${Red}error: $1${Color_Off}" >&2 + exit 1 +} + +# Log detected OS and architecture +log_message "Detected OS: $OS" +log_message "Detected Architecture: $ARCH" + +# Check for curl +if ! command -v curl &> /dev/null; then + error "curl is required but not installed." +fi + +# Get installed FVM version if exists +INSTALLED_FVM_VERSION="" +if command -v fvm &> /dev/null; then + INSTALLED_FVM_VERSION=$(fvm --version 2>&1) || error "Failed to fetch installed FVM version." +fi + +# Define the URL of the FVM binary +if [ -z "$1" ]; then + FVM_VERSION=$(curl -s https://api.github.com/repos/leoafarias/fvm/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + if [ -z "$FVM_VERSION" ]; then + error "Failed to fetch latest FVM version." + fi +else + FVM_VERSION="$1" +fi + +log_message "Installing FVM version $FVM_VERSION." + +# Setup installation directory and symlink +FVM_DIR="$HOME/.fvm_flutter" +FMV_DIR_BIN="$FVM_DIR/bin" +SYMLINK_TARGET="/usr/local/bin/fvm" + + +# Create FVM directory if it doesn't exist +mkdir -p "$FVM_DIR" || error "Failed to create FVM directory: $FVM_DIR." + +# Check if FVM_DIR exists, and if it does delete it +if [ -d "$FMV_DIR_BIN" ]; then + log_message "FVM bin directory already exists. Removing it." + if ! rm -rf "$FMV_DIR_BIN"; then + error "Failed to remove existing FVM directory: $FMV_DIR_BIN." + fi +fi + +# Download FVM +URL="https://github.com/leoafarias/fvm/releases/download/$FVM_VERSION/fvm-$FVM_VERSION-$OS-$ARCH.tar.gz" +if ! curl -L "$URL" -o fvm.tar.gz; then + error "Download failed. Check your internet connection and URL: $URL" +fi + + +# Extract binary to the new location +if ! tar xzf fvm.tar.gz -C "$FVM_DIR" 2>&1; then + error "Extraction failed. Check permissions and tar.gz file integrity." +fi + +# Cleanup +if ! rm -f fvm.tar.gz; then + error "Failed to cleanup" +fi + +# Rename FVM_DIR/fvm to FVM_DIR/bin +if ! mv "$FVM_DIR/fvm" "$FMV_DIR_BIN"; then + error "Failed to move fvm to bin directory." +fi + +# Create a symlink +if ! ln -sf "$FMV_DIR_BIN/fvm" "$SYMLINK_TARGET"; then + error "Failed to create symlink." +fi + +# Verify installation +if ! command -v fvm &> /dev/null; then + error "Installation verification failed. FVM may not be in PATH or failed to execute." +fi + +INSTALLED_FVM_VERSION=$(fvm --version 2>&1) || error "Failed to verify installed FVM version." +success "FVM $INSTALLED_FVM_VERSION installed successfully." diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 38314f5db..cff8252fe 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -16,13 +16,12 @@ parts: rm -rf "flutter" fi - craftctl default - FLUTTER_VERSION=$(sed -n "s/^flutter \([0-9.]\+\).*/\1/p" .tool-versions) - git clone -b $FLUTTER_VERSION --depth 1 https://github.com/flutter/flutter.git + sh scripts/install-flutter.sh + fvm install override-build: | mkdir -p $CRAFT_PART_INSTALL/usr/bin mkdir -p $CRAFT_PART_INSTALL/usr/libexec - cp -r $CRAFT_PART_SRC/flutter $CRAFT_PART_INSTALL/usr/libexec/flutter + cp -r $CRAFT_PART_SRC/.fvm/flutter_sdk $CRAFT_PART_INSTALL/usr/libexec/flutter ln -s $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/flutter $CRAFT_PART_INSTALL/usr/bin/flutter ln -s $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/dart $CRAFT_PART_INSTALL/usr/bin/dart $CRAFT_PART_INSTALL/usr/bin/flutter doctor