Skip to content

Commit

Permalink
Fixup README, change group to palantir (#56)
Browse files Browse the repository at this point in the history
Fix up readme to point to Palantir things, crediting google-java-format.
  • Loading branch information
dansanduleac committed Oct 11, 2019
1 parent 54aef9e commit b3cb315
Show file tree
Hide file tree
Showing 444 changed files with 336 additions and 1,055 deletions.
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

29 changes: 0 additions & 29 deletions CONTRIBUTING.md

This file was deleted.

71 changes: 0 additions & 71 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
The following Apache 2.0 license applies to all code in this package except
google-java-format-diff.py.

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -202,71 +199,3 @@ google-java-format-diff.py.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

------------------------------------------------------------------------------

The following NCSA license applies only to google-java-format-diff.py.

==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License

Copyright (c) 2007-2015 University of Illinois at Urbana-Champaign.
All rights reserved.

Developed by:

LLVM Team

University of Illinois at Urbana-Champaign

http://llvm.org

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.

* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.

The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.

The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:

Program Directory
------- ---------
<none yet>

87 changes: 57 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
# google-java-format
# palantir-java-format

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

[Google Java Style]: https://google.github.io/styleguide/javaguide.html
It is a fork of [google-java-format], but intending to achieve the following goals:

* Enforce the Palantir Java Style, whose main difference compared to Google's style is that we use 120 character lines and 4 space indent.

* 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.

* 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.

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.

[google-java-format]: https://github.com/google/google-java-format
[Palantir Java Style]: https://github.com/palantir/gradle-baseline/blob/develop/docs/java-style-guide/readme.md
[NON-NLS markers]: https://stackoverflow.com/a/40266605

## Using the formatter

### from the command-line

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

```
java -jar /path/to/google-java-format-1.7-all-deps.jar <options> [files...]
java -jar /path/to/palantir-java-format-<version>-all-deps.jar <options> [files...]
```

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

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

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

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

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

To enable it by default in new projects, use `File→Other Settings→Default
To disable it by default in new projects, use `File→Other Settings→Default
Settings...`.

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

### Eclipse

A
[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)
can be downloaded from the releases page. Drop it into the Eclipse
A palantir-java-format Eclipse plugin is not currently published but can be built individually.
Once built, drop it into the Eclipse
[drop-ins folder](http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html)
to activate the plugin.

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

Expand Down Expand Up @@ -90,48 +101,64 @@ configuration.

```xml
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>1.7</version>
<groupId>com.palantir.javaformat</groupId>
<artifactId>palantir-java-format</artifactId>
</dependency>
```

#### Gradle

```groovy
dependencies {
compile 'com.google.googlejavaformat:google-java-format:1.7'
compile 'com.palantir.javaformat:palantir-java-format:<version>'
}
```

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

```java
String formattedSource = new Formatter().formatSource(sourceString);
String formattedSource = new Formatter(JavaFormatterOptions.builder().style(Style.PALANTIR).build())
.formatSource(sourceString);
```

or

```java
CharSource source = ...
CharSink output = ...
new Formatter().formatSource(source, output);
new Formatter(JavaFormatterOptions.builder().style(Style.PALANTIR).build())
.formatSource(source, output);
```

Your starting point should be the instance methods of
`com.google.googlejavaformat.java.Formatter`.
`com.palantir.javaformat.java.Formatter`.

## Building from source

```
mvn install
./gradlew publishToMavenLocal
```

## Contributing
## License

Please see [the contributors guide](CONTRIBUTING.md) for details.
```text
(c) Copyright 2019 Palantir Technologies Inc. All rights reserved.
## License
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
```

This is a fork of [google-java-format](https://github.com/google/google-java-format).
Original work copyrighted by Google under the same license:

```text
Copyright 2015 Google Inc.
Expand All @@ -147,4 +174,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
```
```
32 changes: 0 additions & 32 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.palantir.baseline'
version = gitVersion()

allprojects {
group = 'com.google.googlejavaformat'
group = 'com.palantir.javaformat'
version = rootProject.version

repositories {
Expand Down
Loading

0 comments on commit b3cb315

Please sign in to comment.