Skip to content

Commit bfdf626

Browse files
committed
Prepare for 3.0.0 release.
1 parent 7face23 commit bfdf626

18 files changed

+45
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
* Use klutter_ui 1.1.0.
33
* Use Klutter Gradle v2024.1.1.beta with support for protobuf.
44
* Move post-build tasks in root/platform build.gradle.kts to gradle plugin.
5+
* Add kradle script (which replaces producer and consumer).
6+
* Add interactive cli mode.
7+
* Add project create and build tasks.
58
* Remove producer and consumer scripts.
6-
* Add kradle script.
9+
* Refactor library to enable generating a native executable.
710

811
## 2.0.0
912
* Uses AGP 8.0.2 in projects.

dartdoc_options.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ dartdoc:
99
"gradle":
1010
markdown: doc/gradle.md
1111
name: gradle
12-
categoryOrder: ["consumer", "producer", "gradle"]
12+
"tasks":
13+
markdown: doc/tasks.md
14+
name: tasks
15+
categoryOrder: ["consumer", "producer", "gradle", "tasks"]

doc/consumer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ and Frameworks for iOS. A standard Flutter project won't be able to find
66
these artifacts for a Klutter plugin which means they won't work.
77

88
To work with Klutter plugins the following 2 tasks are required:
9-
- consumer init (initialize Klutter in your project)
10-
- consumer add (add a Klutter plugin to your project)
9+
- kradle init (initialize Klutter in your project)
10+
- kradle add (add a Klutter plugin to your project)

doc/gradle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ roughly does two things:
1515

1616
Gradle needs to be installed to be able to do all this.
1717
Even though Flutter installs gradle wrapper in the android folder,
18-
Klutter adds it's own wrapper files to producer project.
18+
Klutter adds its own wrapper files to producer project.
1919

2020
This is done to make sure all Gradle versions within the Klutter project
2121
are aligned and to make the Gradle distributions between consumer

doc/producer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ A producer project is basically a Flutter plugin project with an extra
55
Kotlin Multiplatform module where all (native) platform code will be written.
66

77
The following producer tasks are available:
8-
- producer init (initialize Klutter in your project)
8+
- kradle create (create new klutter project)
9+
- kradle init (initialize Klutter in an existing flutter project)

doc/tasks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Klutter tasks are used to create, build and manage klutter projects and their dependencies.

lib/src/cli/task.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import "cli.dart";
2323
import "context.dart";
2424

2525
/// Interface to encapsulate CLI task functionality.
26+
/// {@category tasks}
2627
abstract class Task<T> {
2728
/// Create a new [Task].
2829
Task(this.taskName, this.taskOptions);
@@ -123,6 +124,7 @@ abstract class Task<T> {
123124
/// List of available tasks.
124125
///
125126
/// The task functionality depends on the calling script.
127+
/// {@category tasks}
126128
enum TaskName {
127129
/// Tasks which adds libraries.
128130
add,
@@ -150,6 +152,7 @@ enum TaskName {
150152
}
151153

152154
/// Convert a String value to a [TaskName].
155+
/// {@category tasks}
153156
extension TaskNameParser on String? {
154157
/// Find a [TaskName] that matches the current
155158
/// (trimmed) String value or return null.
@@ -187,6 +190,7 @@ extension TaskNameParser on String? {
187190
///
188191
/// {@category consumer}
189192
/// {@category producer}
193+
/// {@category tasks}
190194
enum TaskOption {
191195
/// The Klutter (Gradle) BOM version.
192196
bom,

lib/src/cli/task_add.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import "task.dart";
2828
/// Task to add a Klutter-made Flutter plugin to a Flutter project.
2929
///
3030
/// {@category consumer}
31+
/// {@category tasks}
3132
class AddLibrary extends Task {
3233
/// Create new Task based of the root folder.
3334
AddLibrary()

lib/src/cli/task_build.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import "context.dart";
3535
/// and ios sub modules.
3636
///
3737
/// {@category gradle}.
38+
/// {@category tasks}
3839
class BuildProject extends Task {
3940
/// Create new Task.
4041
BuildProject({Executor? executor})

lib/src/cli/task_clean_cache.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import "cli.dart";
2727
import "context.dart";
2828

2929
/// Clean the kradle cache by deleting contents recursively.
30+
/// {@category tasks}
3031
class CleanCache extends Task {
3132
/// Create new Task.
3233
CleanCache([CacheProvider? cacheProvider])
@@ -69,6 +70,7 @@ class CleanCache extends Task {
6970
}
7071

7172
/// Result of task [CleanCache].
73+
/// {@category tasks}
7274
class CleanCacheResult {
7375
/// Create a new instance of [CleanCacheResult].
7476
const CleanCacheResult(this.deleted, this.notDeletedByError);
@@ -82,6 +84,7 @@ class CleanCacheResult {
8284

8385
/// Wrapper to provide the kradle cache directory
8486
/// based on [Context] and [TaskOption] input.
87+
/// {@category tasks}
8588
class CacheProvider {
8689
/// Return the files and directory in the kradle cache directory.
8790
List<FileSystemEntity> getCacheContent(

lib/src/cli/task_get_flutter.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import "context.dart";
3333
///
3434
/// {@category consumer}
3535
/// {@category producer}
36+
/// {@category tasks}
3637
class GetFlutterSDK extends Task<Directory> {
3738
/// Create new Task.
3839
GetFlutterSDK()
@@ -96,8 +97,9 @@ class GetFlutterSDK extends Task<Directory> {
9697
}
9798

9899
target.listSync(recursive: true).forEach((element) {
99-
if(element is File) {
100-
Process.runSync("chmod", runInShell: true, ["755", element.absolutePath]);
100+
if (element is File) {
101+
Process.runSync(
102+
"chmod", runInShell: true, ["755", element.absolutePath]);
101103
}
102104
});
103105

@@ -113,6 +115,7 @@ class GetFlutterSDK extends Task<Directory> {
113115

114116
/// Find applicable [FlutterDistribution] for the current
115117
/// [OperatingSystem] and [Architecture] or throw [KlutterException].
118+
/// {@category tasks}
116119
FlutterDistribution toFlutterDistributionOrThrow(
117120
{required VerifiedFlutterVersion version,
118121
required String pathToRoot,
@@ -141,6 +144,7 @@ FlutterDistribution toFlutterDistributionOrThrow(
141144
return FlutterDistribution(version: version.version, os: os!, arch: arch);
142145
}
143146

147+
/// {@category tasks}
144148
Map<FlutterDistribution, String> get _compatibleFlutterVersions {
145149
final dist = [
146150
_windows(
@@ -203,6 +207,7 @@ Map<FlutterDistribution, String> get _compatibleFlutterVersions {
203207
}
204208

205209
/// A flutter distribution which is compatible with klutter.
210+
/// {@category tasks}
206211
@immutable
207212
class FlutterDistribution {
208213
/// Create a new [FlutterDistribution] instance.
@@ -266,6 +271,7 @@ class FlutterDistribution {
266271
///The full Flutter distribution version in format major.minor.patch (platform architecture).
267272
///
268273
/// Example: 3.0.5 MACOS (ARM64).
274+
/// {@category tasks}
269275
@immutable
270276
class PrettyPrintedFlutterDistribution {
271277
/// Create a new [PrettyPrintedFlutterDistribution] instance.
@@ -283,6 +289,7 @@ class PrettyPrintedFlutterDistribution {
283289
/// The full Flutter distribution version in format major.minor.patch.platform.architecture.
284290
///
285291
/// Example: 3.0.5.windows.x64.
292+
/// {@category tasks}
286293
@immutable
287294
class FlutterDistributionFolderName {
288295
/// Create a new [FlutterDistributionFolderName] instance.

lib/src/cli/task_project_create.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import "../common/common.dart";
2424
import "cli.dart";
2525
import "context.dart";
2626

27-
/// Task
27+
/// Task to create a new klutter project.
28+
/// {@category tasks}
29+
/// {@category producer}
2830
class CreateProject extends Task {
2931
/// Create new Task.
3032
CreateProject(

lib/src/cli/task_project_init.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const _resourceTarUrl =
4444
///
4545
/// {@category consumer}
4646
/// {@category producer}
47+
/// {@category tasks}
4748
class ProjectInit extends Task {
4849
/// Create new Task based of the root folder.
4950
ProjectInit()

lib/src/cli/task_result.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
///
2323
/// [isOk] is true when task is finished without exceptions or false when not.
2424
/// [message] contains the exception message or is null when task was successful.
25+
/// {@category tasks}
2526
class TaskResult<T> {
2627
/// Create a new result with a message if there was an exception.
2728
const TaskResult({

lib/src/cli/task_service.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import "task_project_create.dart";
2929
import "task_project_init.dart";
3030

3131
/// Service for available tasks.
32+
/// {@category tasks}
3233
class TaskService {
3334
/// Get the [Task] with [TaskName] or null.
3435
Task? toTask(TaskName taskName) {
@@ -59,6 +60,7 @@ class TaskService {
5960
///
6061
/// {@category producer}
6162
/// {@category consumer}
63+
/// {@category tasks}
6264
Set<Task> allTasks(
6365

6466
/// Injectable Task List for testing purposes.

lib/src/common/executor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ class Executor {
3737

3838
/// An (optional) list of arguments.
3939
///
40-
/// For example: ["clean", "build"] with [executable] "gradlew"
40+
/// For example: "clean", "build" with [executable] "gradlew"
4141
/// would result in a gradlew clean build to be executed from the [workingDirectory].
4242
List<String> arguments = const [];
4343

4444
/// Run the command.
4545
///
4646
/// For example an [executable] 'gradlew'
47-
/// with [arguments] '["clean", "build", "-p", "platform"]'
47+
/// with [arguments] "clean", "build", "-p", "platform"
4848
/// and [workingDirectory] './Users/Foo'
4949
/// would result in command "./Users/Foo/gradlew clean build -p platform".
5050
ProcessResult run() {

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ dependencies:
1616
meta: ^1.9.1
1717

1818
dev_dependencies:
19+
build_runner: ^2.4.0
20+
build_web_compilers: ^4.0.4
1921
coverage: ^1.6.4
2022
dartdoc: ^6.1.0 # can be bumped when min SDK is 2.19.0
2123
pana: ^0.22.2

test/src/systemtest/e2e_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void main() {
6262

6363
final downloadFlutterResult = await run(["get", "flutter=3.10.6"]);
6464
expect(
65-
downloadFlutterResult.contains(
66-
"Task 'get flutter=3.10.6' finished successful"),
65+
downloadFlutterResult
66+
.contains("Task 'get flutter=3.10.6' finished successful"),
6767
true,
6868
reason: downloadFlutterResult);
6969

0 commit comments

Comments
 (0)