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


Java ExtraPropertiesExtension.get方法代码示例

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


在下文中一共展示了ExtraPropertiesExtension.get方法的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: setMainClass

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入方法依赖的package包/类
private void setMainClass(Repackager repackager) {
	String mainClass;
	if (getProject().hasProperty("mainClassName")) {
		mainClass = (String) getProject().property("mainClassName");
	}
	else {
		ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
				.getExtensions().getByName("ext");
		mainClass = (String) extraProperties.get("mainClassName");
	}
	if (RepackageTask.this.mainClass != null) {
		mainClass = RepackageTask.this.mainClass;
	}
	else if (this.extension.getMainClass() != null) {
		mainClass = this.extension.getMainClass();
	}
	else {
		Task runTask = getProject().getTasks().findByName("run");
		if (runTask != null && runTask.hasProperty("main")) {
			mainClass = (String) getProject().getTasks().getByName("run")
					.property("main");
		}
	}
	getLogger().info("Setting mainClass: " + mainClass);
	repackager.setMainClass(mainClass);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:27,代码来源:RepackageTask.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;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:ScalaCompile.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: 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");
	return (String) extraProperties.get("mainClassName");
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:9,代码来源:RepackageTask.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.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。