Skip to content

Commit

Permalink
PAINTROID-662: Restructure folders, split code into separate packages (
Browse files Browse the repository at this point in the history
…#36)

* Restructure project using packages

* Update readme

According to makefile

* Update readme pt.2

* Remove assets from component library

* Move tests

They don't run for now

* Make tests pass

* Update makefile

* Move images and svgs to component_library

* Fix flutter localization warnings

* Delete .fvm/flutter_sdk

* Update gitignore to remove symlink

* Remove freezed in makefile

* Update readme, remove generate_files.sh

* Remove unecessary folders & update makefile

* Update gitignore, push generated files

* Reduce dependencies

* Update makefile

* Create seperate l10n package

* Fixup external package dependencies

* Update readme

* Add melos, simplify makefile & update README

* Fix make get

* Update readme

* Rename to IconSvg

* Update make test to test in root too

* Move landing_page_test to landing_page package

* Move imgs & svgs to components

* Delete makefile to resolve makefile mess

* Update Makefile to resolve makefile mess

* Fix Makefile indentation

* Update readme

* Fix make lint by solving all warnings

* Fix make build failing due to multithreaded builds

* Update reamde with sdkPath instructions

* Add runPubGetInParallel to melos.yaml

* Fix runPubGetInParallel

* Seperate tests by unit and widget: update makefile, readme & melos.yaml accordingly

* Fix github actions

* Fix sdkPath for testing

* Add automatic sdkPath setting and Makefile flutter variable setting

* Fix proper fvm dart path due to melos activate

* Update readme accordingly

* Update github analyze action

* Remove unused files

* Remove gitignores in packages

* Remove comments & sized box, improve formating & file naming
  • Loading branch information
msesko authored Jan 22, 2024
1 parent ebf601d commit d18319e
Show file tree
Hide file tree
Showing 273 changed files with 9,112 additions and 787 deletions.
4 changes: 4 additions & 0 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.10.5",
"flavors": {}
}
23 changes: 9 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build, Test and Analyze

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
main:
Expand All @@ -13,24 +13,20 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: subosito/[email protected]
with:
flutter-version: '3.10.5'
channel: 'stable'
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
flutter-version: "3.10.5"
channel: "stable"
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
architecture: x64 # optional, x64 or arm64
- name: Setup
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
dart pub global activate protoc_plugin
chmod +x generate_protos.sh
./generate_protos.sh
make get
- name: Static Analysis
run: flutter analyze
run: make lint
- name: Unit Tests
run: flutter test test/unit
run: melos run test:unit
- name: Widget Tests
run: flutter test test/widget
run: melos run test:widget
- name: Build release package
run: flutter build apk --release
- name: Archive build artifacts
Expand All @@ -39,4 +35,3 @@ jobs:
name: apk
path: |
build/app/outputs/flutter-apk/app-release.apk
22 changes: 18 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ migrate_working_dir/
.pub/
/build/
coverage
*.mocks.dart
*.pb*.dart
*.g.dart
*.freezed.dart

# Commented out to push generated code:
# *.mocks.dart
# *.pb*.dart
# *.g.dart
# *.freezed.dart

# Web related
lib/generated_plugin_registrant.dart
Expand All @@ -48,3 +50,15 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

.fvm/flutter_sdk

# Melos
pubspec_overrides.yaml

# Packages
packages/*/pubspec.lock
packages/*/build

packages/features/*/pubspec.lock
packages/features/*/build
60 changes: 43 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,56 @@
.PHONY: pubget build watch clean test analyze test-unit test-widget test-all all
.PHONY: run pods-clean get clean build languages lint format test watch

clean:
flutter clean
FLUTTER := fvm flutter
DART := fvm dart

run:
$(FLUTTER) run

pods-clean:
rm -Rf ios/Pods ; \
rm -Rf ios/.symlinks ; \
rm -Rf ios/Flutter/Flutter.framework ; \
rm -Rf ios/Flutter/Flutter.podspec ; \
rm ios/Podfile ; \
rm ios/Podfile.lock ; \

get:
chmod +x ./setup_sdk.sh
./setup_sdk.sh
chmod +x ./setup_melos.sh
./setup_melos.sh
melos bootstrap

pubget:
flutter pub get
clean:
melos clean

build:
dart run build_runner build --delete-conflicting-outputs
melos run build:all

run:
flutter run
languages:
@cd packages/l10n ; \
$(FLUTTER) gen-l10n
@echo "-> Generated l10n"

all: clean pubget build run
lint:
$(FLUTTER) analyze
melos run lint:all

watch:
dart run build_runner watch --delete-conflicting-outputs
format:
$(DART) format --set-exit-if-changed .

analyze:
flutter analyze
test:
melos run test:all

test-unit:
flutter test test/unit
melos run test:unit

test-widget:
flutter test test/widget
melos run test:widget

watch:
$(DART) run build_runner watch --delete-conflicting-outputs

test-all:
flutter test
melos:
$(DART) pub global activate melos

108 changes: 58 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,80 @@
Paintroid
=========
# Paintroid

Paintroid, also known as **Pocket Paint**, is associated
to [Catroid](https://github.com/Catrobat/Catroid). It is a graphical paint editor application for
the Android platform that, among others, allows setting parts of pictures to transparent.
Paintroid, also known as **Pocket Paint**, is associated to [Catroid](https://github.com/Catrobat/Catroid). It is a graphical paint editor application for the Android platform that, among others, allows setting parts of pictures to transparent.

Since Pocket Paint is now available in **Google Play store** you can also download Paintroid (Pocket
Paint) from [here](https://play.google.com/store/apps/details?id=org.catrobat.paintroid).
Alternatively, you can find it on **
F-Droid** [here](https://f-droid.org/packages/org.catrobat.paintroid/).
Since Pocket Paint is now available in **Google Play store** you can also download Paintroid (Pocket Paint) from [here](https://play.google.com/store/apps/details?id=org.catrobat.paintroid). Alternatively, you can find it on **F-Droid** [here](https://f-droid.org/packages/org.catrobat.paintroid/).

For more information oriented towards developers please visit
our [developers page](http://developer.catrobat.org/).
For more information oriented towards developers please visit our [developers page](http://developer.catrobat.org/).

> **Note** This repository is the Flutter version of [Paintroid](https://github.com/Catrobat/Paintroid)
## Getting Started

1. Install [Flutter](https://docs.flutter.dev/get-started/install)
- check the currently used version in file ".github/workflows/main.yml"
2. Set up the [Protocol Buffer](https://grpc.io/docs/languages/dart/quickstart/) compiler
- `protoc` for Dart
4. Get dependencies - `flutter pub get`
5. Build supporting files - `./generate_files.sh`
6. Build protobuf files - `./generate_protos.sh`
7. Run app - `flutter run lib/main.dart`
1. Install [Flutter](https://docs.flutter.dev/get-started/install):
- Currently used version specified in _.github/workflows/main.yml_
- **Recommended**: Use [fvm](https://fvm.app/) for managing Flutter versions
2. Get dependencies: `make get`
3. Run app: `make run`

> In case `make` does not work for you, `melos` can be used for most of the commands. Check them out in _Makefile_ or in _melos.yaml_.
What `make get` does:

- Runs `./setup-sdk.sh`, if _fvm_ is not installed:
- changes "FLUTTER" (= `fvm flutter`) to `flutter` in _Makefile_
- changes "DART" (= `fvm dart`) to `dart` in _Makefile_ if _fvm_
- changes "sdkPath" (= `.fvm/flutter_sdk`) to `auto` in _melos.yaml_
- Runs `./setup-melos.sh`: activates _melos_ if not activated.

## Building generated files

- For **protoc**:
- Set up the [Protocol Buffer](https://grpc.io/docs/languages/dart/quickstart/) compiler
- Run `./generate_protos.sh`
- For **build-runner**: run `make build`
- For **localizations**: run `make languages`

## Tests

1. For unit tests, run `flutter test` at the project root
2. For integration tests -
- Make sure you have an iOS/Android device online by running `flutter devices`
- Run `flutter test integration_test -d <DEVICE-ID>`
> **Note** Replace `<Device-ID>` with the ID of the device from previous command
- Run tests for **all** packages:
- all: `make test`
- unit: `make test-unit`
- widget: `make test-widget`
- Run tests for a **specific** package:
- all: `melos test`
- unit: `melos test-unit`
- widget: `melos test-widget`

**For integration tests:**

1. Make sure you have an iOS/Android device online by running `flutter devices`
2. `cd` into the package where the test is located
3. Run `flutter test <path-to-integartion-test> -d <DEVICE-ID>`
- Replace `<Device-ID>` with the ID of the device from `flutter devices`
- Replace `<path-to-integartion-test>` with the actual path to the test (_test/..._)

# Issues #
## Issues

**Please report all bugs on
our [Jira Bugtracker](https://jira.catrob.at/secure/CreateIssue.jspa?pid=10401&issuetype=1)**
**Please report all bugs on our [Jira Bugtracker](https://jira.catrob.at/secure/CreateIssue.jspa?pid=10401&issuetype=1)**

# Contributing #
## Contributing

If you want to contribute we suggest that you start
with [forking](https://help.github.com/articles/fork-a-repo/) our repository and browse the code.
Then you can look at our [Issue-Tracker](https://jira.catrob.at/secure/RapidBoard.jspa?rapidView=60)
and start with fixing one ticket. We strictly
use [Test-Driven Development](http://c2.com/cgi/wiki?TestDrivenDevelopment)
and [Clean Code](http://www.planetgeek.ch/wp-content/uploads/2013/06/Clean-Code-V2.2.pdf), so first
read everything you can about these development methods. Code developed in a different style will
not be accepted. After you've created a pull request we will review your code and do a full testrun
on your branch.
If you want to contribute we suggest that you start with [forking](https://help.github.com/articles/fork-a-repo/) our repository and browse the code. Then you can look at our [Issue-Tracker](https://jira.catrob.at/secure/RapidBoard.jspa?rapidView=60) and start with fixing one ticket. We strictly use [Test-Driven Development](http://c2.com/cgi/wiki?TestDrivenDevelopment) and [Clean Code](http://www.planetgeek.ch/wp-content/uploads/2013/06/Clean-Code-V2.2.pdf), so first read everything you can about these development methods. Code developed in a different style will not be accepted. After you've created a pull request we will review your code and do a full testrun on your branch.

If you want to implement a new feature, please ask about the details in JIRA or our IRC channel (
#catrobat or #catrobatdev) first.
If you want to implement a new feature, please ask about the details in JIRA or our IRC channel (#catrobat or #catrobatdev) first.

Let's start to set up the working environment using the instructions in
our [Wiki](https://github.com/Catrobat/Catroid/wiki/Setup-working-environment)!
Let's start to set up the working environment using the instructions in our [Wiki](https://github.com/Catrobat/Catroid/wiki/Setup-working-environment)!

# Resources and links #
## Resources and links

* [Google Play Store Download](https://play.google.com/store/apps/details?id=org.catrobat.paintroid)
* [F-Droid Download](https://f-droid.org/packages/org.catrobat.paintroid/)
* [Frequently Asked Questions](https://github.com/Catrobat/Catroid/wiki/Frequently-Asked-Questions)
* [Credits](http://developer.catrobat.org/credits)
* [Statistics on OpenHub](https://www.openhub.net/p/catrobat/)
* [Twitter](http://twitter.com/Catroid)
* [Our Google group](https://groups.google.com/forum/?fromgroups#!forum/catrobat)
- [Google Play Store Download](https://play.google.com/store/apps/details?id=org.catrobat.paintroid)
- [F-Droid Download](https://f-droid.org/packages/org.catrobat.paintroid/)
- [Frequently Asked Questions](https://github.com/Catrobat/Catroid/wiki/Frequently-Asked-Questions)
- [Credits](http://developer.catrobat.org/credits)
- [Statistics on OpenHub](https://www.openhub.net/p/catrobat/)
- [Twitter](http://twitter.com/Catroid)
- [Our Google group](https://groups.google.com/forum/?fromgroups#!forum/catrobat)

# License #
## License

[License](http://developer.catrobat.org/licenses) of our project (mainly AGPL v3).
5 changes: 2 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linter:
constant_identifier_names: false

analyzer:

errors:
missing_enum_constant_in_switch: error
exhaustive_cases: error
Expand All @@ -20,5 +19,5 @@ analyzer:
unused_import: error

exclude:
- lib/**.pb*.dart
- lib/data/*.g.dart
- lib/src/**.pb*.dart
- lib/src/data/*.g.dart
1 change: 0 additions & 1 deletion generate_files.sh

This file was deleted.

4 changes: 2 additions & 2 deletions generate_protos.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd lib/io/src/serialization/proto || exit
cd packages/io_library/lib/src/serialization/proto || exit
mkdir -p output
protoc --dart_out=output --proto_path=schema $(find schema -iname "*.proto") google/protobuf/any.proto
protoc --dart_out=output --proto_path=schema $(find schema -iname "*.proto") google/protobuf/any.proto
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Loading

0 comments on commit d18319e

Please sign in to comment.