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;
}
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);
}
}
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);
}
}
}
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;
}
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);
}
Aggregations