Skip to content

Commit b3cb315

Browse files
committed
Fixup README, change group to palantir (#56)
Fix up readme to point to Palantir things, crediting google-java-format.
1 parent 54aef9e commit b3cb315

444 files changed

Lines changed: 336 additions & 1055 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.travis.yml‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎CONTRIBUTING.md‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎LICENSE‎

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
The following Apache 2.0 license applies to all code in this package except
2-
google-java-format-diff.py.
3-
41
Apache License
52
Version 2.0, January 2004
63
http://www.apache.org/licenses/
@@ -202,71 +199,3 @@ google-java-format-diff.py.
202199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203200
See the License for the specific language governing permissions and
204201
limitations under the License.
205-
206-
------------------------------------------------------------------------------
207-
208-
The following NCSA license applies only to google-java-format-diff.py.
209-
210-
==============================================================================
211-
LLVM Release License
212-
==============================================================================
213-
University of Illinois/NCSA
214-
Open Source License
215-
216-
Copyright (c) 2007-2015 University of Illinois at Urbana-Champaign.
217-
All rights reserved.
218-
219-
Developed by:
220-
221-
LLVM Team
222-
223-
University of Illinois at Urbana-Champaign
224-
225-
http://llvm.org
226-
227-
Permission is hereby granted, free of charge, to any person obtaining a copy of
228-
this software and associated documentation files (the "Software"), to deal with
229-
the Software without restriction, including without limitation the rights to
230-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
231-
of the Software, and to permit persons to whom the Software is furnished to do
232-
so, subject to the following conditions:
233-
234-
* Redistributions of source code must retain the above copyright notice,
235-
this list of conditions and the following disclaimers.
236-
237-
* Redistributions in binary form must reproduce the above copyright notice,
238-
this list of conditions and the following disclaimers in the
239-
documentation and/or other materials provided with the distribution.
240-
241-
* Neither the names of the LLVM Team, University of Illinois at
242-
Urbana-Champaign, nor the names of its contributors may be used to
243-
endorse or promote products derived from this Software without specific
244-
prior written permission.
245-
246-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
247-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
248-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
249-
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
250-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
251-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
252-
SOFTWARE.
253-
254-
==============================================================================
255-
The LLVM software contains code written by third parties. Such software will
256-
have its own individual LICENSE.TXT file in the directory in which it appears.
257-
This file will describe the copyrights, license, and restrictions which apply
258-
to that code.
259-
260-
The disclaimer of warranty in the University of Illinois Open Source License
261-
applies to all code in the LLVM Distribution, and nothing in any of the
262-
other licenses gives permission to use the names of the LLVM Team or the
263-
University of Illinois to endorse or promote products derived from this
264-
Software.
265-
266-
The following pieces of software have additional or alternate copyrights,
267-
licenses, and/or restrictions:
268-
269-
Program Directory
270-
------- ---------
271-
<none yet>
272-

‎README.md‎

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
# google-java-format
1+
# palantir-java-format
22

3-
`google-java-format` is a program that reformats Java source code to comply with
4-
[Google Java Style][].
3+
`palantir-java-format` is a program that reformats Java source code to comply with
4+
[Palantir Java Style][].
55

6-
[Google Java Style]: https://google.github.io/styleguide/javaguide.html
6+
It is a fork of [google-java-format], but intending to achieve the following goals:
7+
8+
* Enforce the Palantir Java Style, whose main difference compared to Google's style is that we use 120 character lines and 4 space indent.
9+
10+
* Produce more compact code - Keep long method chains and invocations, as well as assignments and lambdas, on a single line, if we can break only the last argument of a method call, or the last method call in a chain.
11+
12+
* don't break [NON-NLS markers][] - these are comments that are used when implementing NLS internationalisation, and need to stay on the same line with the strings they come after.
13+
14+
We thank everyone who's worked on google-java-format for their good work and for making it available for free online. It's thanks to their work that we could incorporate our coding style preferences into a formatter so easily.
15+
16+
[google-java-format]: https://github.com/google/google-java-format
17+
[Palantir Java Style]: https://github.com/palantir/gradle-baseline/blob/develop/docs/java-style-guide/readme.md
18+
[NON-NLS markers]: https://stackoverflow.com/a/40266605
719

820
## Using the formatter
921

1022
### from the command-line
1123

12-
[Download the formatter](https://github.com/google/google-java-format/releases)
24+
[Download the formatter](https://github.com/palantir/palantir-java-format/releases)
1325
and run it with:
1426

1527
```
16-
java -jar /path/to/google-java-format-1.7-all-deps.jar <options> [files...]
28+
java -jar /path/to/palantir-java-format-<version>-all-deps.jar <options> [files...]
1729
```
1830

1931
The formatter can act on whole files, on limited lines (`--lines`), on specific
2032
offsets (`--offset`), passing through to standard-out (default) or altered
2133
in-place (`--replace`).
2234

2335
To reformat changed lines in a specific patch, use
24-
[`google-java-format-diff.py`](https://github.com/google/google-java-format/blob/master/scripts/google-java-format-diff.py).
36+
[`google-java-format-diff.py`](https://github.com/palantir/palantir-java-format/blob/master/scripts/google-java-format-diff.py).
2537

2638
***Note:*** *There is no configurability as to the formatter's algorithm for
2739
formatting. This is a deliberate design decision to unify our code formatting on
@@ -30,18 +42,18 @@ a single format.*
3042
### IntelliJ, Android Studio, and other JetBrains IDEs
3143

3244
A
33-
[google-java-format IntelliJ plugin](https://plugins.jetbrains.com/plugin/8527)
45+
[palantir-java-format IntelliJ plugin](https://plugins.jetbrains.com/plugin/8527)
3446
is available from the plugin repository. To install it, go to your IDE's
3547
settings and select the `Plugins` category. Click the `Marketplace` tab, search
36-
for the `google-java-format` plugin, and click the `Install` button.
48+
for the `palantir-java-format` plugin, and click the `Install` button.
3749

38-
The plugin will be disabled by default. To enable it in the current project, go
39-
to `File→Settings...→google-java-format Settings` (or `IntelliJ
40-
IDEA→Preferences...→Other Settings→google-java-format Settings` on macOS) and
41-
check the `Enable google-java-format` checkbox. (A notification will be
50+
The plugin will be enabled by default. To disable it in the current project, go
51+
to `File→Settings...→palantir-java-format Settings` (or `IntelliJ
52+
IDEA→Preferences...→Other Settings→palantir-java-format Settings` on macOS) and
53+
check the `Enable palantir-java-format` checkbox. (A notification will be
4254
presented when you first open a project offering to do this for you.)
4355

44-
To enable it by default in new projects, use `File→Other Settings→Default
56+
To disable it by default in new projects, use `File→Other Settings→Default
4557
Settings...`.
4658

4759
When enabled, it will replace the normal `Reformat Code` action, which can be
@@ -55,13 +67,12 @@ and import it into File→Settings→Editor→Code Style.
5567

5668
### Eclipse
5769

58-
A
59-
[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/google-java-format-1.6/google-java-format-eclipse-plugin_1.6.0.jar)
60-
can be downloaded from the releases page. Drop it into the Eclipse
70+
A palantir-java-format Eclipse plugin is not currently published but can be built individually.
71+
Once built, drop it into the Eclipse
6172
[drop-ins folder](http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html)
6273
to activate the plugin.
6374

64-
The plugin adds a `google-java-format` formatter implementation that can be
75+
The plugin adds a `palantir-java-format` formatter implementation that can be
6576
configured in `Window > Preferences > Java > Code Style > Formatter > Formatter
6677
Implementation`.
6778

@@ -90,48 +101,64 @@ configuration.
90101

91102
```xml
92103
<dependency>
93-
<groupId>com.google.googlejavaformat</groupId>
94-
<artifactId>google-java-format</artifactId>
95-
<version>1.7</version>
104+
<groupId>com.palantir.javaformat</groupId>
105+
<artifactId>palantir-java-format</artifactId>
96106
</dependency>
97107
```
98108

99109
#### Gradle
100110

101111
```groovy
102112
dependencies {
103-
compile 'com.google.googlejavaformat:google-java-format:1.7'
113+
compile 'com.palantir.javaformat:palantir-java-format:<version>'
104114
}
105115
```
106116

107117
You can then use the formatter through the `formatSource` methods. E.g.
108118

109119
```java
110-
String formattedSource = new Formatter().formatSource(sourceString);
120+
String formattedSource = new Formatter(JavaFormatterOptions.builder().style(Style.PALANTIR).build())
121+
.formatSource(sourceString);
111122
```
112123

113124
or
114125

115126
```java
116127
CharSource source = ...
117128
CharSink output = ...
118-
new Formatter().formatSource(source, output);
129+
new Formatter(JavaFormatterOptions.builder().style(Style.PALANTIR).build())
130+
.formatSource(source, output);
119131
```
120132

121133
Your starting point should be the instance methods of
122-
`com.google.googlejavaformat.java.Formatter`.
134+
`com.palantir.javaformat.java.Formatter`.
123135

124136
## Building from source
125137

126138
```
127-
mvn install
139+
./gradlew publishToMavenLocal
128140
```
129141

130-
## Contributing
142+
## License
131143

132-
Please see [the contributors guide](CONTRIBUTING.md) for details.
144+
```text
145+
(c) Copyright 2019 Palantir Technologies Inc. All rights reserved.
133146
134-
## License
147+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
148+
use this file except in compliance with the License. You may obtain a copy of
149+
the License at
150+
151+
http://www.apache.org/licenses/LICENSE-2.0
152+
153+
Unless required by applicable law or agreed to in writing, software
154+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
155+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
156+
License for the specific language governing permissions and limitations under
157+
the License.
158+
```
159+
160+
This is a fork of [google-java-format](https://github.com/google/google-java-format).
161+
Original work copyrighted by Google under the same license:
135162

136163
```text
137164
Copyright 2015 Google Inc.
@@ -147,4 +174,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
147174
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
148175
License for the specific language governing permissions and limitations under
149176
the License.
150-
```
177+
```

‎appveyor.yml‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ apply plugin: 'com.palantir.baseline'
2525
version = gitVersion()
2626

2727
allprojects {
28-
group = 'com.google.googlejavaformat'
28+
group = 'com.palantir.javaformat'
2929
version = rootProject.version
3030

3131
repositories {

0 commit comments

Comments
 (0)