Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable annotation processing in eclipse by default #2076

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
}

dependencies {
classpath 'com.diffplug.gradle:goomph:3.32.1'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.10.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.7.0'
classpath 'com.gradle.publish:plugin-publish-plugin:0.20.0'
Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-2076.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: enable annotation processing in eclipse by default
links:
- https://github.com/palantir/gradle-baseline/pull/2076
142 changes: 142 additions & 0 deletions gradle-baseline-java/baseline-class-uniqueness.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Danger! Multiple jars contain identically named classes. This may cause different behaviour depending on classpath ordering.
# Run ./gradlew checkClassUniqueness --write-locks to update this file

## runtimeClasspath
[org.eclipse.platform:org.eclipse.osgi, org.osgi:org.osgi.dto]
- org.osgi.dto.DTO
- org.osgi.dto.package-info
[org.eclipse.platform:org.eclipse.osgi, org.osgi:org.osgi.framework]
- org.osgi.framework.AdaptPermission
- org.osgi.framework.AdaptPermission$1
- org.osgi.framework.AdaptPermissionCollection
- org.osgi.framework.AdminPermission
- org.osgi.framework.AdminPermission$1
- org.osgi.framework.AdminPermissionCollection
- org.osgi.framework.AllServiceListener
- org.osgi.framework.Bundle
- org.osgi.framework.BundleActivator
- org.osgi.framework.BundleContext
- org.osgi.framework.BundleEvent
- org.osgi.framework.BundleException
- org.osgi.framework.BundleListener
- org.osgi.framework.BundlePermission
- org.osgi.framework.BundlePermissionCollection
- org.osgi.framework.BundleReference
- org.osgi.framework.CapabilityPermission
- org.osgi.framework.CapabilityPermission$1
- org.osgi.framework.CapabilityPermission$Properties
- org.osgi.framework.CapabilityPermissionCollection
- org.osgi.framework.Configurable
- org.osgi.framework.Constants
- org.osgi.framework.Filter
- org.osgi.framework.FrameworkEvent
- org.osgi.framework.FrameworkListener
- org.osgi.framework.FrameworkUtil
- org.osgi.framework.FrameworkUtil$1
- org.osgi.framework.FrameworkUtil$DNChainMatching
- org.osgi.framework.InvalidSyntaxException
- org.osgi.framework.PackagePermission
- org.osgi.framework.PackagePermission$1
- org.osgi.framework.PackagePermissionCollection
- org.osgi.framework.PrototypeServiceFactory
- org.osgi.framework.ServiceEvent
- org.osgi.framework.ServiceException
- org.osgi.framework.ServiceFactory
- org.osgi.framework.ServiceListener
- org.osgi.framework.ServiceObjects
- org.osgi.framework.ServicePermission
- org.osgi.framework.ServicePermission$1
- org.osgi.framework.ServicePermission$Properties
- org.osgi.framework.ServicePermission$Properties$Entry
- org.osgi.framework.ServicePermissionCollection
- org.osgi.framework.ServiceReference
- org.osgi.framework.ServiceRegistration
- org.osgi.framework.SignerProperty
- org.osgi.framework.SynchronousBundleListener
- org.osgi.framework.UnfilteredServiceListener
- org.osgi.framework.Version
- org.osgi.framework.VersionRange
- org.osgi.framework.dto.BundleDTO
- org.osgi.framework.dto.FrameworkDTO
- org.osgi.framework.dto.ServiceReferenceDTO
- org.osgi.framework.dto.package-info
- org.osgi.framework.hooks.bundle.CollisionHook
- org.osgi.framework.hooks.bundle.EventHook
- org.osgi.framework.hooks.bundle.FindHook
- org.osgi.framework.hooks.bundle.package-info
- org.osgi.framework.hooks.resolver.ResolverHook
- org.osgi.framework.hooks.resolver.ResolverHookFactory
- org.osgi.framework.hooks.resolver.package-info
- org.osgi.framework.hooks.service.EventHook
- org.osgi.framework.hooks.service.EventListenerHook
- org.osgi.framework.hooks.service.FindHook
- org.osgi.framework.hooks.service.ListenerHook
- org.osgi.framework.hooks.service.ListenerHook$ListenerInfo
- org.osgi.framework.hooks.service.package-info
- org.osgi.framework.hooks.weaving.WeavingException
- org.osgi.framework.hooks.weaving.WeavingHook
- org.osgi.framework.hooks.weaving.WovenClass
- org.osgi.framework.hooks.weaving.WovenClassListener
- org.osgi.framework.hooks.weaving.package-info
- org.osgi.framework.launch.Framework
- org.osgi.framework.launch.FrameworkFactory
- org.osgi.framework.launch.package-info
- org.osgi.framework.namespace.AbstractWiringNamespace
- org.osgi.framework.namespace.BundleNamespace
- org.osgi.framework.namespace.ExecutionEnvironmentNamespace
- org.osgi.framework.namespace.HostNamespace
- org.osgi.framework.namespace.IdentityNamespace
- org.osgi.framework.namespace.NativeNamespace
- org.osgi.framework.namespace.PackageNamespace
- org.osgi.framework.namespace.package-info
- org.osgi.framework.package-info
- org.osgi.framework.startlevel.BundleStartLevel
- org.osgi.framework.startlevel.FrameworkStartLevel
- org.osgi.framework.startlevel.dto.BundleStartLevelDTO
- org.osgi.framework.startlevel.dto.FrameworkStartLevelDTO
- org.osgi.framework.startlevel.dto.package-info
- org.osgi.framework.startlevel.package-info
- org.osgi.framework.wiring.BundleCapability
- org.osgi.framework.wiring.BundleRequirement
- org.osgi.framework.wiring.BundleRevision
- org.osgi.framework.wiring.BundleRevisions
- org.osgi.framework.wiring.BundleWire
- org.osgi.framework.wiring.BundleWiring
- org.osgi.framework.wiring.FrameworkWiring
- org.osgi.framework.wiring.dto.BundleRevisionDTO
- org.osgi.framework.wiring.dto.BundleWireDTO
- org.osgi.framework.wiring.dto.BundleWiringDTO
- org.osgi.framework.wiring.dto.BundleWiringDTO$NodeDTO
- org.osgi.framework.wiring.dto.package-info
- org.osgi.framework.wiring.package-info
[org.eclipse.platform:org.eclipse.osgi, org.osgi:org.osgi.resource]
- org.osgi.resource.Capability
- org.osgi.resource.Namespace
- org.osgi.resource.Requirement
- org.osgi.resource.Resource
- org.osgi.resource.Wire
- org.osgi.resource.Wiring
- org.osgi.resource.dto.CapabilityDTO
- org.osgi.resource.dto.CapabilityRefDTO
- org.osgi.resource.dto.RequirementDTO
- org.osgi.resource.dto.RequirementRefDTO
- org.osgi.resource.dto.ResourceDTO
- org.osgi.resource.dto.WireDTO
- org.osgi.resource.dto.WiringDTO
- org.osgi.resource.dto.package-info
- org.osgi.resource.package-info
[org.eclipse.platform:org.eclipse.osgi, org.osgi:org.osgi.service.log]
- org.osgi.service.log.LogEntry
- org.osgi.service.log.LogListener
- org.osgi.service.log.LogReaderService
- org.osgi.service.log.LogService
[org.eclipse.platform:org.eclipse.osgi, org.osgi:org.osgi.util.tracker]
- org.osgi.util.tracker.AbstractTracked
- org.osgi.util.tracker.BundleTracker
- org.osgi.util.tracker.BundleTracker$Tracked
- org.osgi.util.tracker.BundleTrackerCustomizer
- org.osgi.util.tracker.ServiceTracker
- org.osgi.util.tracker.ServiceTracker$AllTracked
- org.osgi.util.tracker.ServiceTracker$Tracked
- org.osgi.util.tracker.ServiceTrackerCustomizer
- org.osgi.util.tracker.package-info
1 change: 1 addition & 0 deletions gradle-baseline-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {
// Add an explicit dependency to ensure consumers can use JDK14 source compat
implementation 'org.ow2.asm:asm'
implementation 'com.googlecode.java-diff-utils:diffutils'
implementation 'com.diffplug.gradle:goomph'

runtimeOnly 'com.palantir.javaformat:gradle-palantir-java-format'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package com.palantir.baseline.plugins
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
import org.gradle.plugins.ide.eclipse.EclipsePlugin
import org.gradle.plugins.ide.eclipse.model.ClasspathEntry
import org.gradle.plugins.ide.eclipse.model.SourceFolder

/**
* Configures the Gradle 'eclipse' task with Baseline settings.
Expand Down Expand Up @@ -65,12 +67,26 @@ class BaselineEclipse extends AbstractBaselinePlugin {
return sb.toString()
}

static void ignoreOptionalProblems(def entries, String pathParam, boolean isTest) {
ClasspathEntry entry = entries.find { it.path == pathParam }
if (entry instanceof SourceFolder) {
SourceFolder sf = (SourceFolder) entry
Map<String, Object> attributes = sf.getEntryAttributes()
attributes.put('ignore_optional_problems', 'true')
attributes.put('optional', 'true')
if (isTest) {
attributes.put('test', 'true')
}
}
}

void apply(Project project) {
this.project = project

// Configure Eclipse JDT Core by merging in Baseline settings.
project.plugins.withType(JavaPlugin, { plugin ->
project.plugins.apply EclipsePlugin
project.plugins.apply 'com.diffplug.eclipse.apt'
project.afterEvaluate {
project.eclipse {
if (jdt != null) {
Expand Down Expand Up @@ -137,6 +153,20 @@ class BaselineEclipse extends AbstractBaselinePlugin {
containers.add(eclipseClassPath)
}
}

project.eclipse.jdt.apt {
genSrcDir = "generated_src"
genTestSrcDir = "generated_testSrc"
}
project.eclipse.classpath?.file?.whenMerged {
ignoreOptionalProblems(entries, "generated_src", false)
ignoreOptionalProblems(entries, "generated_testSrc", true)
}
// entries are appended instead of replaced, so delete the file first
project.tasks.eclipseFactorypath.doFirst {
def factoryPath = project.file(".factorypath")
factoryPath.delete()
}
}
})
}
Expand Down
33 changes: 26 additions & 7 deletions versions.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Run ./gradlew --write-locks to regenerate this file
biz.aQute.bnd:biz.aQute.bnd.util:6.1.0 (1 constraints: ba0cc416)
biz.aQute.bnd:biz.aQute.bndlib:6.1.0 (1 constraints: be0b10ea)
classworlds:classworlds:1.1-alpha-2 (2 constraints: 6729b5ba)
com.diffplug.durian:durian-collect:1.2.0 (4 constraints: 4543fa9d)
com.diffplug.durian:durian-core:1.2.0 (5 constraints: 1e52d517)
com.diffplug.durian:durian-io:1.2.0 (2 constraints: 0b258ef3)
com.diffplug.spotless:spotless-lib:2.22.1 (3 constraints: 1537c170)
com.diffplug.durian:durian-collect:1.2.0 (5 constraints: fe4edc49)
com.diffplug.durian:durian-core:1.2.0 (6 constraints: d75d71cb)
com.diffplug.durian:durian-io:1.2.0 (3 constraints: c4300aa1)
com.diffplug.durian:durian-swt.os:3.5.0 (1 constraints: bf0b0dea)
com.diffplug.gradle:goomph:3.35.0 (1 constraints: 3d054c3b)
com.diffplug.spotless:spotless-lib:2.22.1 (4 constraints: ff42bda9)
com.diffplug.spotless:spotless-lib-extra:2.22.1 (2 constraints: 7225c836)
com.diffplug.spotless:spotless-plugin-gradle:6.2.1 (2 constraints: 08173b30)
com.github.ben-manes.caffeine:caffeine:3.0.5 (3 constraints: d934c115)
Expand Down Expand Up @@ -42,7 +46,9 @@ com.palantir.javaformat:palantir-java-format-spi:1.1.0 (2 constraints: 682782ed)
com.palantir.safe-logging:preconditions:1.21.0 (8 constraints: 997b62bd)
com.palantir.safe-logging:safe-logging:1.21.0 (11 constraints: 9daa3429)
com.palantir.tritium:tritium-registry:0.38.0 (3 constraints: 8f27854d)
commons-io:commons-io:2.11.0 (2 constraints: 5d26187e)
com.squareup.okhttp3:okhttp:4.3.1 (1 constraints: bf0b0dea)
com.squareup.okio:okio:2.4.3 (2 constraints: 10183f8e)
commons-io:commons-io:2.11.0 (3 constraints: bd31af1d)
commons-lang:commons-lang:2.6 (2 constraints: 4b1628e6)
io.dropwizard.metrics:metrics-core:4.1.2 (3 constraints: 7a32fe8b)
io.github.java-diff-utils:java-diff-utils:4.0 (2 constraints: 1c240b56)
Expand All @@ -69,17 +75,31 @@ org.codehaus.plexus:plexus-component-annotations:2.1.1 (2 constraints: 86269f8f)
org.codehaus.plexus:plexus-container-default:1.0-alpha-9 (5 constraints: 99554941)
org.codehaus.plexus:plexus-utils:1.5.1 (11 constraints: a5acf0d6)
org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r (4 constraints: 0655560f)
org.eclipse.platform:org.eclipse.osgi:3.15.0 (2 constraints: c724e4f0)
org.eclipse.platform:org.eclipse.osgi.compatibility.state:1.1.600 (1 constraints: 1f0c1a02)
org.hamcrest:hamcrest:2.2 (3 constraints: de29cb0a)
org.hamcrest:hamcrest-core:2.2 (5 constraints: c63ca3e1)
org.hamcrest:hamcrest-library:1.3 (2 constraints: 972508e1)
org.immutables:value:2.9.0 (6 constraints: a155c507)
org.inferred:freebuilder:1.14.6 (2 constraints: 6f17ec56)
org.jetbrains:annotations:19.0.0 (2 constraints: 441cf8cc)
org.jetbrains.kotlin:kotlin-stdlib:1.3.61 (2 constraints: 0617a55e)
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.61 (2 constraints: c5196a0d)
org.mockito:mockito-core:4.2.0 (6 constraints: 2754865d)
org.mockito:mockito-errorprone:4.2.0 (2 constraints: 0217572f)
org.objenesis:objenesis:3.2 (6 constraints: fa55f291)
org.osgi:org.osgi.dto:1.0.0 (1 constraints: b40ca816)
org.osgi:org.osgi.framework:1.8.0 (1 constraints: bc0cc016)
org.osgi:org.osgi.resource:1.0.0 (1 constraints: b40ca816)
org.osgi:org.osgi.service.log:1.3.0 (1 constraints: b70cb116)
org.osgi:org.osgi.service.repository:1.1.0 (1 constraints: b50cab16)
org.osgi:org.osgi.util.function:1.2.0 (2 constraints: f2193329)
org.osgi:org.osgi.util.promise:1.2.0 (1 constraints: b60cae16)
org.osgi:org.osgi.util.tracker:1.5.4 (1 constraints: bd0cbb16)
org.osgi:osgi.annotation:8.0.1 (3 constraints: 1e2894a6)
org.ow2.asm:asm:9.2 (5 constraints: 5f41ffd3)
org.pcollections:pcollections:2.1.2 (2 constraints: ec226a11)
org.slf4j:slf4j-api:1.7.36 (15 constraints: 8ae9b348)
org.slf4j:slf4j-api:1.7.36 (16 constraints: 7bf6de9d)

[Test dependencies]
cglib:cglib-nodep:3.3.0 (2 constraints: 7a1acf3c)
Expand Down Expand Up @@ -107,7 +127,6 @@ jakarta.xml.bind:jakarta.xml.bind-api:3.0.0 (1 constraints: bd069059)
junit:junit-dep:4.11 (1 constraints: ba1063b3)
net.lingala.zip4j:zip4j:1.3.2 (1 constraints: 0805fb35)
one.util:streamex:0.8.1 (1 constraints: 0b050436)
org.jetbrains:annotations:19.0.0 (1 constraints: 660d8f2c)
org.jooq:jooq:3.16.3 (1 constraints: 3f054a3b)
org.junit:junit-bom:5.8.2 (12 constraints: 6ac77fbf)
org.junit.jupiter:junit-jupiter:5.8.2 (2 constraints: 260e7a59)
Expand Down
1 change: 1 addition & 0 deletions versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ org.immutables:* = 2.8.8
org.ow2.asm:asm = 9.2
com.googlecode.java-diff-utils:diffutils = 1.3.0
com.puppycrawl.tools:checkstyle = 9.3
com.diffplug.gradle:goomph = 3.35.0

# test deps
com.fasterxml.jackson.*:* = 2.11.1
Expand Down