Skip to content

Commit

Permalink
Support applying canonical set of project settings
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis committed Jan 25, 2018
1 parent abe8246 commit d4051d1
Show file tree
Hide file tree
Showing 71 changed files with 24,739 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ target/
generated-sources/
.metadata/
**/.*.swp
eclipse/.settings
plugins/.settings
features/.settings
third_party/.settings
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Maven for building Eclipse bundles and features.
2. The [m2e connector for maven-dependency-plugin](https://github.com/ianbrandt/m2e-maven-dependency-plugin)
should be installed from `http://ianbrandt.github.io/m2e-maven-dependency-plugin/`.

3. Download and add the [Google Java Format plugin for Eclipse](https://github.com/google/google-java-format/releases/)
and place the jar into your Eclipse installation's `dropins/` directory
(on MacOS this may be in `Eclipse.app/Contents/Eclipse/dropins/`).

1. Maven 3.5.0 or later. Although m2eclipse is bundled with its own Maven install,
Maven is necessary to test command-line builds.

Expand Down Expand Up @@ -291,6 +295,12 @@ the identifiers are not p2 identifiers, and so features do not
require the `.feature.group` suffix.


## Other Miscellaneous Dev Tasks

### Updating IDE settings

See [`eclipse/settings/`](eclipse/settings/README.md) for details.

### Configuring Maven/Tycho Toolchains for CI Builds

_Note: this section is only relevant for configuring CI builds_
Expand Down
77 changes: 77 additions & 0 deletions eclipse/settings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Project Settings for Eclipse

This project contains the canonical set of Eclipse `.settings/`
files for Cloud Tools for Eclipse. These settings configure Eclipse
to use the [Google Style for Java][google-style-java].

The settings currently reflect the following choices:

- uses the [Google Java Format plugin for Eclipse](google-java-format),
which requires Eclipse Oxygen (4.7) or later.
- unnecessary declared exceptions on methods are _errors_
- switch missing default case are _warnings_
- resource leaks are _errors_
- potential resource leaks are _warnings_
- serializable classes without `serialVersionUID` are _ignored_
- redundant generic type argument are _errors_

## Updating the Settings

The settings require installing the [Google Java Format plugin for
Eclipse][google-java-format]. Installing the format plugin requires
downloading the [latest release][google-java-format-release] (named
`google-java-format-eclipse-plugin_XXXX.jar`)and placing the jar
in your Eclipse installation's `dropins/` directory (on MacOS, in
`Eclipse.app/Content/Eclipse/dropins/`).

Updating and applying the settings files is a two-step process based
around the [`eclipse-settings-maven-plugin`][esmp] Maven plugin.

[esmp]: https://github.com/BSI-Business-Systems-Integration-AG/eclipse-settings-maven-plugin
[google-style-java]: https://google.github.io/styleguide/javaguide.html
[google-java-format]: https://github.com/google/google-java-format
[google-java-format-release]: https://github.com/google/google-java-format/releases

### Step 0: Change the Canonical Settings

To update the settings, change the settings for one project and
then copy in the changed files from its `.settings/` directory into
`files/`. Note that if a new file is added, the new file must be
reflected into the `eclipse-settings-maven-plugin`'s configuration
(defined in `plugins/pom.xml`).

### Step 1: Publishing the Settings Files

This project (`eclipse/settings/`) publishes the settings files as
a Maven `jar` artifact. This published jar is then used by the
`eclipse-settings-maven-plugin` as the source for the settings files.
The settings files themselves are found in in this project under
[`files/`](files/).

To publish the settings, run the following to assemble the jar and
install it in your local repository (`~/.m2/repository/`)

```sh
$ cd eclipse/settings
$ mvn install
```

### Step 2: Applying the Settings

Once the settings are available, the second step invokes the
`eclipse-settings-maven-plugin`'s `eclipse-settings` goal to resolve
the settings artifact and extract the contents to the appropriate
locations. Run the following:

```
$ cd plugins
$ mvn --no-snapshot-updates -Dtycho.mode=maven eclipse-settings:eclipse-settings
```

The `--no-snapshot-updates` is required to resolve the settings
artifact from the local repository. The `-Dtycho.mode=maven` speeds
up the process.

### Step 3: Commit

You should then commit the result.
2 changes: 2 additions & 0 deletions eclipse/settings/files/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
2 changes: 2 additions & 0 deletions eclipse/settings/files/org.eclipse.core.runtime.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
456 changes: 456 additions & 0 deletions eclipse/settings/files/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions eclipse/settings/files/org.eclipse.jdt.launching.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
70 changes: 70 additions & 0 deletions eclipse/settings/files/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=false
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=false
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=true
cleanup.use_this_for_non_static_field_access=false
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_GoogleStyle Clean Up Actions
cleanup_settings_version=2
eclipse.preferences.version=1
formatter_settings_version=13
org.eclipse.jdt.ui.exception.name=ex
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.ignorelowercasenames=false
org.eclipse.jdt.ui.importorder=\#;;
org.eclipse.jdt.ui.javadoc=true
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.overrideannotation=true
org.eclipse.jdt.ui.staticondemandthreshold=99
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * Returns the [[${bare_field_name}]].\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright ${year} Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">\n</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
4 changes: 4 additions & 0 deletions eclipse/settings/files/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
8 changes: 8 additions & 0 deletions eclipse/settings/files/org.eclipse.pde.ds.annotations.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
classpath=true
dsVersion=V1_3
eclipse.preferences.version=1
enabled=true
generateBundleActivationPolicyLazy=true
path=OSGI-INF
validationErrorLevel=error
validationErrorLevel.missingImplicitUnbindMethod=error
34 changes: 34 additions & 0 deletions eclipse/settings/files/org.eclipse.pde.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
compilers.f.unresolved-features=1
compilers.f.unresolved-plugins=1
compilers.incompatible-environment=1
compilers.p.build=1
compilers.p.build.bin.includes=1
compilers.p.build.encodings=2
compilers.p.build.java.compiler=2
compilers.p.build.java.compliance=1
compilers.p.build.missing.output=2
compilers.p.build.output.library=1
compilers.p.build.source.library=1
compilers.p.build.src.includes=1
compilers.p.deprecated=1
compilers.p.discouraged-class=1
compilers.p.internal=1
compilers.p.missing-packages=2
compilers.p.missing-version-export-package=2
compilers.p.missing-version-import-package=2
compilers.p.missing-version-require-bundle=2
compilers.p.no-required-att=0
compilers.p.no.automatic.module=2
compilers.p.not-externalized-att=1
compilers.p.service.component.without.lazyactivation=1
compilers.p.unknown-attribute=1
compilers.p.unknown-class=0
compilers.p.unknown-element=1
compilers.p.unknown-identifier=1
compilers.p.unknown-resource=0
compilers.p.unresolved-ex-points=0
compilers.p.unresolved-import=0
compilers.s.create-docs=false
compilers.s.doc-folder=doc
compilers.s.open-tags=1
eclipse.preferences.version=1
65 changes: 65 additions & 0 deletions eclipse/settings/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<!-- this is a standalone project -->
<groupId>com.google.cloud.tools.eclipse</groupId>
<artifactId>eclipse-settings</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>package</defaultGoal>
<resources>
<resource>
<directory>files</directory>
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<versionRange>[2.6,)</versionRange>
<goals>
<goal>jar</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Loading

0 comments on commit d4051d1

Please sign in to comment.