| 1 |
/* |
| 2 |
* Copyright 2002-2014 the original author or authors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package org.springframework.build.gradle.propdep |
| 18 |
|
| 19 |
import org.gradle.api.* |
| 20 |
import org.gradle.plugins.ide.idea.IdeaPlugin |
| 21 |
|
| 22 |
/** |
| 23 |
* Plugin to allow optional and provided dependency configurations to work with the |
| 24 |
* standard gradle 'idea' plugin |
| 25 |
* |
| 26 |
* @author Phillip Webb |
| 27 |
* @author Brian Clozel |
| 28 |
* @link http://youtrack.jetbrains.com/issue/IDEA-107046 |
| 29 |
* @link http://youtrack.jetbrains.com/issue/IDEA-117668 |
| 30 |
*/ |
| 31 |
class PropDepsIdeaPlugin implements Plugin<Project> { |
| 32 |
|
| 33 |
public void apply(Project project) { |
| 34 |
project.plugins.apply(PropDepsPlugin) |
| 35 |
project.plugins.apply(IdeaPlugin) |
| 36 |
project.idea.module { |
| 37 |
// IDEA internally deals with 4 scopes : COMPILE, TEST, PROVIDED, RUNTIME |
| 38 |
// but only PROVIDED seems to be picked up |
| 39 |
scopes.PROVIDED.plus += [project.configurations.provided] |
| 40 |
scopes.PROVIDED.plus += [project.configurations.optional] |
| 41 |
} |
| 42 |
} |
| 43 |
} |