本文整理汇总了Java中org.gradle.testkit.runner.GradleRunner.build方法的典型用法代码示例。如果您正苦于以下问题:Java GradleRunner.build方法的具体用法?Java GradleRunner.build怎么用?Java GradleRunner.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.testkit.runner.GradleRunner
的用法示例。
在下文中一共展示了GradleRunner.build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeGradleRunner
import org.gradle.testkit.runner.GradleRunner; //导入方法依赖的package包/类
public static BuildTask executeGradleRunner(
File projectDir, String... taskPath) {
GradleRunner runner = GradleRunner.create().withProjectDir(projectDir);
GradleRunner runnerWithArguments = runner.withArguments(taskPath);
BuildResult buildResult = runnerWithArguments.build();
BuildTask buildtask = null;
for (BuildTask task : buildResult.getTasks()) {
if (task.getPath().endsWith(taskPath[taskPath.length - 1])) {
buildtask = task;
break;
}
}
return buildtask;
}
示例2: testApply
import org.gradle.testkit.runner.GradleRunner; //导入方法依赖的package包/类
@Test
public void testApply() throws Exception {
String text = "plugins { id 'org.anarres.stdproject' }\n"
+ "stdproject {}\n";
Files.write(text, testProjectBuildFile, StandardCharsets.UTF_8);
GradleRunner runner = GradleRunner.create()
.withGradleVersion(gradleVersion)
.withPluginClasspath()
.withDebug(true)
.withProjectDir(testProjectDir.getRoot())
.withArguments("tasks");
LOG.info("Building...\n\n");
// System.out.println("ClassPath is " + runner.getPluginClasspath());
BuildResult result = runner.build();
LOG.info("Output:\n\n" + result.getOutput() + "\n\n");
}
示例3: test
import org.gradle.testkit.runner.GradleRunner; //导入方法依赖的package包/类
@Test
public void test() throws IOException {
testFolder.create();
root = testFolder.getRoot();
saveFile("test_build.gradle", "build.gradle");
saveFile("test_settings.gradle", "settings.gradle");
saveFile("META-INF/beans.xml", "src/main/resources/META-INF/beans.xml");
saveFile("TestModuleProducer.template", "src/main/java/io/crnk/gen/typescript/TestModuleProducer.java");
GradleRunner runner = GradleRunner.create();
runner = runner.withPluginClasspath();
// List<File> files = Arrays.asList(new File("C:\\projects\\oss\\crnk-framework\\crnk-gen-typescript\\build\\classes\\main"));
runner = runner.withProjectDir(root);
// TODO move to assembleTypescript once ngrx-json-api released
runner = runner.withArguments("generateTypescript");
BuildResult build = runner.build();
System.out.println(build.getOutput());
}