You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: courses/GettingStarted/MavenPlugin/CompileMojo/CompileMojo.md
+34-30Lines changed: 34 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,14 @@ keywords:
7
7
- "rascal:compile"
8
8
---
9
9
10
+
#### Synopsis
11
+
12
+
Basic project configuration for Rascal projects, checking, compilation and running.
13
+
14
+
#### Decription
15
+
16
+
The `compile` mojo calls the Rascal static checker and compiler on the source code in a Rascal project. Also it uses information from the libraries the current project depends on (including the standard library). The configuration here is also the core of the configuration for the other maven plugins.
17
+
10
18
All Rascal projects are assumed to be configured via a Maven `pom.xml` file. To use the Rascal compiler via the `mvn rascal:compile` goal:
11
19
1. The Rascal compiler is made available to the project via adding a proper `<plugin>` tag for the `rascal-maven-plugin`.
12
20
1. Dependencies on other Rascal or JVM-based projects are declared in with `<dependency>` tags.
@@ -32,7 +40,32 @@ Next to these files the compiler outputs messages and their origin location:
32
40
*`[WARNING]` messages report on likely issues in `Module.rsc`; for example likely to be incomplete and throw an exception, or likely to never match and be dead, etc.
33
41
*`[INFO]` messages provide information useful for understanding advanced features of Rascal or hint at to be deprecated behavior that a programmer might prepare themselves for.
34
42
35
-
#### Configuring the compiler with Maven
43
+
The configuration tags for the compile mojo are an extended subset of the standard fields of ((data:PathConfig)).
44
+
The defaults are chosen such that you hardly have to use these tags.
|`<srcs>`|`<src>./src/main/rascal</src>`| list of directories where `.rsc` files can be found |
49
+
|`<libs>`| filled with `<dependencies>`| list of jar files or directories for the library dependencies |
50
+
|`<ignores>`| empty | list of folders and files to skip while compiling |
51
+
|`<generatedSources>`|`./target/generated-sources`| where the compiler stores intermediate Java code |
52
+
|`<bin>`|`./target/classes`| where the binary output of the compiler is staged before it goes into the jar file |
53
+
|`<logPathConfig>`| false | write the pathConfig to the log before compiling |
54
+
|`<logImports>`| false | write imports and extends of each module to the log during compilation |
55
+
|`<logWrittenFiles>`| false | log every file written including timestamp during compilation |
56
+
|`<warnUnused>`| true | warn about unused declarations |
57
+
|`<warnedUnusedFormals>`| true | warn about unused formal parameters (pattern variables of function signatures) |
58
+
|`<warnUnusedPatternFormals>`| true | warn about unused variables in patterns |
59
+
|`<errorsAsWarnings>`| false | with this the compiler never reports failure in the presence of errors |
60
+
|`<warningsAsErrors>`| false | with this the compiler reports failure even if there are only warnings and no errors. Can not be true at the same time with `errorsAsWarnings`|
61
+
|`<parallel>`| false | enables parallel compilation of a large group of `.rsc` source files |
62
+
| `<parallelMax>` | `5` | restricts the number of parallel compiler processes. The mojo otherwises
63
+
computes an estimate based on the number of processors and the available memory |
64
+
| `<parallelPrechecks>` | empty | a list of files reachable from `<srcs>` that will be compiled before the
65
+
other processes start. |
66
+
|`<verbose>`| enables internal debugging prints of the compiler |
67
+
68
+
#### Examples
36
69
37
70
The compiler is configured in `pom.xml` in three locations:
38
71
*`<dependencies>...</dependencies>` - each dependency leads to a compile-time library path entry, and a run-time JVM classpath entry.
@@ -73,37 +106,8 @@ The compiler is configured in `pom.xml` in three locations:
73
106
```
74
107
* The latter overwrites the first, tag-by-tag
75
108
76
-
The configuration tags are an extended subset of the standard fields of ((data:PathConfig)).
77
-
The defaults are chosen such that you hardly have to use these tags.
|`<srcs>`|`<src>./src/main/rascal</src>`| list of directories where `.rsc` files can be found |
82
-
|`<libs>`| filled with `<dependencies>`| list of jar files or directories for the library dependencies |
83
-
|`<ignores>`| empty | list of folders and files to skip while compiling |
84
-
|`<generatedSources>`|`./target/generated-sources`| where the compiler stores intermediate Java code |
85
-
|`<bin>`|`./target/classes`| where the binary output of the compiler is staged before it goes into the jar file |
86
-
|`<logPathConfig>`| false | write the pathConfig to the log before compiling |
87
-
|`<logImports>`| false | write imports and extends of each module to the log during compilation |
88
-
|`<logWrittenFiles>`| false | log every file written including timestamp during compilation |
89
-
|`<warnUnused>`| true | warn about unused declarations |
90
-
|`<warnedUnusedFormals>`| true | warn about unused formal parameters (pattern variables of function signatures) |
91
-
|`<warnUnusedPatternFormals>`| true | warn about unused variables in patterns |
92
-
|`<errorsAsWarnings>`| false | with this the compiler never reports failure in the presence of errors |
93
-
|`<warningsAsErrors>`| false | with this the compiler reports failure even if there are only warnings and no errors. Can not be true at the same time with `errorsAsWarnings`|
94
-
|`<parallel>`| false | enables parallel compilation of a large group of `.rsc` source files |
95
-
| `<parallelMax>` | `5` | restricts the number of parallel compiler processes. The mojo otherwises
96
-
computes an estimate based on the number of processors and the available memory |
97
-
| `<parallelPrechecks>` | empty | a list of files reachable from `<srcs>` that will be compiled before the
98
-
other processes start. |
99
-
|`<verbose>`| enables internal debugging prints of the compiler |
100
-
101
-
#### Examples
102
-
103
109
Maven is typically executed on the Un*x or Windows commandline like so:
104
110
```bash
105
-
#! /bin/bash
106
-
107
111
# Typically runs the compiler and the tests before packaging everything
108
112
# in a jar file, and copying it to your local Maven repository:
0 commit comments