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


Java GradleConnector.useInstallation方法代码示例

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


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

示例1: fetch

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
private static void fetch(File buildDir, File gradleInstallDir, boolean embedded) {
    System.out.println("* Fetching model for " + buildDir);
    System.out.println("* Using tooling API " + GradleVersion.current().getVersion());

    Timer timer = new Timer();

    GradleConnector gradleConnector = GradleConnector.newConnector();
    gradleConnector.forProjectDirectory(buildDir);
    ((DefaultGradleConnector) gradleConnector).embedded(embedded);
    if (gradleInstallDir != null) {
        gradleConnector.useInstallation(gradleInstallDir);
    }

    ProjectConnection connect = gradleConnector.connect();
    try {
        for (int i = 0; i < 5; i++) {
            SyncAction.withProjectConnection(connect, null);
        }
    } finally {
        connect.close();
    }

    timer.stop();
    System.out.println("total time: " + timer.duration());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:Main.java

示例2: createProjectConnection

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
private ProjectConnection createProjectConnection(ComparableGradleBuildExecuter executer) {
    GradleConnector connector = GradleConnector.newConnector();
    connector.forProjectDirectory(executer.getSpec().getProjectDir());
    File gradleUserHomeDir = gradle.getStartParameter().getGradleUserHomeDir();
    if (gradleUserHomeDir != null) {
        connector.useGradleUserHomeDir(gradleUserHomeDir);
    }

    GradleVersion gradleVersion = executer.getGradleVersion();
    if (gradleVersion.equals(GradleVersion.current())) {
        connector.useInstallation(gradle.getGradleHomeDir());
    } else {
        connector.useGradleVersion(gradleVersion.getVersion());
    }

    return connector.connect();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:GradleBuildComparison.java

示例3: configureGradleRuntime

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
/**
 * Configure the gradle runtime, version or home depending on the settings.
 * @param connector
 */
public static void configureGradleRuntime(GradleConnector connector, IPreferenceStore prefs) {
	
	String gradleVersion = prefs.getString(WorkbenchPreferencePage.GRADLE_VERSION_ID);
	
	if (GradlePluginConstants.USE_GRADLE_HOME_VERSION_VALUE.equals(gradleVersion)) {
		String gradleHome = prefs.getString(WorkbenchPreferencePage.GRADLE_HOME_ID);
		
		File gradleHomeDir = new File(gradleHome);
		
		if (isFileValidGradleInstallation(gradleHomeDir)) {
			connector.useInstallation(gradleHomeDir);
			return;
		} else {
			throw new IllegalStateException("Configured gradle home is not valid");
		}
	}
	
	connector.useGradleVersion(gradleVersion);
}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:24,代码来源:GradlePluginUtils.java

示例4: main

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
public static void main(String[] args) {
    // Configure the connector and create the connection
    GradleConnector connector = GradleConnector.newConnector();

    if (args.length > 0) {
        connector.useInstallation(new File(args[0]));
        if (args.length > 1) {
            connector.useGradleUserHomeDir(new File(args[1]));
        }
    }

    connector.forProjectDirectory(new File("."));

    ProjectConnection connection = connector.connect();
    try {
        // Configure the build
        BuildLauncher launcher = connection.newBuild();
        launcher.forTasks("help");
        launcher.setStandardOutput(System.out);
        launcher.setStandardError(System.err);

        // Run the build
        launcher.run();
    } finally {
        // Clean up
        connection.close();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:29,代码来源:Main.java

示例5: getGradleConnector

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
@NotNull
private static GradleConnector getGradleConnector(@NotNull BuilderExecutionSettings executionSettings) {
  GradleConnector connector = GradleConnector.newConnector();
  if (connector instanceof DefaultGradleConnector) {
    DefaultGradleConnector defaultConnector = (DefaultGradleConnector)connector;

    if (executionSettings.isEmbeddedModeEnabled()) {
      LOG.info("Using Gradle embedded mode.");
      defaultConnector.embedded(true);
    }

    defaultConnector.setVerboseLogging(executionSettings.isVerboseLoggingEnabled());
  }

  connector.forProjectDirectory(executionSettings.getProjectDir());

  File gradleHomeDir = executionSettings.getGradleHomeDir();
  if (gradleHomeDir != null) {
    connector.useInstallation(gradleHomeDir);
  }

  File gradleServiceDir = executionSettings.getGradleServiceDir();
  if (gradleServiceDir != null) {
    connector.useGradleUserHomeDir(gradleServiceDir);
  }

  return connector;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidGradleTargetBuilder.java

示例6: main

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
public static void main(String[] args) {
    // Configure the connector and create the connection
    GradleConnector connector = GradleConnector.newConnector();

    if (args.length > 0) {
        connector.useInstallation(new File(args[0]));
        if (args.length > 1) {
            connector.useGradleUserHomeDir(new File(args[1]));
        }
    }

    connector.forProjectDirectory(new File("."));

    ProjectConnection connection = connector.connect();
    try {
        // Configure the build
        BuildLauncher launcher = connection.newBuild();
        launcher.forTasks("help");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        launcher.setStandardOutput(outputStream);
        launcher.setStandardError(outputStream);

        // Run the build
        launcher.run();
    } finally {
        // Clean up
        connection.close();
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:30,代码来源:Main.java

示例7: applyTo

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
@Override
public void applyTo(GradleConnector gradleConnector) {
    gradleConnector.useInstallation(gradleHome);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:GradleProvider.java


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