@@ -18,15 +18,17 @@ for some other example layouts.
18
18
19
19
# Running Pants
20
20
21
- You run Pants goals using the ` ./pants ` wrapper script, which will bootstrap the
22
- configured version of Pants if necessary.
21
+ You run Pants goals using the ` pants ` launcher binary, which will bootstrap the
22
+ version of Pants configured for this repo if necessary.
23
+
24
+ See [ here] ( https://www.pantsbuild.org/docs/installation ) for how to install the ` pants ` binary.
23
25
24
26
# Goals
25
27
26
28
Pants commands are called _ goals_ . You can get a list of goals with
27
29
28
30
```
29
- ./ pants help goals
31
+ pants help goals
30
32
```
31
33
32
34
Most goals take arguments to run on. To run on a single directory, use the directory name with
36
38
For example:
37
39
38
40
```
39
- ./ pants lint src: 3rdparty::
41
+ pants lint src: 3rdparty::
40
42
```
41
43
42
44
You can run on all changed files:
43
45
44
46
```
45
- ./ pants --changed-since=HEAD lint
47
+ pants --changed-since=HEAD lint
46
48
```
47
49
48
50
You can run on all changed files, and any of their "dependees":
49
51
50
52
```
51
- ./ pants --changed-since=HEAD --changed-dependees=transitive test
53
+ pants --changed-since=HEAD --changed-dependees=transitive test
52
54
```
53
55
54
56
# Example Goals
@@ -58,54 +60,54 @@ Try these out in this repo!
58
60
## Run ` scalafmt ` and ` google_java_format `
59
61
60
62
```
61
- ./ pants fmt :: # Format all files.
62
- ./ pants fmt src/jvm: # Format only files in this directory (non-recursively).
63
- ./ pants lint src/jvm:: # Check that all files under `src/jvm` are formatted (recursively).
63
+ pants fmt :: # Format all files.
64
+ pants fmt src/jvm: # Format only files in this directory (non-recursively).
65
+ pants lint src/jvm:: # Check that all files under `src/jvm` are formatted (recursively).
64
66
```
65
67
66
68
## Check compilation
67
69
68
70
```
69
- ./ pants check :: # Compile everything.
70
- ./ pants check src/jvm/org/pantsbuild/example/lib/ExampleLib.java # Compile a file and its deps.
71
+ pants check :: # Compile everything.
72
+ pants check src/jvm/org/pantsbuild/example/lib/ExampleLib.java # Compile a file and its deps.
71
73
```
72
74
73
75
## Run and debug tests
74
76
75
77
```
76
- ./ pants test :: # Run all tests in the repository.
77
- ./ pants test tests/jvm/org/pantsbuild/example/lib: # Run all the tests in this directory.
78
- ./ pants test tests/jvm/org/pantsbuild/example/lib/ExampleLibSpec.scala -- -z hello # Run one test method.
79
- ./ pants test --debug tests/jvm/org/pantsbuild/example/lib/ExampleLibSpec.scala # Debug one file.
78
+ pants test :: # Run all tests in the repository.
79
+ pants test tests/jvm/org/pantsbuild/example/lib: # Run all the tests in this directory.
80
+ pants test tests/jvm/org/pantsbuild/example/lib/ExampleLibSpec.scala -- -z hello # Run one test method.
81
+ pants test --debug tests/jvm/org/pantsbuild/example/lib/ExampleLibSpec.scala # Debug one file.
80
82
```
81
83
82
84
## Create a binary file
83
85
84
86
Writes the result to the ` dist/ ` folder.
85
87
86
88
```
87
- ./ pants package src/jvm/org/pantsbuild/example/app: # Build one binary.
88
- ./ pants package :: # Create all binaries.
89
+ pants package src/jvm/org/pantsbuild/example/app: # Build one binary.
90
+ pants package :: # Create all binaries.
89
91
```
90
92
91
93
## Determine dependencies
92
94
93
95
```
94
- ./ pants dependencies tests/jvm::
95
- ./ pants dependencies --transitive tests/jvm::
96
+ pants dependencies tests/jvm::
97
+ pants dependencies --transitive tests/jvm::
96
98
```
97
99
98
100
## Determine dependees
99
101
100
102
That is, find what code depends on a particular files.
101
103
102
104
```
103
- ./ pants dependees src/jvm/org/pantsbuild/example/lib::
104
- ./ pants dependees --transitive src/jvm/org/pantsbuild/example/lib/ExampleLib.java
105
+ pants dependees src/jvm/org/pantsbuild/example/lib::
106
+ pants dependees --transitive src/jvm/org/pantsbuild/example/lib/ExampleLib.java
105
107
```
106
108
107
109
## Count lines of code
108
110
109
111
```
110
- ./ pants count-loc '**/*'
112
+ pants count-loc '**/*'
111
113
```
0 commit comments