本文整理汇总了Java中org.gradle.tooling.GradleConnector.useGradleUserHomeDir方法的典型用法代码示例。如果您正苦于以下问题:Java GradleConnector.useGradleUserHomeDir方法的具体用法?Java GradleConnector.useGradleUserHomeDir怎么用?Java GradleConnector.useGradleUserHomeDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.tooling.GradleConnector
的用法示例。
在下文中一共展示了GradleConnector.useGradleUserHomeDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: createConnector
import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
/**
* Creates a new Gradle connector for the context.
* @param context the target context
* @return a connector
*/
public static GradleConnector createConnector(GradleContext context) {
GradleConnector connector = GradleConnector.newConnector();
connector.forProjectDirectory(context.getProjectDirectory().getAbsoluteFile());
String versionLabel;
if (context.getGradleDistribution() != null) {
versionLabel = context.getGradleDistribution().toString();
connector.useDistribution(context.getGradleDistribution());
} else {
String version = context.getGradleVersion();
version = version == null ? GradleVersion.current().getVersion() : version;
versionLabel = version;
URI distribution = toDistributionUri(version, context.isUseHttps());
if (distribution != null) {
connector.useDistribution(distribution);
} else {
connector.useGradleVersion(version);
}
}
context.information(MessageFormat.format(
Messages.GradleUtil_infoPrepareDaemon,
versionLabel));
if (context.getGradleUserHomeDir() != null) {
connector.useGradleUserHomeDir(context.getGradleUserHomeDir().getAbsoluteFile());
}
return connector;
}
示例3: 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();
}
}
示例4: 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;
}
示例5: 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();
}
}