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


Java ExtraPropertiesExtension.has方法代码示例

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


在下文中一共展示了ExtraPropertiesExtension.has方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExtraProperty

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T getExtraProperty(Project project, String name, T value, Class<T> returnType) {
    LOGGER.debug("Getting extra property " + name + " from project " + project.getName());
    ExtraPropertiesExtension ext = project.getExtensions().getExtraProperties();
    if (ext != null && ext.has(name)) {
        Object property = ext.get(name);
        if (property == null) {
            LOGGER.debug("Extra property {} is null.", name);
        } else if (!returnType.isInstance(property)) {
            LOGGER.warn("Extra property {} is not {}. It's value will be ignored!", name, returnType.getName());
        } else {
            return (T) property;
        }
    } else {
        LOGGER.debug("Extra property {} is not set.", name);
    }
    return value;
}
 
开发者ID:speedment,项目名称:speedment-gradle-plugin,代码行数:19,代码来源:PluginUtils.java

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

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

示例4: getMainClassNameProperty

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private String getMainClassNameProperty() {
	if (getProject().hasProperty("mainClassName")) {
		return (String) getProject().property("mainClassName");
	}
	ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
			.getExtensions().getByName("ext");
	if (extraProperties.has("mainClassName")) {
		return (String) extraProperties.get("mainClassName");
	}
	return null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:RepackageTask.java

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

示例6: getExtraPropertyValue

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
/**
 * Read the value of an extra property of the project.
 *
 * @param pExtraPropName the reference to the extra property name
 * @param <T> type of the property value
 * @return the property's value
 */
@SuppressWarnings("unchecked")
public <T> T getExtraPropertyValue(@Nonnull final ExtProp pExtraPropName)
{
    ExtraPropertiesExtension extraProps = project.getExtensions().getByType(ExtraPropertiesExtension.class);
    if (extraProps.has(pExtraPropName.getPropertyName())) {
        return (T) extraProps.get(pExtraPropName.getPropertyName());
    }
    throw new GradleException(
        "Reference to non-existent project extra property '" + pExtraPropName.getPropertyName() + "'");
}
 
开发者ID:checkstyle-addons,项目名称:checkstyle-addons,代码行数:18,代码来源:BuildUtil.java

示例7: getExtraPropertyOrNull

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
public static <T> T getExtraPropertyOrNull(@Nonnull Project project, @Nonnull String name) {
    ExtraPropertiesExtension properties = project.getExtensions().getExtraProperties();
    if (properties.has(name))
        return (T) properties.get(name);
    return null;
}
 
开发者ID:shevek,项目名称:gradle-stdproject-plugin,代码行数:7,代码来源:StdProjectPlugin.java


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