本文整理汇总了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());
}
示例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();
}
示例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);
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例7: applyTo
import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
@Override
public void applyTo(GradleConnector gradleConnector) {
gradleConnector.useInstallation(gradleHome);
}