Skip to content

Commit

Permalink
Develop (#13)
Browse files Browse the repository at this point in the history
Release 3.0.0. with kradle interactive tool and protobuf support.
  • Loading branch information
buijs-dev authored May 12, 2024
1 parent d8b9f63 commit 64fb114
Show file tree
Hide file tree
Showing 85 changed files with 3,810 additions and 1,603 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6'
channel: 'stable'

# Get dependencies
Expand All @@ -26,7 +27,7 @@ jobs:

# Convert to LCOV
- name: Convert coverage to LCOV
run: dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage.lcov --packages=.dart_tool/package_config.json --report-on=lib
run: dart run coverage:format_coverage --lcov --in=coverage --out=coverage.lcov --packages=.dart_tool/package_config.json --report-on=lib

# Upload coverage data
- name: Upload coverage to Codecov
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/native_executable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: Install dependencies
run: dart pub get
- name: Build executable
run: dart compile exe bin/kradle.dart -o ./kradlew
run: dart compile exe bin/kradle.dart -o kradle
- uses: actions/upload-artifact@v4
with:
name: kradlew
path: ./kradlew.exe
name: kradle-${{ matrix.os }}
path: kradle
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ build/
/resimport.sh
/dartdoc.sh
/example/ridiculous_awesome/
/kradlew
/build_dist.sh
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 3.0.0
* Use klutter_ui 1.1.0.
* Use Klutter Gradle v2024.1.1.beta with support for protobuf.
* Move post-build tasks in root/platform build.gradle.kts to gradle plugin.
* Add kradle script (which replaces producer and consumer).
* Add interactive cli mode.
* Add project create and build tasks.
* Remove producer and consumer scripts.
* Refactor library to enable generating a native executable.

## 2.0.0
* Uses AGP 8.0.2 in projects.
* Removed AndroidManifest.xml references.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021 - 2023 Buijs Software
Copyright (c) 2021 - 2024 Buijs Software

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 52 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ Use this plugin if you want to:
- [Kradle](https://buijs.dev/kradle-1/) cli tool
- For a step-by-step guide (doing everything manually), see the battery app with Klutter [tutorial](https://buijs.dev/klutter-2/).

Using the IDE plugins or interactive kradle tool are the
preferred options to create projects, as opposed
to doing everything manually. You can install
the kradle tool from git or pub:

```shell
## Get from pub
dart pub global activate klutter

## Get from git
dart pub global activate --source git https://github.com/buijs-dev/klutter-dart.git

## Use it globally
dart pub global run klutter:kradle
```

A native kradle executable is added to the project workspace,
when creating a new project using an IDE plugin.

See the kradle [tutorial](https://buijs.dev/kradle-1/) for usage instructions.

# Installation
<b>What's the point?</b></br>
Plugins build with the Klutter Framework work slightly different from regular plugins.
Expand All @@ -45,7 +66,7 @@ Add the Klutter library to dependencies in the pubspec.yaml:

```yaml
dev_dependencies:
klutter: ^2.0.0
klutter: ^3.0.0
```
Then run:
Expand All @@ -70,7 +91,7 @@ Install Klutter as dependency as described [here](#Installation).
Initialize Klutter in your project by running:

```shell
flutter pub run klutter:consumer init
dart run klutter:kradle init
```

The init task will set up Klutter for both Android and iOS.
Expand All @@ -79,7 +100,7 @@ Klutter plugins can be added by running the add command.
<B>Example</B>:</br> Add the library 'awesome_plugin' to your project:

```shell
flutter pub run klutter:consumer add lib=awesome_plugin
dart run klutter:kradle add lib=awesome_plugin
```

<b>Background</b></br>
Expand Down Expand Up @@ -152,33 +173,27 @@ flutter create --org com.example --template=plugin --platforms=android,ios -a ko
Install the Klutter Framework as dependency and then run:

```shell
flutter pub run klutter:producer init
dart run kradle:init
```

Build the platform module by running the following in the root folder (takes a few minutes):

```shell
./gradlew clean build -p "platform"
```

It is also possible to import the kradle tool in your project using Gradle:

```shell
./gradlew klutterGetKradle
dart run klutter:kradle build
```

And then build the project with kradle:
Alternatively use gradle directly with the following command:

```shell
./kradlew build
./gradlew clean build -p "platform"
```


Now test the plugin by following the steps outlined [here](#Usage) in the root/example project.
When done you can run the example project from the root/example/lib folder and see your first plugin in action!

# Faq
1. [App won't start on...](#App%20won't%20start)
2. [Build fails](#build-fails)

## App won't start
Make sure you have followed all the following steps:
Expand Down Expand Up @@ -209,4 +224,26 @@ folder.
If there's an error message saying something similiar to '...example/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: Permission denied'
then try one of:
- delete the Podfile.lock and run pod install in root/example/ios folder.
- run pod deintegrate and then pod install in root/example/ios folder.
- run pod deintegrate and then pod install in root/example/ios folder.

## Build fails
1. [Java toolchain error](#java-toolchain-error)

### Java toolchain error
When you get an error like below, indicating no compatible Java version is detected, make sure you
have the same Java version installed as required by the klutter project.

```shell
* What went wrong:
Could not determine the dependencies of task ':klutter:hello_world:compileDebugKotlinAndroid'.
> No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific}.
> No locally installed toolchains match ...
```

You might also have to add the following plugin to the settings.gradle(.kts) files:

```kotlin
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0"
}
```
4 changes: 2 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ analyzer:
exclude:
- "**/*.g.dart"
strong-mode:
implicit-casts: false
implicit-dynamic: false
strict-casts: false
strict-raw-types: false
errors:
# Otherwise cause the import of all_lint_rules to warn because of some rules conflicts.
# We explicitly enabled even conflicting rules and are fixing the conflict in this file
Expand Down
Loading

0 comments on commit 64fb114

Please sign in to comment.