Skip to content

Commit 760a13c

Browse files
sormurascushon
authored andcommitted
Eclipse plugin (#118)
TODO: - declare maven dependency in plugin module (using manual copy for now) - publish packaged jar (copy google-java-format-eclipse-plugin-0.0.1.jar to your Eclipse dropins folder) - support other (older/newer) Eclipse versions - documentation #52 #52 (comment)
1 parent 4ae067a commit 760a13c

File tree

12 files changed

+354
-0
lines changed

12 files changed

+354
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
.classpath
66
.project
7+
.factorypath
78
.settings/
9+
.apt_generated/
810

911
target/
1012

core/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,51 @@
147147
</archive>
148148
</configuration>
149149
</plugin>
150+
<plugin>
151+
<artifactId>maven-resources-plugin</artifactId>
152+
<version>3.0.1</version>
153+
<executions>
154+
<execution>
155+
<id>copy-resources</id>
156+
<phase>package</phase>
157+
<goals>
158+
<goal>copy-resources</goal>
159+
</goals>
160+
<configuration>
161+
<outputDirectory>../eclipse_plugin/lib</outputDirectory>
162+
<resources>
163+
<resource>
164+
<directory>target</directory>
165+
<include>${project.artifactId}-${project.version}.jar</include>
166+
</resource>
167+
</resources>
168+
</configuration>
169+
</execution>
170+
</executions>
171+
</plugin>
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-dependency-plugin</artifactId>
175+
<version>2.10</version>
176+
<executions>
177+
<execution>
178+
<id>copy-dependencies</id>
179+
<phase>package</phase>
180+
<goals>
181+
<goal>copy-dependencies</goal>
182+
</goals>
183+
<configuration>
184+
<outputDirectory>../eclipse_plugin/lib</outputDirectory>
185+
<overWriteReleases>true</overWriteReleases>
186+
<overWriteSnapshots>true</overWriteSnapshots>
187+
<excludeTransitive>true</excludeTransitive>
188+
<excludeArtifactIds>org.eclipse.jdt.core</excludeArtifactIds>
189+
<excludeScope>compile</excludeScope>
190+
<excludeScope>provided</excludeScope>
191+
</configuration>
192+
</execution>
193+
</executions>
194+
</plugin>
150195
</plugins>
151196
</build>
152197
</project>

eclipse_plugin/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry exported="true" kind="lib" path="lib/guava-19.0.jar"/>
7+
<classpathentry exported="true" kind="lib" path="lib/google-java-format-1.3-SNAPSHOT.jar"/>
8+
<classpathentry exported="true" kind="lib" path="lib/javac-9-dev-r3297-1-shaded.jar"/>
9+
<classpathentry kind="output" path="target/classes"/>
10+
</classpath>

eclipse_plugin/.project

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>google-java-format-eclipse</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.m2e.core.maven2Builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
31+
<nature>org.eclipse.pde.PluginNature</nature>
32+
<nature>org.eclipse.jdt.core.javanature</nature>
33+
</natures>
34+
</projectDescription>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Google Java Formatter
4+
Bundle-SymbolicName: google-java-format-eclipse-plugin;singleton:=true
5+
Bundle-Version: 0.0.1
6+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
7+
Require-Bundle: org.eclipse.jdt.core;bundle-version="3.10.0",
8+
org.eclipse.jface,
9+
org.eclipse.text,
10+
org.eclipse.ui,
11+
org.eclipse.equinox.common
12+
Bundle-ClassPath: .,
13+
lib/guava-19.0.jar,
14+
lib/javac-9-dev-r3297-1-shaded.jar,
15+
lib/google-java-format-1.3-SNAPSHOT.jar

eclipse_plugin/build.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source.. = src/
2+
output.. = target/classes
3+
bin.includes = META-INF/,\
4+
.,\
5+
plugin.xml,\
6+
lib/google-java-format-1.3-SNAPSHOT.jar,\
7+
lib/javac-9-dev-r3297-1-shaded.jar,\
8+
lib/guava-19.0.jar

eclipse_plugin/lib/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

eclipse_plugin/plugin.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
<extension point="org.eclipse.jdt.core.javaFormatter">
5+
<javaFormatter
6+
class="com.google.googlejavaformat.java.GoogleJavaFormatter"
7+
id="com.google.googlejavaformat.java.GoogleJavaFormatter"
8+
name="Google Java Formatter (1.3-SNAPSHOT)">
9+
</javaFormatter>
10+
</extension>
11+
</plugin>

eclipse_plugin/pom.xml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!--
2+
~ Copyright 2015 Google Inc.
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>com.google.googlejavaformat</groupId>
22+
<artifactId>google-java-format-parent</artifactId>
23+
<version>1.3-SNAPSHOT</version>
24+
</parent>
25+
26+
<artifactId>google-java-format-eclipse-plugin</artifactId>
27+
<version>0.0.1</version>
28+
<packaging>eclipse-plugin</packaging>
29+
<name>Google Java Format Plugin for Eclipse 4.5+</name>
30+
31+
<description>
32+
A Java source code formatter that follows Google Java Style.
33+
</description>
34+
35+
<properties>
36+
<tycho-version>0.26.0</tycho-version>
37+
</properties>
38+
39+
<repositories>
40+
<repository>
41+
<id>mars</id>
42+
<layout>p2</layout>
43+
<url>http://download.eclipse.org/releases/mars</url>
44+
</repository>
45+
</repositories>
46+
47+
<dependencies>
48+
<dependency>
49+
<groupId>com.google.googlejavaformat</groupId>
50+
<artifactId>google-java-format</artifactId>
51+
<version>1.3-SNAPSHOT</version>
52+
</dependency>
53+
</dependencies>
54+
55+
<build>
56+
<plugins>
57+
58+
<plugin>
59+
<groupId>org.eclipse.tycho</groupId>
60+
<artifactId>tycho-maven-plugin</artifactId>
61+
<version>${tycho-version}</version>
62+
<extensions>true</extensions>
63+
</plugin>
64+
65+
<plugin>
66+
<groupId>org.eclipse.tycho</groupId>
67+
<artifactId>target-platform-configuration</artifactId>
68+
<version>${tycho-version}</version>
69+
<configuration>
70+
<environments>
71+
<environment>
72+
<os>linux</os>
73+
<ws>gtk</ws>
74+
<arch>x86</arch>
75+
</environment>
76+
<environment>
77+
<os>linux</os>
78+
<ws>gtk</ws>
79+
<arch>x86_64</arch>
80+
</environment>
81+
<environment>
82+
<os>win32</os>
83+
<ws>win32</ws>
84+
<arch>x86</arch>
85+
</environment>
86+
<environment>
87+
<os>win32</os>
88+
<ws>win32</ws>
89+
<arch>x86_64</arch>
90+
</environment>
91+
<environment>
92+
<os>macosx</os>
93+
<ws>cocoa</ws>
94+
<arch>x86_64</arch>
95+
</environment>
96+
</environments>
97+
</configuration>
98+
</plugin>
99+
100+
</plugins>
101+
</build>
102+
103+
</project>

0 commit comments

Comments
 (0)