This repository has been archived by the owner on Oct 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0173530
commit 21a3a3b
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/GwtIdeaPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Copyright (C) 2013 Steffen Schaefer | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.richsource.gradle.plugins.gwt; | ||
|
||
import org.gradle.api.Action; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.Configuration; | ||
import org.gradle.api.logging.Logger; | ||
import org.gradle.api.logging.Logging; | ||
import org.gradle.plugins.ide.eclipse.EclipsePlugin; | ||
import org.gradle.plugins.ide.eclipse.model.EclipseModel; | ||
import org.gradle.plugins.ide.idea.IdeaPlugin; | ||
import org.gradle.plugins.ide.idea.model.IdeaModel; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* This "plugin" improves the IntelliJ IDEA integration by adding | ||
* the gwt dependencies to the project. | ||
* | ||
* idea { | ||
* module { | ||
* scopes.PROVIDED.plus += configurations.gwtSdk | ||
* scopes.PROVIDED.plus += configurations.gwt | ||
* } | ||
* } | ||
*/ | ||
public class GwtIdeaPlugin { | ||
|
||
private static final String SCOPE_PROVIDED = "PROVIDED"; | ||
private static final String KEY_PLUS = "plus"; | ||
|
||
public void apply(final Project project, final GwtBasePlugin gwtBasePlugin) { | ||
project.getPlugins().apply(IdeaPlugin.class); | ||
|
||
project.afterEvaluate(new Action<Project>() { | ||
@Override | ||
public void execute(final Project project) { | ||
IdeaModel ideaModel = project.getExtensions().getByType(IdeaModel.class); | ||
Collection<Configuration> configurations = | ||
ideaModel.getModule().getScopes().get(SCOPE_PROVIDED).get(KEY_PLUS); | ||
|
||
Configuration gwtSdkConfiguration = gwtBasePlugin.getGwtSdkConfiguration(); | ||
Configuration gwtConfiguration = gwtBasePlugin.getGwtConfiguration(); | ||
|
||
configurations.add(gwtSdkConfiguration); | ||
configurations.add(gwtConfiguration); | ||
} | ||
}); | ||
} | ||
} |