Skip to content

Bootstrap Dart#74

Merged
dmdashenkov merged 40 commits intomasterfrom
bootstrap-dart
Nov 17, 2020
Merged

Bootstrap Dart#74
dmdashenkov merged 40 commits intomasterfrom
bootstrap-dart

Conversation

@dmdashenkov
Copy link
Contributor

@dmdashenkov dmdashenkov commented Nov 13, 2020

Introducing support for Dart.

Just like JavaScript modules, Dart modules are meant to be used for the frontend of a Spine-based application.
In order to add a Dart (possibly, Flutter) module to a project, a user needs to:

  1. Install Dart.
  2. Install Dart Protobuf compiler by running
pub global activate protoc_plugin
  1. Install Spine Dart Protoc plugin by running
pub global activate dart_code_gen
  1. Create a Gradle subproject and add the following config to build.gradle (presuming that the project already uses Bootstrap):
spine.enableDart()
  1. Initialize a Dart project in the new Gradle subproject. One can do it by hand, creating all the necessary files, or by running
dart create <path-to-subproject> --force

Note that the --force flag is used to let the tool know it's OK to create the project in an already existing directory.
6. In newly created pubspec.yaml, add the Spine client dependency:

dependencies:
  flutter:
    sdk: flutter
  spine_client: ^0.2.0 # Use the latest version of the `spine_client` package.

The user is only required to go through these steps one time, when the project is being set up.

Bootstrap sets up code generation, both standard and Spine specific for the user.
By default, Dart classes are generated from Protobuf into the lib directory for the main scope and the test directory for the test scope. To generate code from Protobuf which is not declared in the same subproject, as always, the protobuf dependency configuration should be used in Gradle.

The plugin DOES NOT keep the version of the spine_client package, as well as any other package up to date with the whole Spine framework. This responsibility, for now, lies on the plugin users.

@dmdashenkov dmdashenkov self-assigned this Nov 13, 2020
@dmdashenkov dmdashenkov marked this pull request as ready for review November 17, 2020 15:00
@dmdashenkov
Copy link
Contributor Author

@alexander-yevsyukov, @armiol, PTAL.

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

@alexander-yevsyukov
Copy link
Contributor

Install Dart.

What happens if Dart is not installed? How would bootstrap behave?

Would we show the user hits on installation required components?

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmdashenkov
Copy link
Contributor Author

When it comes to not installed packages, the error messages are pretty informative.
We do not handle users not installing Dart just like we don't handle users not installing Java. We expect that users know what they are trying to achieve when creating a Dart client module.

@dmdashenkov dmdashenkov merged commit 53b69b6 into master Nov 17, 2020
@dmdashenkov dmdashenkov deleted the bootstrap-dart branch November 17, 2020 18:00
@yuri-sergiichuk yuri-sergiichuk mentioned this pull request Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants