Java Code Examples for org.gradle.api.artifacts.Configuration#setVisible()

The following examples show how to use org.gradle.api.artifacts.Configuration#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaBasePlugin.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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));
}
 
Example 2
Source File: PlayJavaScriptPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createCompilerConfiguration(Project project) {
    Configuration compilerConfiguration = project.getConfigurations().create(COMPILER_CONFIGURATION_NAME);
    compilerConfiguration.setVisible(false);
    compilerConfiguration.setTransitive(true);
    compilerConfiguration.setDescription("The JavaScript compiler library used to minify assets.");
    return compilerConfiguration;
}
 
Example 3
Source File: PlayRoutesPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createRoutesCompilerConfiguration(Project project) {
    Configuration compilerConfiguration = project.getConfigurations().create(ROUTES_COMPILER_CONFIGURATION_NAME);
    compilerConfiguration.setVisible(false);
    compilerConfiguration.setTransitive(true);
    compilerConfiguration.setDescription("The routes compiler library used to generate Scala source from routes templates.");
    return compilerConfiguration;
}
 
Example 4
Source File: PlayTwirlPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private Configuration createTwirlCompilerConfiguration(Project project) {
    Configuration twirlCompilerConfiguration = project.getConfigurations().create(TWIRL_COMPILER_CONFIGURATION_NAME);
    twirlCompilerConfiguration.setVisible(false);
    twirlCompilerConfiguration.setTransitive(true);
    twirlCompilerConfiguration.setDescription("The Twirl compiler library used to generate Scala source from Twirl templates.");
    return twirlCompilerConfiguration;
}
 
Example 5
Source File: BaseComponentModelPlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private static void createConfiguration(@NonNull ConfigurationContainer configurations,
                                        @NonNull String configurationName,
                                        @NonNull String configurationDescription) {
    Configuration configuration = configurations.findByName(configurationName);

    configuration.setVisible(false);
    configuration.setDescription(configurationDescription);
}
 
Example 6
Source File: BaseExtension.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
protected void createConfiguration(
        @NonNull ConfigurationContainer configurations,
        @NonNull String configurationName,
        @NonNull String configurationDescription) {
    logger.info("Creating configuration {}", configurationName);

    Configuration configuration = configurations.findByName(configurationName);
    if (configuration == null) {
        configuration = configurations.create(configurationName);
    }
    configuration.setVisible(false);
    configuration.setDescription(configurationDescription);
}
 
Example 7
Source File: ScottPlugin.java    From scott with MIT License 5 votes vote down vote up
private Configuration configureAgentDependencies(Project project, ScottPluginExtension extension) {
    Configuration agentConf = project.getConfigurations().create(AGENT_CONFIGURATION_NAME);
    agentConf.setVisible(false);
    agentConf.setTransitive(true);
    agentConf.setDescription("The Scott agent to use detailed failure reports and hassle free assertions for Java tests");
    agentConf.defaultDependencies(dependencies ->
        dependencies.add(project.getDependencies().create("hu.advancedweb:scott:" + extension.getToolVersion()))
    );
    return agentConf;
}
 
Example 8
Source File: CpdPlugin.java    From gradle-cpd-plugin with Apache License 2.0 5 votes vote down vote up
private void createConfiguration(Project project, CpdExtension extension) {
    Configuration configuration = project.getConfigurations().create("cpd");
    configuration.setDescription("The CPD libraries to be used for this project.");
    configuration.setTransitive(true);
    configuration.setVisible(false);

    configuration.defaultDependencies(d ->
            d.add(project.getDependencies().create("net.sourceforge.pmd:pmd-dist:" + extension.getToolVersion())));
}
 
Example 9
Source File: JavaccPlugin.java    From javaccPlugin with MIT License 5 votes vote down vote up
private Configuration createJavaccConfiguration(Project project) {
    Configuration configuration = project.getConfigurations().create("javacc");
    configuration.setVisible(false);
    configuration.setTransitive(true);
    configuration.setDescription("The javacc dependencies to be used.");
    return configuration;
}
 
Example 10
Source File: VariantDependencies.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public static VariantDependencies compute(@NonNull Project project, @NonNull final String name, boolean publishVariant, @NonNull VariantType variantType, @Nullable VariantDependencies parentVariant, @NonNull ConfigurationProvider... providers) {
    Set<Configuration> compileConfigs = Sets.newHashSetWithExpectedSize(providers.length * 2);
    Set<Configuration> apkConfigs = Sets.newHashSetWithExpectedSize(providers.length);

    for (ConfigurationProvider provider : providers) {
        if (provider != null) {
            compileConfigs.add(provider.getCompileConfiguration());
            if (provider.getProvidedConfiguration() != null) {
                compileConfigs.add(provider.getProvidedConfiguration());
            }


            apkConfigs.add(provider.getCompileConfiguration());
            apkConfigs.add(provider.getPackageConfiguration());
        }

    }


    if (parentVariant != null) {
        compileConfigs.add(parentVariant.getCompileConfiguration());
        apkConfigs.add(parentVariant.getPackageConfiguration());
    }


    Configuration compile = project.getConfigurations().maybeCreate("_" + name + "Compile");
    compile.setVisible(false);
    compile.setDescription("## Internal use, do not manually configure ##");
    compile.setExtendsFrom(compileConfigs);

    Configuration apk = project.getConfigurations().maybeCreate(variantType.equals(VariantType.LIBRARY) ? "_" + name + "Publish" : "_" + name + "Apk");

    apk.setVisible(false);
    apk.setDescription("## Internal use, do not manually configure ##");
    apk.setExtendsFrom(apkConfigs);

    Configuration publish = null;
    Configuration mapping = null;
    Configuration classes = null;
    Configuration metadata = null;
    if (publishVariant) {
        publish = project.getConfigurations().maybeCreate(name);
        publish.setDescription("Published Configuration for Variant " + name);
        // if the variant is not a library, then the publishing configuration should
        // not extend from the apkConfigs. It's mostly there to access the artifact from
        // another project but it shouldn't bring any dependencies with it.
        if (variantType.equals(VariantType.LIBRARY)) {
            publish.setExtendsFrom(apkConfigs);
        }


        // create configuration for -metadata.
        metadata = project.getConfigurations().create(name + "-metadata");
        metadata.setDescription("Published APKs metadata for Variant " + name);

        // create configuration for -mapping and -classes.
        mapping = project.getConfigurations().maybeCreate(name + "-mapping");
        mapping.setDescription("Published mapping configuration for Variant " + name);

        classes = project.getConfigurations().maybeCreate(name + "-classes");
        classes.setDescription("Published classes configuration for Variant " + name);
        // because we need the transitive dependencies for the classes, extend the compile config.
        classes.setExtendsFrom(compileConfigs);
    }


    return new VariantDependencies(name, compile, apk, publish, mapping, classes, metadata, true);
}