本文整理汇总了Java中org.gradle.api.plugins.ExtraPropertiesExtension.set方法的典型用法代码示例。如果您正苦于以下问题:Java ExtraPropertiesExtension.set方法的具体用法?Java ExtraPropertiesExtension.set怎么用?Java ExtraPropertiesExtension.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.plugins.ExtraPropertiesExtension
的用法示例。
在下文中一共展示了ExtraPropertiesExtension.set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
void configureProperty(Project project, String name, Object value) {
Class<? extends Project> clazz = project.getClass();
if (clazz != projectClazz) {
mutators.clear();
projectClazz = clazz;
}
PropertyMutator propertyMutator = mutators.get(name);
if (propertyMutator != null) {
propertyMutator.setValue(project, value);
} else {
if (!mutators.containsKey(name)) {
propertyMutator = JavaReflectionUtil.writeablePropertyIfExists(clazz, name);
mutators.put(name, propertyMutator);
if (propertyMutator != null) {
propertyMutator.setValue(project, value);
return;
}
}
ExtraPropertiesExtension extraProperties = project.getExtensions().getExtraProperties();
extraProperties.set(name, value);
}
}
示例2: setMainClassNameProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
@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);
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:FindMainClassTask.java
示例3: getOrCreateGlobalAnalysisMap
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Map<File, File> getOrCreateGlobalAnalysisMap() {
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 (ScalaCompile task : project.getTasks().withType(ScalaCompile.class)) {
if (task.getScalaCompileOptions().isUseAnt()) { continue; }
File publishedCode = task.getScalaCompileOptions().getIncrementalOptions().getPublishedCode();
File analysisFile = task.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile();
analysisMap.put(publishedCode, analysisFile);
}
}
extraProperties.set("scalaCompileAnalysisMap", Collections.unmodifiableMap(analysisMap));
}
return analysisMap;
}
示例4: addPropertiesToProject
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private void addPropertiesToProject(Project project) {
Properties projectProperties = new Properties();
File projectPropertiesFile = new File(project.getProjectDir(), Project.GRADLE_PROPERTIES);
LOGGER.debug("Looking for project properties from: {}", projectPropertiesFile);
if (projectPropertiesFile.isFile()) {
projectProperties = GUtil.loadProperties(projectPropertiesFile);
LOGGER.debug("Adding project properties (if not overwritten by user properties): {}",
projectProperties.keySet());
} else {
LOGGER.debug("project property file does not exists. We continue!");
}
Map<String, String> mergedProperties = propertiesLoader.mergeProperties(new HashMap(projectProperties));
ExtraPropertiesExtension extraProperties = new DslObject(project).getExtensions().getExtraProperties();
for (Map.Entry<String, String> entry: mergedProperties.entrySet()) {
try {
project.setProperty(entry.getKey(), entry.getValue());
} catch (MissingPropertyException e) {
if (!entry.getKey().equals(e.getProperty())) {
throw e;
}
// Ignore and define as an extra property
extraProperties.set(entry.getKey(), entry.getValue());
}
}
}
示例5: addPropertiesToProject
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private void addPropertiesToProject(Project project) {
Properties projectProperties = new Properties();
File projectPropertiesFile = new File(project.getProjectDir(), Project.GRADLE_PROPERTIES);
LOGGER.debug("Looking for project properties from: {}", projectPropertiesFile);
if (projectPropertiesFile.isFile()) {
projectProperties = GUtil.loadProperties(projectPropertiesFile);
LOGGER.debug("Adding project properties (if not overwritten by user properties): {}",
projectProperties.keySet());
} else {
LOGGER.debug("project property file does not exists. We continue!");
}
Map<String, String> mergedProperties = propertiesLoader.mergeProperties(new HashMap(projectProperties));
ExtraPropertiesExtension extraProperties = new DslObject(project).getExtensions().getExtraProperties();
for (Map.Entry<String, String> entry: mergedProperties.entrySet()) {
if (project.hasProperty(entry.getKey())) {
project.setProperty(entry.getKey(), entry.getValue());
} else {
extraProperties.set(entry.getKey(), entry.getValue());
}
}
}
示例6: postProcess
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
/**
* 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);
}
}
示例7: setExtraProperty
import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
public static void setExtraProperty(Project project, String name, Object value) {
LOGGER.debug("Setting extra property {}={} to project {}", name, value.toString(), project.getName());
ExtraPropertiesExtension ext = project.getExtensions().getExtraProperties();
if (ext != null) {
if (ext.has(name)) {
LOGGER.warn("Extra property {} is already set it will be overwritten.", name);
}
ext.set(name, value);
} else {
LOGGER.debug("Extra properties in project {} are not available.", project.getName());
}
}