Skip to content

Commit 9ed0437

Browse files
authored
Fixes the Eclipse Plugin (palantir#949)
1 parent 9dbd392 commit 9ed0437

15 files changed

Lines changed: 453 additions & 308 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
_A modern, lambda-friendly, 120 character Java formatter._
1212

13+
- [Eclipse plugin](https://github.com/palantir/palantir-java-format/tree/develop/eclipse_plugin)
1314
- [IntelliJ plugin](https://plugins.jetbrains.com/plugin/13180-palantir-java-format)
1415
- [Gradle plugin](https://github.com/palantir/gradle-baseline#compalantirbaseline-format)
1516
- [Spotless](#spotless)

‎eclipse_plugin/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target/
2+
/.mvn/wrapper/maven-wrapper.jar

‎eclipse_plugin/META-INF/MANIFEST.MF‎

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

‎eclipse_plugin/README.md‎

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
# google-java-format Eclipse Plugin
2-
3-
## Enabling
4-
5-
See https://github.com/google/google-java-format#eclipse
6-
7-
## Development
8-
9-
1) Uncomment `<module>eclipse_plugin</module>` in the parent `pom.xml`
10-
11-
2) Run `mvn install`, which will copy the dependences of the plugin to
12-
`eclipse_plugin/lib`.
13-
14-
2) If you are using Java 9, add
15-
16-
```
17-
-vm
18-
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java
19-
```
20-
21-
to `/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini`.
22-
23-
3) Open the `eclipse_plugin` project in a recent Eclipse SDK build.
24-
25-
4) From `File > Export` select `Plugin-in Development > Deployable plugin-ins
26-
and fragments` and follow the wizard to export a plugin jar.
1+
# palantir-java-format Eclipse Plugin
2+
3+
## Installation
4+
5+
1. Run `./gradlew :eclipse_plugin:build` in the main folder,
6+
1. If running Eclipse under JRE 17 or later add these options to `eclipse.ini` after `-vmargs`:
7+
```
8+
--add-exports
9+
jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
10+
--add-exports
11+
jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
12+
--add-exports
13+
jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
14+
--add-exports
15+
jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
16+
--add-exports
17+
jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
18+
```
19+
1. Copy `build/libs/palantir-java-format-eclipse-plugin-<version>.jar` to the `dropins` folder of your Eclipse installation,
20+
1. Run `eclipse -clean`.

‎eclipse_plugin/build.gradle‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
plugins {
16+
id 'java-library'
17+
id 'dev.equo.p2deps' version '1.7.3'
18+
}
19+
20+
p2deps {
21+
into 'compileOnly', {
22+
p2repo 'https://download.eclipse.org/releases/2020-09/202009161000/'
23+
24+
install 'org.eclipse.jdt.core'
25+
}
26+
}
27+
28+
dependencies {
29+
implementation project(':palantir-java-format')
30+
}
31+
32+
jar {
33+
archiveBaseName = 'palantir-java-format-eclipse-plugin'
34+
manifest {
35+
from 'src/main/resources/META-INF/MANIFEST.MF'
36+
}
37+
// We embed some dependencies into the JAR file
38+
from(configurations.runtimeClasspath.filter {
39+
var name = it.getName()
40+
name.startsWith('functionaljava') || name.startsWith('guava') || name.startsWith('palantir')
41+
}) {
42+
into 'lib'
43+
// The libraries are listed without a version in the manifest
44+
rename('(.*)-[0-9b.]+(\\.dirty|-jre)?\\.jar', '$1.jar')
45+
}
46+
}

‎eclipse_plugin/build.properties‎

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

‎eclipse_plugin/plugin.xml‎

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

‎eclipse_plugin/pom.xml‎

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

‎eclipse_plugin/src/com/palantir/javaformat/java/PalantirJavaFormatter.java‎

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

0 commit comments

Comments
 (0)