Search in sources :

Example 21 with GradleProjectSettings

use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.

the class GradleProjectSettingsFinderTest method testWithNonGradleProject.

public void testWithNonGradleProject() {
    Project project = getProject();
    GradleProjectSettings settings = mySettingsFinder.findGradleProjectSettings(project);
    assertNull(settings);
}
Also used : Project(com.intellij.openapi.project.Project) GradleProjectSettings(org.jetbrains.plugins.gradle.settings.GradleProjectSettings)

Example 22 with GradleProjectSettings

use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.

the class GradleVersionsTest method testReadGradleVersionFromWrapper.

public void testReadGradleVersionFromWrapper() throws Exception {
    loadSimpleApplication();
    Project project = getProject();
    simulateGradleSyncStateReturnNullGradleVersion();
    GradleProjectSettings settings = new GradleProjectSettings();
    settings.setDistributionType(DEFAULT_WRAPPED);
    when(mySettingsFinder.findGradleProjectSettings(any())).thenReturn(settings);
    String expected = getGradleVersionFromWrapper();
    GradleVersion gradleVersion = myGradleVersions.getGradleVersion(project);
    assertNotNull(gradleVersion);
    assertEquals(expected, gradleVersion.toString());
}
Also used : Project(com.intellij.openapi.project.Project) GradleProjectSettings(org.jetbrains.plugins.gradle.settings.GradleProjectSettings) GradleVersion(com.android.ide.common.repository.GradleVersion)

Example 23 with GradleProjectSettings

use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.

the class GradleDistributionCleanUpTaskTest method testAutomaticCreationOfMissingWrapper.

// See https://code.google.com/p/android/issues/detail?id=66880
public void testAutomaticCreationOfMissingWrapper() throws Exception {
    loadSimpleApplication();
    deleteGradleWrapper();
    GradleProjectSettings settings = doGetGradleProjectSettings();
    settings.setDistributionType(DEFAULT_WRAPPED);
    myCleanUpTask.cleanUp(getProject());
    verifyGradleWrapperExists();
}
Also used : GradleProjectSettings(org.jetbrains.plugins.gradle.settings.GradleProjectSettings)

Example 24 with GradleProjectSettings

use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.

the class GradleDistributionCleanUpTaskTest method doGetGradleProjectSettings.

@NotNull
private GradleProjectSettings doGetGradleProjectSettings() {
    GradleProjectSettings settings = GradleProjectSettingsFinder.getInstance().findGradleProjectSettings(getProject());
    assertNotNull(settings);
    return settings;
}
Also used : GradleProjectSettings(org.jetbrains.plugins.gradle.settings.GradleProjectSettings) NotNull(org.jetbrains.annotations.NotNull)

Example 25 with GradleProjectSettings

use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.

the class GradleDistributionCleanUpTaskTest method setGradleLocalDistribution.

private void setGradleLocalDistribution(@NotNull String gradleLocalDistributionPath) {
    GradleProjectSettings settings = doGetGradleProjectSettings();
    settings.setDistributionType(LOCAL);
    settings.setGradleHome(gradleLocalDistributionPath);
}
Also used : GradleProjectSettings(org.jetbrains.plugins.gradle.settings.GradleProjectSettings)

Aggregations

GradleProjectSettings (org.jetbrains.plugins.gradle.settings.GradleProjectSettings)34 File (java.io.File)9 Project (com.intellij.openapi.project.Project)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Nullable (org.jetbrains.annotations.Nullable)6 NotNull (org.jetbrains.annotations.NotNull)5 IOException (java.io.IOException)4 DistributionType (org.jetbrains.plugins.gradle.settings.DistributionType)4 GradleSettings (org.jetbrains.plugins.gradle.settings.GradleSettings)4 GradleWrapper (com.android.tools.idea.gradle.util.GradleWrapper)3 Sdk (com.intellij.openapi.projectRoots.Sdk)3 GradleVersion (com.android.ide.common.repository.GradleVersion)2 Result (com.intellij.openapi.application.Result)2 WriteAction (com.intellij.openapi.application.WriteAction)2 ExternalSystemSettingsListenerAdapter (com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter)2 Module (com.intellij.openapi.module.Module)2 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)2 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)2 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)2 BuildParticipant (org.jetbrains.plugins.gradle.model.data.BuildParticipant)2