Search in sources :

Example 1 with ExtraPropertiesExtension

use of org.gradle.api.plugins.ExtraPropertiesExtension in project gradle by gradle.

the class AbstractScalaCompile method createOrGetGlobalAnalysisMap.

@SuppressWarnings("unchecked")
protected Map<File, File> createOrGetGlobalAnalysisMap() {
    ExtraPropertiesExtension extraProperties = getProject().getRootProject().getExtensions().getExtraProperties();
    Map<File, File> analysisMap;
    if (extraProperties.has("scalaCompileAnalysisMap")) {
        analysisMap = (Map) extraProperties.get("scalaCompileAnalysisMap");
    } else {
        analysisMap = Maps.newHashMap();
        for (Project project : getProject().getRootProject().getAllprojects()) {
            for (AbstractScalaCompile task : project.getTasks().withType(AbstractScalaCompile.class)) {
                File publishedCode = task.getScalaCompileOptions().getIncrementalOptions().getPublishedCode();
                File analysisFile = task.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile();
                analysisMap.put(publishedCode, analysisFile);
            }
        }
        extraProperties.set("scalaCompileAnalysisMap", Collections.unmodifiableMap(analysisMap));
    }
    return analysisMap;
}
Also used : Project(org.gradle.api.Project) ExtraPropertiesExtension(org.gradle.api.plugins.ExtraPropertiesExtension) File(java.io.File)

Example 2 with ExtraPropertiesExtension

use of org.gradle.api.plugins.ExtraPropertiesExtension in project gradle by gradle.

the class IdePlugin method postProcess.

/**
     * Executes the provided Action after all projects have been evaluated.
     * Action will only be added once per provided key. Any subsequent calls for the same key will be ignored.
     * This permits the plugin to be applied in multiple subprojects, with the postprocess action executed once only.
     */
protected void postProcess(String key, final Action<? super Gradle> action) {
    Project rootProject = project.getRootProject();
    ExtraPropertiesExtension rootExtraProperties = rootProject.getExtensions().getByType(ExtraPropertiesExtension.class);
    String extraPropertyName = "org.gradle." + key + ".postprocess.applied";
    if (!rootExtraProperties.has(extraPropertyName)) {
        project.getGradle().addBuildListener(new BuildAdapter() {

            @Override
            public void projectsEvaluated(Gradle gradle) {
                action.execute(gradle);
            }
        });
        rootExtraProperties.set(extraPropertyName, true);
    }
}
Also used : Project(org.gradle.api.Project) ExtraPropertiesExtension(org.gradle.api.plugins.ExtraPropertiesExtension) BuildAdapter(org.gradle.BuildAdapter) Gradle(org.gradle.api.invocation.Gradle)

Example 3 with ExtraPropertiesExtension

use of org.gradle.api.plugins.ExtraPropertiesExtension in project spring-boot by spring-projects.

the class FindMainClassTask method setMainClassNameProperty.

@TaskAction
public void setMainClassNameProperty() {
    Project project = getProject();
    if (!project.hasProperty("mainClassName") || project.property("mainClassName") == null) {
        String mainClass = findMainClass();
        if (project.hasProperty("mainClassName")) {
            project.setProperty("mainClassName", mainClass);
        } else {
            ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) project.getExtensions().getByName("ext");
            extraProperties.set("mainClassName", mainClass);
        }
    }
}
Also used : Project(org.gradle.api.Project) ExtraPropertiesExtension(org.gradle.api.plugins.ExtraPropertiesExtension) TaskAction(org.gradle.api.tasks.TaskAction)

Example 4 with ExtraPropertiesExtension

use of org.gradle.api.plugins.ExtraPropertiesExtension in project curiostack by curioswitch.

the class ImmutableDeploymentExtension method getTypes.

default NamedDomainObjectContainer<DeploymentConfiguration> getTypes() {
    // We memoize the types ourselves into the project since a Modifiable will always call this
    // method even if we specify Derived or Lazy.
    ExtraPropertiesExtension props = gradleProject().getExtensions().getExtraProperties();
    if (props.has(DEPLOYMENT_TYPES)) {
        // We set the correctly typed value ourselves.
        @SuppressWarnings("unchecked") NamedDomainObjectContainer<DeploymentConfiguration> types = (NamedDomainObjectContainer<DeploymentConfiguration>) props.get(DEPLOYMENT_TYPES);
        checkNotNull(types, "types");
        return types;
    }
    NamedDomainObjectContainer<DeploymentConfiguration> types = gradleProject().container(DeploymentConfiguration.class);
    types.maybeCreate("alpha").setNamespace(baseName() + "-dev").setDeploymentName(baseName() + "-alpha").setReplicas(1).setCpu("0.1").setMemoryMb(256).setImage(imagePrefix() + baseName() + ":latest").setRpcAcls(ImmutableMap.of("*", "*"));
    props.set(DEPLOYMENT_TYPES, types);
    return types;
}
Also used : NamedDomainObjectContainer(org.gradle.api.NamedDomainObjectContainer) ExtraPropertiesExtension(org.gradle.api.plugins.ExtraPropertiesExtension)

Example 5 with ExtraPropertiesExtension

use of org.gradle.api.plugins.ExtraPropertiesExtension in project spring-boot by spring-projects.

the class KotlinPluginAction method execute.

@Override
public void execute(Project project) {
    ExtraPropertiesExtension extraProperties = project.getExtensions().getExtraProperties();
    if (!extraProperties.has("kotlin.version")) {
        String kotlinVersion = getKotlinVersion(project);
        extraProperties.set("kotlin.version", kotlinVersion);
    }
    enableJavaParametersOption(project);
}
Also used : ExtraPropertiesExtension(org.gradle.api.plugins.ExtraPropertiesExtension)

Aggregations

ExtraPropertiesExtension (org.gradle.api.plugins.ExtraPropertiesExtension)7 Project (org.gradle.api.Project)4 File (java.io.File)2 Include (com.fasterxml.jackson.annotation.JsonInclude.Include)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonDeserialize (com.fasterxml.jackson.databind.annotation.JsonDeserialize)1 JsonSerialize (com.fasterxml.jackson.databind.annotation.JsonSerialize)1 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)1 Feature (com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 Files (java.nio.file.Files)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Nullable (javax.annotation.Nullable)1 CondaPlugin (org.curioswitch.gradle.conda.CondaPlugin)1 ModifiableCondaExtension (org.curioswitch.gradle.conda.ModifiableCondaExtension)1