11# bootstrap
22
3- [ ![ Build Status] ( https://travis-ci.com/SpineEventEngine/bootstrap.svg?branch=master ) ]( https://travis-ci.com/SpineEventEngine/bootstrap )
3+ [ ![ Build Status] [ badge ] ]( https://travis-ci.com/SpineEventEngine/bootstrap )
44
55The Gradle plugin for bootstrapping projects built with Spine.
66
7+ [ badge ] : https://travis-ci.com/SpineEventEngine/bootstrap.svg?branch=master
8+
79## Applying to the project
810
911In order to apply the plugin to a Gradle project, in ` build.gralde ` add the following config:
12+
1013``` gradle
1114plugins {
12- id("io.spine.tools.gradle.bootstrap").version("1.6 .0")
15+ id("io.spine.tools.gradle.bootstrap").version("1.7 .0")
1316}
1417```
1518
16- See [ this Gradle doc] ( https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl )
17- on how to apply a plugin only to certain to subprojects.
19+ See [ this Gradle doc] [ gradle-plugins-dsl ] on how to apply a plugin only to certain to subprojects.
20+
21+ [ gradle-plugins-dsl ] : https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
1822
1923## Java Projects
2024
2125In order to mark a (sub-)project as a Java project for Spine, apply the following config:
26+
2227``` gradle
2328spine.enableJava()
2429```
2530
2631This configuration:
32+
2733 - applies ` java ` Gradle plugin;
34+
2835 - applies ` com.google.protobuf ` Gradle plugin;
36+
2937 - configures Java code generation from Protobuf;
38+
3039 - adds a dependency onto the ` io.spine:spine-base ` module;
40+
3141 - applies the Spine Model Compiler plugin and performs its minimal configuration.
3242
3343More often than not, a user would also like to mark a Java project as a client or a server module.
3444To do that, apply the following configuration:
35- - for client modules:
36- ``` gradle
37- spine.enableJava().client()
38- ```
39- - for server modules:
40- ``` gradle
41- spine.enableJava().server()
42- ```
45+
46+ - for client modules:
47+
48+ ``` gradle
49+ spine.enableJava().client()
50+ ```
51+
52+ - for server modules:
53+ ```gradle
54+ spine.enableJava().server()
55+ ```
4356
4457This config will add required dependencies for developing a Spine-based Java client and server
4558respectively.
4659
4760### Obtaining the version when adding other dependencies
4861
49- In order to use the same version for other Spine libraries, please use ` sine.version() ` . For example, adding testing utilities would look like this:
62+ In order to use the same version for other Spine libraries, please use `spine.version()`.
63+ For example, adding testing utilities would look like this:
5064
5165```gradle
5266dependencies {
@@ -62,6 +76,7 @@ Spine relies on [gRPC](https://grpc.io/).
6276All the required gRPC Java stubs and services are already included into the Spine artifacts.
6377However, if users would like to declare gRPC services of their own, they may use the following
6478configuration to set up the generation seamlessly:
79+
6580``` gradle
6681spine.enableJava {
6782 codegen {
@@ -81,6 +96,7 @@ is not added by default in order not to cause clashes in the user projects.
8196
8297Sometimes, the users might not want any Java code to be generated. For such cases, the plugin
8398provides following configuration opportunity:
99+
84100``` gradle
85101spine.enableJava {
86102 codegen {
@@ -89,11 +105,13 @@ spine.enableJava {
89105 }
90106}
91107```
108+
92109This way, no Java code will be generated at all, including Protobuf messages, gRPC services,
93110validating builders, and rejections.
94111
95112A user also may leave the Java Protobuf codegen enabled, but only turn off Spine-specific code
96113generation:
114+
97115``` gradle
98116spine.enableJava {
99117 codegen {
@@ -105,6 +123,7 @@ spine.enableJava {
105123## JavaScript Projects
106124
107125In order to mark a (sub-)project as a JS project for Spine, apply the following config:
126+
108127``` gradle
109128spine.enableJavaScript()
110129```
@@ -114,3 +133,17 @@ This configuration:
114133 - configures JS code generation from Protobuf.
115134
116135If only JS generation is configured, the Java code will not be generated (and the other way around).
136+
137+ ## Dart Projects
138+
139+ In order to mark a (sub-)project as a Dart project for Spine, apply the following config:
140+
141+ ``` gradle
142+ spine.enableDart()
143+ ```
144+
145+ This configuration:
146+ - applies ` com.google.protobuf ` and ` java ` Gradle plugin (as the former depends on the latter);
147+ - configures Dart code generation from Protobuf.
148+
149+ If only Dart generation is configured, the Java code will not be generated (and the other way around).
0 commit comments