diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index 7fb588fc8c31..684faaa94a7d 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -207,7 +207,7 @@ libraryLicense(name: "maven-artifact", version: "3.0.3", libraryNames: ["maven-a libraryLicense(name: "maven-core", version: "3.0.3", libraryNames: ["maven-core-3.0.3.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html") libraryLicense(name: "plexus-component-annotations", version: "1.5.5", libraryNames: ["plexus-component-annotations-1.5.5.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html") libraryLicense(name: "Maven3", libraryNames: ["Maven3", "maven-dependency-tree-1.2.jar", "archetype-catalog-2.2.jar", "archetype-common-2.2.jar"], version: "3.0.3", license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html") -libraryLicense(name: "Gradle", version: "1.4", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license") +libraryLicense(name: "Gradle", version: "1.6", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license") libraryLicense(name: "Slf4j", version: "1.7.2", license: "MIT License", url: "http://slf4j.org/", licenseUrl: "http://slf4j.org/license.html") libraryLicense(name: "GradleGuava", version: "11.0.2", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0") libraryLicense(name: "Jsr305", version: "1.3.9", license: "New BSD", url: "http://code.google.com/p/jsr-305/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause") diff --git a/plugins/gradle/gradle.iml b/plugins/gradle/gradle.iml index 80f9ecc2c1d8..daa6aa3e8091 100644 --- a/plugins/gradle/gradle.iml +++ b/plugins/gradle/gradle.iml @@ -25,19 +25,231 @@ - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -47,7 +259,7 @@ - + diff --git a/plugins/gradle/lib/gradle-base-services-1.4.jar b/plugins/gradle/lib/gradle-base-services-1.6-20130404052254+0000.jar similarity index 66% rename from plugins/gradle/lib/gradle-base-services-1.4.jar rename to plugins/gradle/lib/gradle-base-services-1.6-20130404052254+0000.jar index b755f84af983..7fa1b67c1880 100644 Binary files a/plugins/gradle/lib/gradle-base-services-1.4.jar and b/plugins/gradle/lib/gradle-base-services-1.6-20130404052254+0000.jar differ diff --git a/plugins/gradle/lib/gradle-core-1.4.jar b/plugins/gradle/lib/gradle-core-1.6-20130404052254+0000.jar similarity index 66% rename from plugins/gradle/lib/gradle-core-1.4.jar rename to plugins/gradle/lib/gradle-core-1.6-20130404052254+0000.jar index 7df93217eb3a..26cc4095ea70 100644 Binary files a/plugins/gradle/lib/gradle-core-1.4.jar and b/plugins/gradle/lib/gradle-core-1.6-20130404052254+0000.jar differ diff --git a/plugins/gradle/lib/gradle-messaging-1.4.jar b/plugins/gradle/lib/gradle-messaging-1.6-20130404052254+0000.jar similarity index 87% rename from plugins/gradle/lib/gradle-messaging-1.4.jar rename to plugins/gradle/lib/gradle-messaging-1.6-20130404052254+0000.jar index e570772510b1..cc146e167530 100644 Binary files a/plugins/gradle/lib/gradle-messaging-1.4.jar and b/plugins/gradle/lib/gradle-messaging-1.6-20130404052254+0000.jar differ diff --git a/plugins/gradle/lib/gradle-src.zip b/plugins/gradle/lib/gradle-src.zip index 672346527564..46f386573da7 100644 Binary files a/plugins/gradle/lib/gradle-src.zip and b/plugins/gradle/lib/gradle-src.zip differ diff --git a/plugins/gradle/lib/gradle-tooling-api-1.4.jar b/plugins/gradle/lib/gradle-tooling-api-1.4.jar deleted file mode 100644 index 077bca9c3614..000000000000 Binary files a/plugins/gradle/lib/gradle-tooling-api-1.4.jar and /dev/null differ diff --git a/plugins/gradle/lib/gradle-tooling-api-1.6-20130404052254+0000.jar b/plugins/gradle/lib/gradle-tooling-api-1.6-20130404052254+0000.jar new file mode 100644 index 000000000000..2f95666adaef Binary files /dev/null and b/plugins/gradle/lib/gradle-tooling-api-1.6-20130404052254+0000.jar differ diff --git a/plugins/gradle/lib/gradle-wrapper-1.4.jar b/plugins/gradle/lib/gradle-wrapper-1.4.jar deleted file mode 100644 index 2b1282d718b9..000000000000 Binary files a/plugins/gradle/lib/gradle-wrapper-1.4.jar and /dev/null differ diff --git a/plugins/gradle/lib/gradle-wrapper-1.6-20130404052254+0000.jar b/plugins/gradle/lib/gradle-wrapper-1.6-20130404052254+0000.jar new file mode 100644 index 000000000000..8b43adc55a61 Binary files /dev/null and b/plugins/gradle/lib/gradle-wrapper-1.6-20130404052254+0000.jar differ diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml index fd270e500d05..5be26a31ac3b 100644 --- a/plugins/gradle/src/META-INF/plugin.xml +++ b/plugins/gradle/src/META-INF/plugin.xml @@ -41,7 +41,7 @@ - + diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java index 32034005e725..9f28154a4360 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java @@ -45,7 +45,16 @@ public class GradleExecutionHelper { @NotNull ProjectConnection connection, boolean downloadLibraries) { - ModelBuilder result = connection.model(downloadLibraries ? IdeaProject.class : BasicIdeaProject.class); + return getModelBuilder(downloadLibraries ? IdeaProject.class : BasicIdeaProject.class, id, settings, connection); + } + + @NotNull + public ModelBuilder getModelBuilder(@NotNull Class modelType, + @NotNull final ExternalSystemTaskId id, + @Nullable GradleExecutionSettings settings, + @NotNull ProjectConnection connection) + { + ModelBuilder result = connection.model(modelType); prepare(result, id, settings); return result; } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java index ad4602fac30e..209cefc332f1 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java @@ -50,6 +50,29 @@ public class GradleProjectResolver implements ExternalSystemProjectResolver extensionClassNames = settings.getResolverExtensions(); + if (myCachedExtensions == null || !myCachedExtensions.first.equals(extensionClassNames)) { + List classNames = ContainerUtilRt.newArrayList(extensionClassNames); + List extensions = ContainerUtilRt.newArrayList(); + for (String className : classNames) { + try { + extensions.add((GradleProjectResolverExtension)Class.forName(className).newInstance()); + } + catch (Exception e) { + throw new IllegalArgumentException(String.format("Can't instantiate project resolve extension for class '%s'", className), e); + } + } + myCachedExtensions = Pair.create(classNames, extensions); + } + for (GradleProjectResolverExtension extension : myCachedExtensions.second) { + DataNode result = extension.resolveProjectInfo(id, projectPath, downloadLibraries, settings); + if (result != null) { + return result; + } + } + } + return myHelper.execute(projectPath, settings, new Function>() { @Override public DataNode fun(ProjectConnection connection) { @@ -77,26 +100,6 @@ public class GradleProjectResolver implements ExternalSystemProjectResolver> libraries = ExternalSystemUtil.getChildren(result, ProjectKeys.LIBRARY); myLibraryNamesMixer.mixNames(libraries); - - if (settings != null) { - List extensionClassNames = settings.getResolverExtensions(); - if (myCachedExtensions == null || !myCachedExtensions.first.equals(extensionClassNames)) { - List classNames = ContainerUtilRt.newArrayList(extensionClassNames); - List extensions = ContainerUtilRt.newArrayList(); - for (String className : classNames) { - try { - extensions.add((GradleProjectResolverExtension)Class.forName(className).newInstance()); - } - catch (Exception e) { - throw new IllegalArgumentException(String.format("Can't instantiate project resolve extension for class '%s'", className), e); - } - } - myCachedExtensions = Pair.create(classNames, extensions); - } - for (GradleProjectResolverExtension extension : myCachedExtensions.second) { - extension.enhanceProject(result, connection, !downloadLibraries); - } - } return result; } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java index e2a35fba4220..df3b0fb17d2f 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java @@ -17,16 +17,10 @@ package org.jetbrains.plugins.gradle.service.project; import com.intellij.execution.configurations.SimpleJavaParameters; import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.externalSystem.model.DataNode; -import com.intellij.openapi.externalSystem.model.project.ProjectData; -import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId; import com.intellij.openapi.externalSystem.service.ParametersEnhancer; import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver; -import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataService; -import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings; -import org.gradle.tooling.ProjectConnection; -import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.GradleManager; +import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings; /** * Allows to enhance {@link GradleProjectResolver} processing. @@ -38,20 +32,7 @@ import org.jetbrains.plugins.gradle.GradleManager; * @since 4/17/13 11:24 AM * @see GradleManager#enhanceParameters(SimpleJavaParameters) sample enhanceParameters() implementation */ -public interface GradleProjectResolverExtension extends ParametersEnhancer { +public interface GradleProjectResolverExtension extends ParametersEnhancer, ExternalSystemProjectResolver { ExtensionPointName EP_NAME = ExtensionPointName.create("org.jetbrains.plugins.gradle.projectResolve"); - - /** - * Is expected to be called during gradle project - * {@link ExternalSystemProjectResolver#resolveProjectInfo(ExternalSystemTaskId, String, boolean, ExternalSystemExecutionSettings) parsing}. - *

- * The general idea is to allow to store specific data at given project node for {@link ProjectDataService further processing}. - * - * @param project target project built from the gradle file - * @param connection gradle connection for the target gradle file - * @param quick flag which indicates whether the processing should be quick (e.g. don't download binary dependencies - * if the flag is true) - */ - void enhanceProject(@NotNull DataNode project, @NotNull ProjectConnection connection, boolean quick); } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleStartupActivity.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleStartupActivity.java index d6696127c121..3841703e9b93 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleStartupActivity.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleStartupActivity.java @@ -1,5 +1,8 @@ package org.jetbrains.plugins.gradle.sync; +import com.intellij.openapi.externalSystem.model.ProjectSystemId; +import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; +import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.startup.StartupManager; @@ -16,6 +19,7 @@ import org.jetbrains.plugins.gradle.util.GradleUtil; * @author Denis Zhdanov * @since 3/13/12 12:01 PM */ +// TODO den generalize and move to 'external-system' public class GradleStartupActivity implements StartupActivity { @SuppressWarnings("UseOfArchaicSystemPropertyAccessors") @Override @@ -25,10 +29,9 @@ public class GradleStartupActivity implements StartupActivity { public void run() { new GradlePatcher().patch(project); - // TODO den uncomment - //if (!Boolean.getBoolean(GradleConstants.NEWLY_IMPORTED_PROJECT)) { - // GradleUtil.refreshProject(project); - //} + if (!Boolean.getBoolean(ExternalSystemConstants.NEWLY_IMPORTED_PROJECT)) { + ExternalSystemUtil.refreshProject(project, GradleConstants.SYSTEM_ID); + } } };