当前位置: 首页>>代码示例>>Java>>正文


Java GradleProjectSettings.setDistributionType方法代码示例

本文整理汇总了Java中org.jetbrains.plugins.gradle.settings.GradleProjectSettings.setDistributionType方法的典型用法代码示例。如果您正苦于以下问题:Java GradleProjectSettings.setDistributionType方法的具体用法?Java GradleProjectSettings.setDistributionType怎么用?Java GradleProjectSettings.setDistributionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.plugins.gradle.settings.GradleProjectSettings的用法示例。


在下文中一共展示了GradleProjectSettings.setDistributionType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
protected void execute(@NotNull Project project) {
  File projectDirPath = getBaseDirPath(project);
  try {
    createGradleWrapper(projectDirPath);
    GradleProjectSettings settings = getGradleProjectSettings(project);
    if (settings != null) {
      settings.setDistributionType(DEFAULT_WRAPPED);
    }
    GradleProjectImporter.getInstance().requestProjectSync(project, null);
  }
  catch (IOException e) {
    // Unlikely to happen.
    Messages.showErrorDialog(project, "Failed to create Gradle wrapper: " + e.getMessage(), "Quick Fix");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CreateGradleWrapperHyperlink.java

示例2: canSync

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@NotNull
static PreSyncCheckResult canSync(@NotNull Project project) {
  VirtualFile baseDir = project.getBaseDir();
  if (baseDir == null) {
    // Unlikely to happen because it would mean this is the default project.
    return PreSyncCheckResult.success();
  }

  if (isAndroidStudio()) {
    // We only check proxy settings for Studio, because Studio does not pass the IDE's proxy settings to Gradle.
    // See https://code.google.com/p/android/issues/detail?id=169743
    checkHttpProxySettings(project);
  }

  ProjectSyncMessages syncMessages = ProjectSyncMessages.getInstance(project);
  syncMessages.removeMessages(PROJECT_SYNCING_ERROR_GROUP);

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    attemptToUseEmbeddedGradle(project);
  }

  GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
  File wrapperPropertiesFile = findWrapperPropertiesFile(project);

  DistributionType distributionType = gradleSettings != null ? gradleSettings.getDistributionType() : null;
  boolean usingWrapper = (distributionType == null || distributionType == DEFAULT_WRAPPED) && wrapperPropertiesFile != null;
  if (usingWrapper && gradleSettings != null) {
    // Do this just to ensure that the right distribution type is set. If this is not set, build.gradle editor will not have code
    // completion (see BuildClasspathModuleGradleDataService, line 119).
    gradleSettings.setDistributionType(DEFAULT_WRAPPED);
  }
  else if (!ApplicationManager.getApplication().isUnitTestMode()) {
    if (wrapperPropertiesFile == null && gradleSettings != null) {
      createWrapperIfNecessary(project, gradleSettings, distributionType);
    }
  }

  return PreSyncCheckResult.success();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:PreSyncChecks.java

示例3: execute

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
protected void execute(@NotNull Project project) {
  updateGradleVersion(project, myWrapperPropertiesFile, myGradleVersion);
  GradleProjectSettings settings = GradleUtil.getGradleProjectSettings(project);
  if (settings != null) {
    settings.setDistributionType(DistributionType.DEFAULT_WRAPPED);
  }
  GradleProjectImporter.getInstance().requestProjectSync(project, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FixGradleVersionInWrapperHyperlink.java

示例4: attemptToUseEmbeddedGradle

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
public static void attemptToUseEmbeddedGradle(@NotNull Project project) {
  if (isAndroidStudio()) {
    File wrapperPropertiesFile = findWrapperPropertiesFile(project);
    if (wrapperPropertiesFile != null) {
      String gradleVersion = null;
      try {
        Properties properties = getProperties(wrapperPropertiesFile);
        String url = properties.getProperty(DISTRIBUTION_URL_PROPERTY);
        gradleVersion = getGradleWrapperVersionOnlyIfComingForGradleDotOrg(url);
      }
      catch (IOException e) {
        LOG.warn("Failed to read file " + wrapperPropertiesFile.getPath());
      }
      if (gradleVersion != null &&
          isCompatibleWithEmbeddedGradleVersion(gradleVersion) &&
          !isWrapperInGradleCache(project, gradleVersion)) {
        File embeddedGradlePath = findEmbeddedGradleDistributionPath();
        if (embeddedGradlePath != null) {
          GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
          if (gradleSettings != null) {
            gradleSettings.setDistributionType(LOCAL);
            gradleSettings.setGradleHome(embeddedGradlePath.getPath());
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GradleUtil.java

示例5: testUnsupportedPluginVersion

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Test @IdeGuiTest @Ignore // Removed minimum plugin version check. It is failing in some projects.
public void testUnsupportedPluginVersion() throws IOException {
  // Open the project without updating the version of the plug-in
  IdeFrameFixture projectFrame = importSimpleApplication();

  final Project project = projectFrame.getProject();

  // Use old, unsupported plugin version.
  File buildFilePath = new File(project.getBasePath(), FN_BUILD_GRADLE);
  final VirtualFile buildFile = findFileByIoFile(buildFilePath, true);
  assertNotNull(buildFile);
  WriteCommandAction.runWriteCommandAction(project, new Runnable() {
    @Override
    public void run() {
      new GradleBuildFile(buildFile, project).setValue(PLUGIN_VERSION, "0.12.+");
    }
  });

  // Use old, unsupported Gradle in the wrapper.
  File wrapperPropertiesFile = findWrapperPropertiesFile(project);
  assertNotNull(wrapperPropertiesFile);
  updateGradleDistributionUrl("1.12", wrapperPropertiesFile);

  GradleProjectSettings settings = getGradleProjectSettings(project);
  assertNotNull(settings);
  settings.setDistributionType(DEFAULT_WRAPPED);

  projectFrame.requestProjectSyncAndExpectFailure();

  ContentFixture syncMessages = projectFrame.getMessagesToolWindow().getGradleSyncContent();
  String errorPrefix = "The minimum supported version of the Android Gradle plugin";
  MessageFixture message = syncMessages.findMessage(ERROR, firstLineStartingWith(errorPrefix));

  MessagesToolWindowFixture.HyperlinkFixture hyperlink = message.findHyperlink("Fix plugin version");
  hyperlink.click();

  projectFrame.waitForGradleProjectSyncToFinish();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GradleSyncTest.java

示例6: useLocalGradleDistribution

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@NotNull
public IdeFrameFixture useLocalGradleDistribution(@NotNull String gradleHome) {
  GradleProjectSettings settings = getGradleSettings();
  settings.setDistributionType(LOCAL);
  settings.setGradleHome(gradleHome);
  return this;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:IdeFrameFixture.java

示例7: apply

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
public void apply(GradleProjectSettings settings) {
  if (myGradleHomePathField != null) {
    String gradleHomePath = FileUtil.toCanonicalPath(myGradleHomePathField.getText());
    if (StringUtil.isEmpty(gradleHomePath)) {
      settings.setGradleHome(null);
    }
    else {
      settings.setGradleHome(gradleHomePath);
      GradleUtil.storeLastUsedGradleHome(gradleHomePath);
    }
  }

  if (myGradleJdkComboBox != null) {
    final String gradleJvm = FileUtil.toCanonicalPath(myGradleJdkComboBox.getSelectedValue());
    settings.setGradleJvm(StringUtil.isEmpty(gradleJvm) ? null : gradleJvm);
  }

  if (myUseLocalDistributionButton != null && myUseLocalDistributionButton.isSelected()) {
    settings.setDistributionType(DistributionType.LOCAL);
  }
  else if (myUseWrapperButton != null && myUseWrapperButton.isSelected()) {
    settings.setDistributionType(DistributionType.DEFAULT_WRAPPED);
  }
  else if ((myUseWrapperWithVerificationButton != null && myUseWrapperWithVerificationButton.isSelected()) ||
           (myUseBundledDistributionButton != null && myUseBundledDistributionButton.isSelected())) {
    settings.setDistributionType(DistributionType.WRAPPED);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:IdeaGradleProjectSettingsControlBuilder.java


注:本文中的org.jetbrains.plugins.gradle.settings.GradleProjectSettings.setDistributionType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。