1
+ # WALA’s Gradle Build System
2
+
1
3
This document describes some WALA-specific aspects of our Gradle build
2
4
system, plus a few general Gradle features that may be of particular
3
5
interest to WALA developers. However, it is not a Gradle tutorial.
4
6
5
- # Getting Started
7
+ ## Getting Started
6
8
7
- ## External Dependencies: Patience is a Virtue
9
+ ### External Dependencies: Patience is a Virtue
8
10
9
11
Gradle downloads many packages and supporting Java libraries as
10
12
needed. Your first Gradle build may take a long time. On a fast
@@ -17,32 +19,31 @@ faster. Rerunning `./gradlew assemble processTestResources` with a
17
19
warm cache in an already-built tree takes under three seconds.
18
20
19
21
WALA components are built using a mix of Java 11 and Java 17. Gradle
20
- will [ download suitable JDKs
21
- automatically] ( https://docs.gradle.org/current/userguide/toolchains.html#sec:provisioning )
22
- if they are not already [ locally
23
- installed] ( https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection )
22
+ will
23
+ [ download suitable JDKs automatically] ( https://docs.gradle.org/current/userguide/toolchains.html#sec:provisioning )
24
+ if they are not already
25
+ [ locally installed] ( https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection )
24
26
or
25
27
[ custom-configured] ( https://docs.gradle.org/current/userguide/toolchains.html#sec:custom_loc ) .
26
28
27
- ## Eclipse
29
+ ### Eclipse
28
30
29
- ### One-Time Eclipse Configuration
31
+ #### One-Time Eclipse Configuration
30
32
31
33
To work with WALA inside Eclipse, first ** install Eclipse Buildship
32
- 3.1 or later** using either [ the Eclipse
33
- Marketplace] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-marketplace )
34
- or [ the Eclipse update
35
- manager] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-eclipse-update-manager ) .
34
+ 3.1 or later** using either
35
+ [ the Eclipse Marketplace] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-marketplace )
36
+ or
37
+ [ the Eclipse update manager] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-eclipse-update-manager ) .
36
38
Buildship integrates Eclipse with Gradle, much like how M2Eclipse
37
39
integrates Eclipse with Maven. Restart Eclipse after installing this
38
40
feature.
39
41
40
- ### Importing WALA Projects Into Eclipse
42
+ #### Importing WALA Projects Into Eclipse
41
43
42
- Once you are running a Buildship-enabled Eclipse, ** [ use the “Existing
43
- Gradle Project” import
44
- wizard] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project )
45
- to import WALA into Eclipse.** Select and import the topmost level of
44
+ Once you are running a Buildship-enabled Eclipse,
45
+ [ use the “Existing Gradle Project” import wizard] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project )
46
+ to import WALA into Eclipse. Select and import the topmost level of
46
47
your WALA source tree. On the “Import Options” page of the import
47
48
wizard, leave all settings at their defaults: the “Override workspace
48
49
settings” option should be off, and the grayed-out “Gradle
@@ -67,15 +68,14 @@ connection.
67
68
68
69
Note: a pristine WALA source tree is * not* pre-configured as a group
69
70
of Eclipse projects. Using the standard Eclipse “Existing Projects
70
- into Workspace” import wizard will not work correctly. You must [ use
71
- the “Existing Gradle Project” import
72
- wizard] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project )
71
+ into Workspace” import wizard will not work correctly. You must
72
+ [ use the “Existing Gradle Project” import wizard] ( http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project )
73
73
instead.
74
74
75
- ### ` .classpath ` and ` .project ` as Generated Files
75
+ #### ` .classpath ` and ` .project ` as Generated Files
76
76
77
77
You will find no ` .classpath ` or ` .project ` files anywhere in [ the
78
- Gradle fork of WALA’s git repository] ( https://github.com/liblit/WALA ) .
78
+ Gradle fork of WALA’s Git repository] ( https://github.com/liblit/WALA ) .
79
79
Importing using the “Existing Gradle Project” wizard creates these
80
80
Eclipse project configuration files automatically based on the
81
81
underlying Gradle configuration.
@@ -96,9 +96,9 @@ plugin](https://docs.gradle.org/current/userguide/eclipse_plugin.html).
96
96
A few WALA sub-projects already use this: look for ` eclipse.project `
97
97
in ` */build.gradle.kt ` for examples.
98
98
99
- ## IntelliJ IDEA
99
+ ### IntelliJ IDEA
100
100
101
- ### Opening WALA in IntelliJ IDEA
101
+ #### Opening WALA in IntelliJ IDEA
102
102
103
103
Open the top-level WALA directory as a project; it should have a
104
104
distinctive badge on its folder icon marking it as a directory
@@ -115,7 +115,7 @@ patient](#external-dependencies-patience-is-a-virtue) during the
115
115
initial project open, especially if you have a slow network
116
116
connection.
117
117
118
- ### Benign Warning About Non-Managed Maven Project
118
+ #### Benign Warning About Non-Managed Maven Project
119
119
120
120
Each time you open the WALA project, IntelliJ IDEA may report
121
121
“Non-managed pom.xml file found” in its event log. This arises
@@ -125,7 +125,7 @@ safely ignore this notification, permanently disable it using the
125
125
offered “Disable notification” link, or even disable the IntelliJ IDEA
126
126
Maven plugin entirely if you have no other need for it.
127
127
128
- ### Project Configuration as Derived Model
128
+ #### Project Configuration as Derived Model
129
129
130
130
IntelliJ IDEA automatically derives its project models from the Gradle
131
131
build configuration, including all information about both internal and
@@ -142,7 +142,7 @@ to change module and library settings is to change the Gradle
142
142
configuration such that the * derived* IntelliJ IDEA model is what you
143
143
want it to be.
144
144
145
- ## Gradle Command Line
145
+ ### Gradle Command Line
146
146
147
147
You do not need to install Gradle separately. ** WALA includes its own
148
148
copy of Gradle, available as the ` gradlew ` script in the top-level
@@ -156,7 +156,7 @@ under `*/build`. For example the jar archives created by the
156
156
that Eclipse-generated artifacts will appear in Eclipse-specific
157
157
places, such as ` */bin ` and ` */target ` .
158
158
159
- ### Trustworthy Dependencies For Incremental Builds
159
+ #### Trustworthy Dependencies For Incremental Builds
160
160
161
161
Gradle has excellent understanding of task and file dependencies. You
162
162
can trust it to perform incremental rebuilds rather than always
@@ -165,7 +165,7 @@ and rebuilding from scratch after every change, I recommend that you
165
165
drop ` clean ` as a reflexive extra step and ** trust Gradle to do
166
166
incremental builds correctly.**
167
167
168
- ### Favorite Build Tasks
168
+ #### Favorite Build Tasks
169
169
170
170
Some useful Gradle tasks include:
171
171
@@ -182,7 +182,7 @@ Some useful Gradle tasks include:
182
182
183
183
- ` clean ` : remove all Gradle-generated artifacts
184
184
185
- ### Tasks in Specific Sub-Projects
185
+ #### Tasks in Specific Sub-Projects
186
186
187
187
When you run ` ./gradlew ` in the top-level WALA directory, any tasks
188
188
you list will be built in all sub-projects. For example, `./gradlew
@@ -198,15 +198,14 @@ want to build tasks only in specific sub-projects, you have two options:
198
198
and then run ` ../gradlew assemble ` . Note the proper relative path
199
199
to the top-level Gradle script: ` ../gradle ` instead of ` ./gradlew ` .
200
200
201
- ### Task Name Abbreviation
201
+ #### Task Name Abbreviation
202
202
203
- [ Any build task can be
204
- abbreviated] ( https://docs.gradle.org/current/userguide/command_line_interface.html#_task_name_abbreviation )
203
+ [ Any build task can be abbreviated] ( https://docs.gradle.org/current/userguide/command_line_interface.html#_task_name_abbreviation )
205
204
by shortening each camel-case-delimited word in its name. For
206
205
example, the ` processTestResources ` task can probably be abbreviated
207
206
as ` procTeRes ` or even ` pTR ` .
208
207
209
- ### Useful Command-Line Flags
208
+ #### Useful Command-Line Flags
210
209
211
210
Among Gradle’s command-line flags, I have found the following
212
211
particularly useful:
@@ -217,8 +216,7 @@ particularly useful:
217
216
see multiple test failures rather than giving up after the first
218
217
failure.
219
218
220
- - [ ` -t ` ,
221
- ` --continuous ` ] ( https://docs.gradle.org/current/userguide/command_line_interface.html#_continuous_build ) :
219
+ - [ ` -t ` , ` --continuous ` ] ( https://docs.gradle.org/current/userguide/command_line_interface.html#_continuous_build ) :
222
220
keep Gradle process running and re-execute the given tasks whenever
223
221
input files change. Similar to Eclipse’s behavior of updating the
224
222
build whenever you change and save a file.
@@ -236,7 +234,7 @@ particularly useful:
236
234
good way to gain insights into why Gradle did what it did, and how
237
235
long each piece took.
238
236
239
- ### Composite Builds
237
+ #### Composite Builds
240
238
241
239
Gradle’s [ composite
242
240
builds] ( https://docs.gradle.org/current/userguide/composite_builds.html )
0 commit comments