本文整理汇总了Java中org.gradle.api.tasks.SourceSet.setRuntimeClasspath方法的典型用法代码示例。如果您正苦于以下问题:Java SourceSet.setRuntimeClasspath方法的具体用法?Java SourceSet.setRuntimeClasspath怎么用?Java SourceSet.setRuntimeClasspath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.tasks.SourceSet
的用法示例。
在下文中一共展示了SourceSet.setRuntimeClasspath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureSourceSets
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
private void configureSourceSets(final JavaPluginConvention pluginConvention) {
final Project project = pluginConvention.getProject();
SourceSet main = pluginConvention.getSourceSets().create(SourceSet.MAIN_SOURCE_SET_NAME);
SourceSet test = pluginConvention.getSourceSets().create(SourceSet.TEST_SOURCE_SET_NAME);
test.setCompileClasspath(project.files(main.getOutput(), project.getConfigurations().getByName(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME)));
test.setRuntimeClasspath(project.files(test.getOutput(), main.getOutput(), project.getConfigurations().getByName(TEST_RUNTIME_CONFIGURATION_NAME)));
}
示例2: defineConfigurationsForSourceSet
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
private void defineConfigurationsForSourceSet(SourceSet sourceSet, ConfigurationContainer configurations) {
Configuration compileConfiguration = configurations.maybeCreate(sourceSet.getCompileConfigurationName());
compileConfiguration.setVisible(false);
compileConfiguration.setDescription("Dependencies for " + sourceSet + ".");
Configuration runtimeConfiguration = configurations.maybeCreate(sourceSet.getRuntimeConfigurationName());
runtimeConfiguration.setVisible(false);
runtimeConfiguration.extendsFrom(compileConfiguration);
runtimeConfiguration.setDescription("Runtime dependencies for " + sourceSet + ".");
Configuration compileOnlyConfiguration = configurations.maybeCreate(sourceSet.getCompileOnlyConfigurationName());
compileOnlyConfiguration.setVisible(false);
compileOnlyConfiguration.extendsFrom(compileConfiguration);
compileOnlyConfiguration.setDescription("Compile dependencies for " + sourceSet + ".");
Configuration compileClasspathConfiguration = configurations.maybeCreate(sourceSet.getCompileClasspathConfigurationName());
compileClasspathConfiguration.setVisible(false);
compileClasspathConfiguration.extendsFrom(compileOnlyConfiguration);
compileClasspathConfiguration.setDescription("Compile classpath for " + sourceSet + ".");
sourceSet.setCompileClasspath(compileClasspathConfiguration);
sourceSet.setRuntimeClasspath(sourceSet.getOutput().plus(runtimeConfiguration));
}
示例3: configureDev
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
private void configureDev(Project project, JavaPluginConvention javaConvention) {
SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
SourceSet test = javaConvention.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME);
SourceSet dev = javaConvention.getSourceSets().create(DEV_SOURCE_SET_NAME);
dev.setCompileClasspath(project.files(test.getOutput(), main.getOutput(), project.getConfigurations().getByName(dev.getCompileClasspathConfigurationName())));
dev.setRuntimeClasspath(project.files(dev.getAllSource().getSourceDirectories(), test.getAllSource().getSourceDirectories(), main.getAllSource().getSourceDirectories(), project.getConfigurations().getByName(dev.getRuntimeClasspathConfigurationName())));
Stream.<Function<SourceSet, String>>of(SourceSet::getCompileConfigurationName, SourceSet::getImplementationConfigurationName, SourceSet::getRuntimeConfigurationName, SourceSet::getRuntimeOnlyConfigurationName).forEach(getter -> {
Configuration devConf = project.getConfigurations().getByName(getter.apply(dev));
Configuration testConf = project.getConfigurations().getByName(getter.apply(test));
devConf.extendsFrom(testConf);
});
project.getTasks().create("clojureRepl", ClojureNRepl.class, task -> {
task.setGroup("run");
task.setDescription("Starts an nREPL server.");
task.setClasspath(dev.getRuntimeClasspath());
});
}
示例4: establishSonarQubeSourceSet
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
public void establishSonarQubeSourceSet()
{
final JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
final SourceSetContainer sourceSets = javaConvention.getSourceSets();
final ConfigurationContainer configs = project.getConfigurations();
final SourceSet testSourceSet = sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME);
final SourceSet sqSourceSet = sourceSets.create(BuildUtil.SONARQUBE_SOURCE_SET_NAME);
configs.getByName(testSourceSet.getImplementationConfigurationName()).extendsFrom(
configs.getByName(sqSourceSet.getImplementationConfigurationName()));
configs.getByName(testSourceSet.getRuntimeOnlyConfigurationName()).extendsFrom(
configs.getByName(sqSourceSet.getRuntimeOnlyConfigurationName()));
final TaskContainer tasks = project.getTasks();
tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME).dependsOn(
tasks.getByName(sqSourceSet.getClassesTaskName()));
final FileCollection sqOutputs = sqSourceSet.getOutput().getClassesDirs().plus(
project.files(sqSourceSet.getOutput().getResourcesDir()));
testSourceSet.setCompileClasspath(testSourceSet.getCompileClasspath().plus(sqOutputs));
testSourceSet.setRuntimeClasspath(testSourceSet.getRuntimeClasspath().plus(sqOutputs));
}
示例5: configureIntegrationTests
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
/**
* Configure integration tests
*/
protected void configureIntegrationTests() {
JavaPluginConvention javaConvention = getProject().getConvention().getPlugin(JavaPluginConvention.class);
SourceSet integrationSources = javaConvention.getSourceSets().create(INTEGRATION_SOURCE_SET_NAME);
SourceSet mainSources = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
@SuppressWarnings("deprecation") Configuration compile = getProject().getConfigurations()
.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME);
@SuppressWarnings("deprecation") Configuration runtime = getProject().getConfigurations()
.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME);
Configuration implementation = getProject().getConfigurations()
.getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
Configuration runtimeOnly = getProject().getConfigurations()
.getByName(JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME);
Configuration integrationCompileClasspath = getProject().getConfigurations()
.getByName(INTEGRATION_COMPILE_CLASSPATH_CONFIGURATION);
Configuration integrationRuntimeClasspath = getProject().getConfigurations()
.getByName(INTEGRATION_RUNTIME_CLASSPATH_CONFIGURATION);
Configuration integrationImplementation = getProject().getConfigurations()
.getByName(INTEGRATION_IMPLEMENTATION_CONFIGURATION);
Configuration integrationCompile = getProject().getConfigurations()
.getByName(INTEGRATION_COMPILE_CONFIGURATION);
Configuration integrationRuntime = getProject().getConfigurations()
.getByName(INTEGRATION_RUNTIME_CONFIGURATION);
Configuration integrationRuntimeOnly = getProject().getConfigurations()
.getByName(INTEGRATION_RUNTIME_ONLY_CONFIGURATION);
integrationCompile.extendsFrom(compile);
integrationImplementation.extendsFrom(implementation);
integrationRuntime.extendsFrom(runtime);
integrationRuntimeOnly.extendsFrom(runtimeOnly);
integrationSources
.setCompileClasspath(getProject().files(mainSources.getOutput(), integrationCompileClasspath));
integrationSources.setRuntimeClasspath(getProject().files(integrationSources.getOutput(),
mainSources.getOutput(), integrationSources.getOutput(), integrationRuntimeClasspath));
}
示例6: configureCompile
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
/**
* Add Minecraft dependencies to compile time
*/
protected void configureCompile() {
JavaPluginConvention javaModule = (JavaPluginConvention) project.getConvention().getPlugins().get("java");
SourceSet main = javaModule.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
SourceSet test = javaModule.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME);
main.setCompileClasspath(main.getCompileClasspath().plus(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES)));
test.setCompileClasspath(test.getCompileClasspath().plus(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES)));
main.setRuntimeClasspath(main.getCompileClasspath().plus(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES)));
test.setCompileClasspath(test.getCompileClasspath().plus(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES)));
Javadoc javadoc = (Javadoc) project.getTasks().getByName(JavaPlugin.JAVADOC_TASK_NAME);
javadoc.setClasspath(main.getOutput().plus(main.getCompileClasspath()));
}
示例7: includeSourcesForTest
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
private void includeSourcesForTest(Project project) {
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
SourceSet mainSourset = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
SourceSet testSourset = javaConvention.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME);
FileCollection testClasspath = project
.files(mainSourset.getAllSource().getSrcDirs().toArray())
.plus(project.files(testSourset.getAllSource().getSrcDirs().toArray()))
.plus(testSourset.getRuntimeClasspath());
testSourset.setRuntimeClasspath(testClasspath);
Test test = project.getTasks().withType(Test.class).getByName("test");
test.getSystemProperties().put("gwt.persistentunitcachedir", project.getBuildDir() + "/putnami/test");
}
示例8: configureSourceSets
import org.gradle.api.tasks.SourceSet; //导入方法依赖的package包/类
private void configureSourceSets(final JavaPluginConvention pluginConvention) {
final Project project = pluginConvention.getProject();
SourceSet main = pluginConvention.getSourceSets().create(SourceSet.MAIN_SOURCE_SET_NAME);
SourceSet test = pluginConvention.getSourceSets().create(SourceSet.TEST_SOURCE_SET_NAME);
test.setCompileClasspath(project.files(main.getOutput(), project.getConfigurations().getByName(TEST_COMPILE_CONFIGURATION_NAME)));
test.setRuntimeClasspath(project.files(test.getOutput(), main.getOutput(), project.getConfigurations().getByName(TEST_RUNTIME_CONFIGURATION_NAME)));
}