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


Java GradleProjectSettings.getGradleHome方法代码示例

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


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

示例1: getManuallyDefinedGradleHome

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
/**
 * Allows to ask for user-defined path to gradle.
 *
 * @param project  target project to use (if any)
 * @return         path to the gradle distribution (if the one is explicitly configured)
 */
@Nullable
public File getManuallyDefinedGradleHome(@Nullable Project project, @NotNull String linkedProjectPath) {
  if (project == null) {
    return null;
  }
  GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedProjectPath);
  if (settings == null) {
    return null;
  }
  
  String path = settings.getGradleHome();
  if (path == null) {
    return null;
  }
  File candidate = new File(path);
  return isGradleSdkHome(candidate) ? candidate : null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GradleInstallationManager.java

示例2: getGradleVersion

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Nullable
public static FullRevision getGradleVersion(@NotNull Project project) {
  String gradleVersion = getGradleVersionUsed(project);
  if (isNotEmpty(gradleVersion)) {
    // The version of Gradle used is retrieved one of the Gradle models. If that fails, we try to deduce it from the project's Gradle
    // settings.
    FullRevision revision = parseRevision(removeTimestampFromGradleVersion(gradleVersion));
    if (revision != null) {
      return revision;
    }

  }

  GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
  if (gradleSettings != null) {
    DistributionType distributionType = gradleSettings.getDistributionType();
    if (distributionType == DEFAULT_WRAPPED) {
      File wrapperPropertiesFile = findWrapperPropertiesFile(project);
      if (wrapperPropertiesFile != null) {
        try {
          String wrapperVersion = getGradleWrapperVersion(wrapperPropertiesFile);
          if (wrapperVersion != null) {
            return parseRevision(removeTimestampFromGradleVersion(wrapperVersion));
          }
        }
        catch (IOException e) {
          LOG.info("Failed to read Gradle version in wrapper", e);
        }
      }
    }
    else if (distributionType == LOCAL) {
      String gradleHome = gradleSettings.getGradleHome();
      if (isNotEmpty(gradleHome)) {
        File gradleHomePath = new File(gradleHome);
        return getGradleVersion(gradleHomePath);
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:GradleUtil.java

示例3: reset

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
public void reset(Project project, GradleProjectSettings settings, boolean isDefaultModuleCreation) {
  String gradleHome = settings.getGradleHome();
  if (myGradleHomePathField != null) {
    myGradleHomePathField.setText(gradleHome == null ? "" : gradleHome);
    myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
  }

  resetGradleJdkComboBox(project, settings);
  resetWrapperControls(settings.getExternalProjectPath(), settings, isDefaultModuleCreation);

  if (myUseLocalDistributionButton != null && !myUseLocalDistributionButton.isSelected()) {
    myGradleHomePathField.setEnabled(false);
    return;
  }

  if (StringUtil.isEmpty(gradleHome)) {
    myGradleHomeSettingType = LocationSettingType.UNKNOWN;
    deduceGradleHomeIfPossible();
  }
  else {
    myGradleHomeSettingType = myInstallationManager.isGradleSdkHome(new File(gradleHome)) ?
                              LocationSettingType.EXPLICIT_CORRECT :
                              LocationSettingType.EXPLICIT_INCORRECT;
    myAlarm.cancelAllRequests();
    if (myGradleHomeSettingType == LocationSettingType.EXPLICIT_INCORRECT &&
        settings.getDistributionType() == DistributionType.LOCAL) {
      new DelayedBalloonInfo(MessageType.ERROR, myGradleHomeSettingType, 0).run();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:IdeaGradleProjectSettingsControlBuilder.java


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