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


Java ExtraPropertiesExtension类代码示例

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


ExtraPropertiesExtension类属于org.gradle.api.plugins包,在下文中一共展示了ExtraPropertiesExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:ProjectPropertySettingBuildLoader.java

示例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: 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

示例4: 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

示例5: 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

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

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

示例8: 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

示例9: setUp

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入依赖的package包/类
@Before
public void setUp() {
	project = mock(Project.class);
	// project.getExtensions().getExtraProperties().set(passwordProperty, pass);
	ExtensionContainer extensionContainer = mock(ExtensionContainer.class);
	when(project.getExtensions()).thenReturn(extensionContainer);
	extraProperties = mock(ExtraPropertiesExtension.class);
	when(extensionContainer.getExtraProperties()).thenReturn(extraProperties);
}
 
开发者ID:Unity-Group,项目名称:gradle-lazy-credentials,代码行数:10,代码来源:PasswordPromptTest.java

示例10: 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

示例11: addBootRunTask

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入依赖的package包/类
private void addBootRunTask(final Project project) {
	final JavaPluginConvention javaConvention = project.getConvention()
			.getPlugin(JavaPluginConvention.class);

	BootRunTask run = project.getTasks().create(RUN_APP_TASK_NAME, BootRunTask.class);
	run.setDescription("Run the project with support for "
			+ "auto-detecting main class and reloading static resources");
	run.setGroup("application");
	run.setClasspath(
			javaConvention.getSourceSets().findByName("main").getRuntimeClasspath());
	run.getConventionMapping().map("main", new Callable<Object>() {
		@Override
		public Object call() throws Exception {
			if (project.hasProperty("mainClassName")
					&& project.property("mainClassName") != null) {
				return project.property("mainClassName");
			}
			ExtraPropertiesExtension extraPropertiesExtension = (ExtraPropertiesExtension) project
					.getExtensions().getByName("ext");
			if (extraPropertiesExtension.has("mainClassName")
					&& extraPropertiesExtension.get("mainClassName") != null) {
				return extraPropertiesExtension.get("mainClassName");
			}
			return null;
		}
	});
	run.getConventionMapping().map("jvmArgs", new Callable<Object>() {
		@Override
		public Object call() throws Exception {
			if (project.hasProperty("applicationDefaultJvmArgs")) {
				return project.property("applicationDefaultJvmArgs");
			}
			return Collections.emptyList();
		}
	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:37,代码来源:RunPluginFeatures.java

示例12: 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

示例13: 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

示例14: 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

示例15: getDynamicProperties

import org.gradle.api.plugins.ExtraPropertiesExtension; //导入依赖的package包/类
public ExtraPropertiesExtension getDynamicProperties() {
    return convention.getExtraProperties();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ExtensibleDynamicObject.java


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