Skip to content

Commit 39a5f30

Browse files
fvghnedtwigg
authored andcommitted
Spotless Eclipse Framework Final (#261)
* Common Spotless Eclipse Framework which can be used by most Spotless Eclipse based formatters. * Added usage information for fat JARs. * Make developers in common java-publish.gradle configurable. * Enhanced framework interfaces. Eclipse core uses plugins not derived from Plugin but BundleActivator. Provided possibility to configure global preferences. Usage of Consumer allows the user to get rid of statics. * Refactored directory structure as discussed in #234 * Refactored directory structure as discussed in #234 * Adpated package names according to previous commit. Applied fixes as requested in #234. Refactored artifact name and version as discussed in #226. * Moved LINE_DELIMITER to SpotlessEclipseFramework * Enhanced error report in case OSGI bundle creation fails. This improves the development of Eclipse formatters. * Applied review proposals. Enhanced BundleController by creating separate class for SimpleBundel (previously called SystemBundle). Added support for plugins offering headless builds. * Allow configuration of snapshot repository for upload. * Added Gradle dependency lock support. Applied changes requested by review (@JLLeitschuh). * Changed "unchecked" warning suppression for Java 10 compliance. * Replaced JavaDoc @see with @code to avoid warnings when referring to implementations in dependencies. * Added missing method implementation (org.eclipse.osgi update from 3.12 to 3.13) * Fixed bintray usage. Plugin-ID for bintray does not work within script (see #1262). Removed model space to allow local publishing of releases. * Finalized version 3.0.0
1 parent 7cdfcb4 commit 39a5f30

File tree

6 files changed

+63
-47
lines changed

6 files changed

+63
-47
lines changed

_ext/eclipse-base/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Mayor version correspond to the required Eclipse core version.
22
# Minor version changes in case the minimum Eclipse core dependencies are raised due to incompatibilities of their internal interfaces.
33
# Patch version is incremented in case of bug-fixes and evolutions.
4-
ext_version=3.0.0-SNAPSHOT
4+
ext_version=3.0.0
55
ext_artifactId=spotless-eclipse-base
66
ext_description=Eclipse bundle controller and services for Spotless
77

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/SpotlessEclipseCoreConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Hence they do not require a registration, which allows a lightweight
2929
* setup.
3030
* </p>
31-
* @see org.eclipse.core.internal.runtime.PlatformActivator
31+
* See {@code org.eclipse.core.internal.runtime.PlatformActivator} implementation for details.
3232
*/
3333
public class SpotlessEclipseCoreConfig extends BundleConfig<SpotlessEclipseFramework.DefaultBundles> {
3434

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/SpotlessEclipseFramework.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public enum DefaultPlugins {
105105
* The resources plugin initialized the Eclipse workspace and allows URL look-up.
106106
* Most formatters using the workspace to resolve URLs or create
107107
* file interfaces.
108-
* @see org.eclipse.core.resources.IFile
108+
* See {@code org.eclipse.core.resources.IFile} implementation for details.
109109
*/
110110
RESOURCES(org.eclipse.core.resources.ResourcesPlugin.class);
111111

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleConfig.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public void add(T bundle) {
7676
}
7777

7878
/** Add a set of default bundles with their default states */
79-
public void add(@SuppressWarnings("unchecked") T... bundles) {
79+
@SuppressWarnings("unchecked")
80+
public void add(T... bundles) {
8081
Arrays.asList(bundles).forEach(bundle -> add(bundle));
8182
}
8283

_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/ServiceCollection.java

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Collection;
1919
import java.util.Dictionary;
2020
import java.util.HashMap;
21+
import java.util.Hashtable;
2122
import java.util.Map;
2223
import java.util.Optional;
2324

@@ -142,6 +143,11 @@ public int compareTo(Object reference) {
142143
return (this == reference) ? 0 : 1;
143144
}
144145

146+
@Override
147+
public Dictionary<String, Object> getProperties() {
148+
return new Hashtable<String, Object>(properties);
149+
}
150+
145151
}
146152

147153
/**

_ext/gradle/java-publish.gradle

+52-43
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
7+
}
8+
}
9+
10+
apply plugin: com.jfrog.bintray.gradle.BintrayPlugin
111
apply plugin: 'maven-publish'
212

313
task sourcesJar(type: Jar) {
@@ -22,60 +32,59 @@ def lookup = { key, defaultVal ->
2232
}
2333
}
2434

25-
model {
26-
publishing {
27-
publications {
28-
mavenJava(MavenPublication) {
35+
publishing {
36+
publications {
37+
mavenJava(MavenPublication) {
2938

30-
groupId project.ext_group
31-
artifactId project.ext_artifactId
32-
version project.ext_version
33-
from components.java
39+
groupId project.ext_group
40+
artifactId project.ext_artifactId
41+
version project.ext_version
42+
from components.java
3443

35-
pom.withXml {
44+
pom.withXml {
3645

37-
// add MavenCentral requirements to the POM
38-
asNode().children().last() + {
39-
resolveStrategy = Closure.DELEGATE_FIRST
40-
name project.ext_artifactId
41-
description project.ext_description
46+
// add MavenCentral requirements to the POM
47+
asNode().children().last() + {
48+
resolveStrategy = Closure.DELEGATE_FIRST
49+
name project.ext_artifactId
50+
description project.ext_description
51+
url "https://github.com/${project.ext_org}/${project.name}"
52+
scm {
4253
url "https://github.com/${project.ext_org}/${project.name}"
43-
scm {
44-
url "https://github.com/${project.ext_org}/${project.name}"
45-
connection "scm:git:git://github.com/${project.ext_org}/${project.name}"
46-
developerConnection "scm:git:ssh:[email protected]/${project.ext_org}/${project.name}"
47-
}
48-
licenses {
49-
license {
50-
name 'Eclipse Public License - v 1.0'
51-
url 'https://www.eclipse.org/legal/epl-v10.html'
52-
distribution 'repo'
53-
}
54+
connection "scm:git:git://github.com/${project.ext_org}/${project.name}"
55+
developerConnection "scm:git:ssh:[email protected]/${project.ext_org}/${project.name}"
56+
}
57+
licenses {
58+
license {
59+
name 'Eclipse Public License - v 1.0'
60+
url 'https://www.eclipse.org/legal/epl-v10.html'
61+
distribution 'repo'
5462
}
55-
developers {
56-
project.ext.developers.each { extId, extValues ->
57-
developer {
58-
id extId
59-
name extValues['name']
60-
email extValues['email']
61-
}
63+
}
64+
developers {
65+
project.ext.developers.each { extId, extValues ->
66+
developer {
67+
id extId
68+
name extValues['name']
69+
email extValues['email']
6270
}
6371
}
6472
}
6573
}
6674
}
6775
}
68-
if (isSnapshot) {
69-
// upload snapshots to oss.sonatype.org
70-
repositories {
71-
maven {
72-
url = lookup('snapshot_url', 'https://oss.sonatype.org/content/repositories/snapshots')
73-
credentials {
74-
username = lookup('nexus_user', 'unknown_nexus_user')
75-
password = lookup('nexus_pass', 'unknown_nexus_pass')
76-
}
77-
} }
78-
}
76+
}
77+
if (isSnapshot) {
78+
// upload snapshots to oss.sonatype.org
79+
repositories {
80+
maven {
81+
url = lookup('snapshot_url', 'https://oss.sonatype.org/content/repositories/snapshots')
82+
credentials {
83+
username = lookup('nexus_user', 'unknown_nexus_user')
84+
password = lookup('nexus_pass', 'unknown_nexus_pass')
85+
}
86+
}
87+
}
7988
}
8089
}
8190

0 commit comments

Comments
 (0)