Skip to content

Commit

Permalink
Spotless Eclipse Framework Final (#261)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fvgh authored and nedtwigg committed Jul 18, 2018
1 parent 7cdfcb4 commit 39a5f30
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 47 deletions.
2 changes: 1 addition & 1 deletion _ext/eclipse-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mayor version correspond to the required Eclipse core version.
# Minor version changes in case the minimum Eclipse core dependencies are raised due to incompatibilities of their internal interfaces.
# Patch version is incremented in case of bug-fixes and evolutions.
ext_version=3.0.0-SNAPSHOT
ext_version=3.0.0
ext_artifactId=spotless-eclipse-base
ext_description=Eclipse bundle controller and services for Spotless

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Hence they do not require a registration, which allows a lightweight
* setup.
* </p>
* @see org.eclipse.core.internal.runtime.PlatformActivator
* See {@code org.eclipse.core.internal.runtime.PlatformActivator} implementation for details.
*/
public class SpotlessEclipseCoreConfig extends BundleConfig<SpotlessEclipseFramework.DefaultBundles> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public enum DefaultPlugins {
* The resources plugin initialized the Eclipse workspace and allows URL look-up.
* Most formatters using the workspace to resolve URLs or create
* file interfaces.
* @see org.eclipse.core.resources.IFile
* See {@code org.eclipse.core.resources.IFile} implementation for details.
*/
RESOURCES(org.eclipse.core.resources.ResourcesPlugin.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void add(T bundle) {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Collection;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Optional;

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

@Override
public Dictionary<String, Object> getProperties() {
return new Hashtable<String, Object>(properties);
}

}

/**
Expand Down
95 changes: 52 additions & 43 deletions _ext/gradle/java-publish.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}

apply plugin: com.jfrog.bintray.gradle.BintrayPlugin
apply plugin: 'maven-publish'

task sourcesJar(type: Jar) {
Expand All @@ -22,60 +32,59 @@ def lookup = { key, defaultVal ->
}
}

model {
publishing {
publications {
mavenJava(MavenPublication) {
publishing {
publications {
mavenJava(MavenPublication) {

groupId project.ext_group
artifactId project.ext_artifactId
version project.ext_version
from components.java
groupId project.ext_group
artifactId project.ext_artifactId
version project.ext_version
from components.java

pom.withXml {
pom.withXml {

// add MavenCentral requirements to the POM
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.ext_artifactId
description project.ext_description
// add MavenCentral requirements to the POM
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.ext_artifactId
description project.ext_description
url "https://github.com/${project.ext_org}/${project.name}"
scm {
url "https://github.com/${project.ext_org}/${project.name}"
scm {
url "https://github.com/${project.ext_org}/${project.name}"
connection "scm:git:git://github.com/${project.ext_org}/${project.name}"
developerConnection "scm:git:ssh:git@github.com/${project.ext_org}/${project.name}"
}
licenses {
license {
name 'Eclipse Public License - v 1.0'
url 'https://www.eclipse.org/legal/epl-v10.html'
distribution 'repo'
}
connection "scm:git:git://github.com/${project.ext_org}/${project.name}"
developerConnection "scm:git:ssh:git@github.com/${project.ext_org}/${project.name}"
}
licenses {
license {
name 'Eclipse Public License - v 1.0'
url 'https://www.eclipse.org/legal/epl-v10.html'
distribution 'repo'
}
developers {
project.ext.developers.each { extId, extValues ->
developer {
id extId
name extValues['name']
email extValues['email']
}
}
developers {
project.ext.developers.each { extId, extValues ->
developer {
id extId
name extValues['name']
email extValues['email']
}
}
}
}
}
}
if (isSnapshot) {
// upload snapshots to oss.sonatype.org
repositories {
maven {
url = lookup('snapshot_url', 'https://oss.sonatype.org/content/repositories/snapshots')
credentials {
username = lookup('nexus_user', 'unknown_nexus_user')
password = lookup('nexus_pass', 'unknown_nexus_pass')
}
} }
}
}
if (isSnapshot) {
// upload snapshots to oss.sonatype.org
repositories {
maven {
url = lookup('snapshot_url', 'https://oss.sonatype.org/content/repositories/snapshots')
credentials {
username = lookup('nexus_user', 'unknown_nexus_user')
password = lookup('nexus_pass', 'unknown_nexus_pass')
}
}
}
}
}

Expand Down

0 comments on commit 39a5f30

Please sign in to comment.