Skip to content

Commit

Permalink
Merge pull request #1500 from spydon/monorepo-structure
Browse files Browse the repository at this point in the history
refactor: Move to monorepo file structure
  • Loading branch information
d-loose authored Nov 20, 2023
2 parents 4d55b14 + 9295df3 commit 80a5ea5
Show file tree
Hide file tree
Showing 143 changed files with 110 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "pub"
directory: "/"
directory: "/packages/app_center"
schedule:
interval: "daily"
20 changes: 5 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,23 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- run: flutter pub global activate melos
- run: melos pub get
- uses: bluefireteam/melos-action@v2
- run: melos analyze

format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- run: flutter pub global activate melos
- run: melos pub get
- uses: bluefireteam/melos-action@v2
- run: melos format

mocks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- run: flutter pub global activate melos
- run: melos pub get
- uses: bluefireteam/melos-action@v2
- run: melos generate
- name: Check for outdated mocks
if: github.event_name != 'push'
Expand All @@ -55,9 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- run: flutter pub global activate melos
- run: melos pub get
- uses: bluefireteam/melos-action@v2
- run: melos gen-l10n
- name: Check for outdated l10n
if: github.event_name == 'pull_request'
Expand All @@ -77,10 +69,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- uses: bluefireteam/melos-action@v2
- run: sudo apt update && sudo apt install -y lcov
- run: flutter pub global activate melos
- run: melos pub get
- run: melos coverage
- uses: codecov/codecov-action@v3
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ jobs:
- uses: asdf-vm/actions/install@v2
- run: sudo apt update
- run: sudo apt install -y clang cmake libblkid-dev libglib2.0-dev libgtk-3-dev liblzma-dev network-manager ninja-build packagekit pkg-config polkitd xvfb
- run: sudo cp integration_test/assets/snapd-ci.pkla /var/lib/polkit-1/localauthority/50-local.d/
- run: LANG=en_US.UTF-8 xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' flutter test integration_test
- run: |
cd packages/app_center && \
sudo cp integration_test/assets/snapd-ci.pkla /var/lib/polkit-1/localauthority/50-local.d/
LANG=en_US.UTF-8 xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' \
flutter test integration_test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pubspec.lock
/coverage/
/doc/
.fvm
**/build/

# Symbolication related
app.*.symbols
Expand Down
9 changes: 0 additions & 9 deletions analysis_options.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: app_center

packages:
- .
- packages/**

ignore:
- synthetic_package

scripts:
# analyze all packages
analyze: >
Expand Down
1 change: 1 addition & 0 deletions packages/app_center/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:ubuntu_lints/analysis_options.yaml
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:packagekit/packagekit.dart';
import 'package:ubuntu_widgets/ubuntu_widgets.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:yaru_icons/yaru_icons.dart';
Expand All @@ -29,7 +30,7 @@ class DebPage extends ConsumerStatefulWidget {
}

class _DebPageState extends ConsumerState<DebPage> {
StreamSubscription? _errorSubscription;
StreamSubscription<PackageKitErrorCodeEvent>? _errorSubscription;

@override
void initState() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ManagePage extends ConsumerStatefulWidget {
}

class _ManagePageState extends ConsumerState<ManagePage> {
StreamSubscription? _errorSubscription;
StreamSubscription<SnapdException>? _errorSubscription;

@override
void initState() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class PackageKitService {
final id = _nextId++;
_transactions[id] = transaction;

late final StreamSubscription subscription;
late final StreamSubscription<PackageKitEvent> subscription;
subscription = transaction.events.listen((event) {
listener?.call(event);
if (event is PackageKitFinishedEvent || event is PackageKitDestroyEvent) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final progressProvider =

final streamController = StreamController<double>.broadcast();
final subProgresses = <String, double>{for (final id in ids) id: 0.0};
final subscriptions = <String, StreamSubscription>{
final subscriptions = <String, StreamSubscription<SnapdChange>>{
for (final id in ids)
id: snapd.watchChange(id).listen((change) {
subProgresses[id] = change.progress;
Expand Down Expand Up @@ -79,8 +79,8 @@ class SnapModel extends ChangeNotifier {

Map<String, SnapChannel>? get availableChannels => storeSnap?.channels;

StreamSubscription? _storeSnapSubscription;
StreamSubscription? _activeChangeSubscription;
StreamSubscription<Snap?>? _storeSnapSubscription;
StreamSubscription<SnapdChange>? _activeChangeSubscription;

Stream<SnapdException> get errorStream => _errorStreamController.stream;
final StreamController<SnapdException> _errorStreamController =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SnapPage extends ConsumerStatefulWidget {
}

class _SnapPageState extends ConsumerState<SnapPage> {
StreamSubscription? _errorSubscription;
StreamSubscription<SnapdException>? _errorSubscription;

@override
void initState() {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ extension SnapCacheFile on CacheFile {

Future<List<Snap>?> readSnapList() async {
final data = await read() as List?;
return data?.cast<Map>().map((s) => Snap.fromJson(s.cast())).toList();
return data
?.cast<Map<Object?, Object?>>()
.map((s) => Snap.fromJson(s.cast()))
.toList();
}

Future<void> writeSnap(Snap snap) => write(snap.toJson());
Expand All @@ -165,14 +168,14 @@ class CacheFile {
String path, {
Duration? expiry,
FileSystem? fs,
MessageCodec codec = const StandardMessageCodec(),
MessageCodec<Object?> codec = const StandardMessageCodec(),
}) : _file = (fs ?? const LocalFileSystem()).file(path),
_expiry = expiry ?? Duration.zero,
_codec = codec;

final File _file;
final Duration _expiry;
final MessageCodec _codec;
final MessageCodec<Object?> _codec;

String get path => _file.path;

Expand Down Expand Up @@ -218,7 +221,7 @@ class CacheFile {
}

extension CacheObject on Object {
Uint8List encodeCache(MessageCodec codec) {
Uint8List encodeCache(MessageCodec<Object?> codec) {
final data = codec.encodeMessage(_toMessage())!;
return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
}
Expand All @@ -233,7 +236,7 @@ extension CacheObject on Object {
}

extension CacheUint8List on Uint8List {
Object? decodeCache(MessageCodec codec) {
Object? decodeCache(MessageCodec<Object?> codec) {
return codec.decodeMessage(ByteData.sublistView(this));
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class StoreObserver extends NavigatorObserver {
final WidgetRef ref;

@override
void didPop(Route route, Route? previousRoute) {
void didPop(Route<void> route, Route<void>? previousRoute) {
final query = previousRoute != null
? StoreRoutes.queryOf(previousRoute.settings)
: null;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppTitle extends StatelessWidget {
this.large = false,
});

factory AppTitle.fromSnap(Snap snap, {large = false}) => AppTitle(
factory AppTitle.fromSnap(Snap snap, {bool large = false}) => AppTitle(
title: snap.titleOrName,
publisher: snap.publisher?.displayName,
verifiedPublisher: snap.verifiedPublisher,
Expand All @@ -28,7 +28,10 @@ class AppTitle extends StatelessWidget {
large: large,
);

factory AppTitle.fromDeb(AppstreamComponent component, {large = false}) =>
factory AppTitle.fromDeb(
AppstreamComponent component, {
bool large = false,
}) =>
AppTitle(
title: component.getLocalizedName(),
publisher: component.getLocalizedDeveloperName(),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions packages/app_center/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: app_center
description: App Center
version: 1.0.0
publish_to: 'none'

environment:
sdk: '>=3.1.0 <4.0.0'
flutter: 3.13.9

dependencies:
appstream: ^0.2.8
args: ^2.4.2
cached_network_image: ^3.3.0
collection: ^1.17.2
dbus: ^0.7.10
app_center_ratings_client:
git:
url: https://github.com/matthew-hagemann/app_center_ratings_client.dart.git
ref: main
crypto: ^3.0.3
file: ^6.1.4
flutter:
sdk: flutter
flutter_cache_manager: ^3.3.1
flutter_html: ^3.0.0-beta.2
flutter_localizations:
sdk: flutter
flutter_markdown: ^0.6.18
flutter_riverpod: ^2.4.6
github: ^9.20.0
glib: ^0.0.1
gtk: ^2.1.0
handy_window: ^0.3.1
intl: ^0.18.1
jwt_decode: ^0.3.1
meta: ^1.9.1
package_info_plus: ^4.2.0
packagekit: ^0.2.6
path: ^1.8.3
shimmer: ^3.0.0
snapcraft_launcher: ^0.1.0
snapd: ^0.4.11
snowball_stemmer: ^0.1.0
ubuntu_localizations: ^0.3.4
ubuntu_logger: ^0.1.0
ubuntu_service: ^0.3.0
ubuntu_test: ^0.1.0-0
ubuntu_widgets: ^0.3.0
url_launcher: ^6.2.1
xdg_directories: ^1.0.3
yaru: ^1.2.0
yaru_icons: ^2.2.2
yaru_widgets: ^3.3.0
yaru_test: ^0.1.5
clock: ^1.1.1

dev_dependencies:
build_runner: ^2.4.6
fake_async: ^1.3.1
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
mockito: 5.4.3
ubuntu_lints: ^0.1.0

flutter:
uses-material-design: true
generate: true
assets:
- assets/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ MockPackageKitTransaction createMockPackageKitTransaction({
Iterable<PackageKitEvent>? events,
PackageKitExit? exit,
int? runtime,
Future? start,
Future? end,
Future<void>? start,
Future<void>? end,
}) {
final transaction = MockPackageKitTransaction();
final controller = StreamController<PackageKitEvent>.broadcast();
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 80a5ea5

Please sign in to comment.