Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Revert "Remove annotation processor dependencies from IDEA scopes (#1… (
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoenig10 committed Mar 9, 2020
1 parent a7508bb commit da7971b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
7 changes: 7 additions & 0 deletions changelog/@unreleased/pr-165.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: fix
fix:
description: Annotation processor dependencies are no longer explicitly removed
from IDEA scopes. As of Gradle 6.3, annotation processor dependencies are no longer
added to IDEA scopes by the IDEA plugin.
links:
- https://github.com/palantir/gradle-processors/pull/165
14 changes: 0 additions & 14 deletions src/main/groovy/org/inferred/gradle/ProcessorsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import org.gradle.plugins.ide.eclipse.EclipsePlugin
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.gradle.plugins.ide.idea.model.IdeaModule
import org.gradle.plugins.ide.idea.model.internal.GeneratedIdeaScope
import org.gradle.plugins.ide.idea.model.internal.IdeaDependenciesProvider
import org.gradle.util.GradleVersion

class ProcessorsPlugin implements Plugin<Project> {
Expand Down Expand Up @@ -161,18 +159,6 @@ class ProcessorsPlugin implements Plugin<Project> {
addGeneratedSourceFolder(project, { getIdeaSourceTestOutputDir(project) }, true)
}

// We need to remove the configurations from the plus configurations.
// If we instead added the configurations from the minus configurations, then that would remove dependencies that
// are shared with other configurations in the plus configurations.
idea.module.scopes
.get(GeneratedIdeaScope.PROVIDED.name())
.get(IdeaDependenciesProvider.SCOPE_PLUS)
.remove(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME)
idea.module.scopes
.get(GeneratedIdeaScope.TEST.name())
.get(IdeaDependenciesProvider.SCOPE_PLUS)
.remove(JavaPlugin.TEST_ANNOTATION_PROCESSOR_CONFIGURATION_NAME)

// Root project configuration
def rootModel = project.rootProject.extensions.findByType(IdeaModel)
if (rootModel != null && rootModel.project != null) {
Expand Down
11 changes: 0 additions & 11 deletions src/test/groovy/org/inferred/gradle/ProcessorsPluginTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,4 @@ class ProcessorsPluginTest {
assertTrue project.idea.module.testSourceDirs.contains(project.file('generated_testSrc'))
assertTrue project.idea.module.generatedSourceDirs.contains(project.file('generated_testSrc'))
}

@Test
void configuredIdeaScopes() {
Project project = ProjectBuilder.builder().build()
project.pluginManager.apply 'org.inferred.processors'
project.pluginManager.apply 'java'
project.pluginManager.apply 'idea'

assertFalse project.idea.module.scopes.PROVIDED.plus.contains(project.configurations['annotationProcessor'])
assertFalse project.idea.module.scopes.TEST.plus.contains(project.configurations['testAnnotationProcessor'])
}
}

0 comments on commit da7971b

Please sign in to comment.