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


Java SourceSet.setCompileClasspath方法代码示例

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


在下文中一共展示了SourceSet.setCompileClasspath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:JavaPlugin.java

示例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));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:JavaBasePlugin.java

示例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());
  });
}
 
开发者ID:gradle-clojure,项目名称:gradle-clojure,代码行数:20,代码来源:ClojurePlugin.java

示例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));
}
 
开发者ID:checkstyle-addons,项目名称:checkstyle-addons,代码行数:24,代码来源:TaskCreator.java

示例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));
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:42,代码来源:JavaConfigPlugin.java

示例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()));
}
 
开发者ID:OpenModLoader,项目名称:ModGradle,代码行数:18,代码来源:AbstractPlugin.java

示例7: 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)));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:10,代码来源:JavaPlugin.java


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