本文整理了Java中org.gradle.api.plugins.Convention.getPlugins()
方法的一些代码示例,展示了Convention.getPlugins()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Convention.getPlugins()
方法的具体详情如下:
包路径:org.gradle.api.plugins.Convention
类名称:Convention
方法名:getPlugins
暂无
代码示例来源:origin: typelead/gradle-eta
public static void createConvention(Object conventionTarget, String conventionName, Object conventionObject) {
assertConventionObject(conventionTarget);
((HasConvention) conventionTarget).getConvention().getPlugins()
.put(conventionName, conventionObject);
}
代码示例来源:origin: MinecraftForge/ForgeGradle
private SourceSet resolveSourceSet(Object obj) {
while (obj instanceof Closure)
obj = ((Closure<?>) obj).call();
if (obj instanceof SourceSet)
return (SourceSet) obj;
else {
String name = obj.toString();
JavaPluginConvention javaConv = (JavaPluginConvention) project.getConvention().getPlugins().get("java");
return javaConv.getSourceSets().getByName(name);
}
}
代码示例来源:origin: gradle.plugin.org.hibernate.build.gradle/hibernate-matrix-testing
public MatrixDotGradleProfile(File matrixDotGradleFile, Project project) {
super( matrixDotGradleFile.getParentFile(), project );
jdbcDependencies = prepareConfiguration( getName() );
final ConventionImpl convention = new ConventionImpl( jdbcDependencies, project );
project.getConvention().getPlugins().put( MATRIX_NODE_CONVENTION_KEY, convention );
try {
project.apply( Collections.singletonMap( "from", matrixDotGradleFile ) );
}
finally {
project.getConvention().getPlugins().remove( MATRIX_NODE_CONVENTION_KEY );
}
}
代码示例来源:origin: gradle.plugin.org.hibernate.build/database-profile-plugin
@SuppressWarnings("WeakerAccess")
public MatrixDotGradleProfile(File matrixDotGradleFile, Project project) {
super( matrixDotGradleFile.getParentFile(), project );
jdbcDependencies = prepareConfiguration( getName() );
final ConventionImpl convention = new ConventionImpl( jdbcDependencies, project );
project.getConvention().getPlugins().put( MATRIX_NODE_CONVENTION_KEY, convention );
try {
project.apply( Collections.singletonMap( "from", matrixDotGradleFile ) );
}
finally {
project.getConvention().getPlugins().remove( MATRIX_NODE_CONVENTION_KEY );
}
}
代码示例来源:origin: me.tatarka.gradle/pom
@Override
public void apply(Project project) {
// extensions mechanism not used because we need free closure for pom xml modification
project.getConvention().getPlugins().put("pom", new PomConvention());
activatePomModifications(project);
}
代码示例来源:origin: gradle.plugin.com.enonic.gradle/xp-gradle-plugin
private void afterEvaluate( final Project project )
{
final Jar jar = (Jar) project.getTasks().getByName( "jar" );
final BundleTaskConvention ext = (BundleTaskConvention) jar.getConvention().getPlugins().get( "bundle" );
new BundleConfigurator( project, ext ).configure( this.appExt );
}
代码示例来源:origin: gradle.plugin.com.enonic.xp/xp-gradle-plugin
private void afterEvaluate( final Project project )
{
final Jar jar = (Jar) project.getTasks().getByName( "jar" );
final BundleTaskConvention ext = (BundleTaskConvention) jar.getConvention().getPlugins().get( "bundle" );
new BundleConfigurator( project, ext ).configure( this.appExt );
}
代码示例来源:origin: MinecraftForge/ForgeGradle
void initExtensionDefaults(Project project)
{
outfile = project.getName()+".exe";
version = (String)project.getVersion();
JavaPluginConvention javaConv = (JavaPluginConvention)project.getConvention().getPlugins().get("java");
if (javaConv != null)
{
jreMinVersion = javaConv.getTargetCompatibility().toString();
if (JAVA_VERSION_REGEX.matcher(jreMinVersion).matches())
{
jreMinVersion = jreMinVersion + ".0";
}
}
}
代码示例来源:origin: baratine/baratine
private void bootJarTask(Project project)
{
project.getConvention().getPlugins().put("baratine", new BaratineConvention(project));
GradlePackageTask task;
task = project.getTasks().create("jarBoot",
GradlePackageTask.class);
task.setDescription("Assembles an executable boot jar containing the application and any dependencies");
task.setGroup("build");
project.getTasks().getByName(BasePlugin.ASSEMBLE_TASK_NAME).dependsOn(task);
Task jarTask = project.getTasks().getByName("jar");
task.dependsOn(jarTask);
}
代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin
Provider<FileCollection> getSourceRoots() {
return getSourceSet().map(sourceSet -> {
ClojureSourceSet clojure = (ClojureSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojure");
return clojure.getClojure().getSourceDirectories();
});
}
代码示例来源:origin: gradle-clojure/gradle-clojure
Provider<FileCollection> getSourceRoots() {
return getSourceSet().map(sourceSet -> {
ClojureScriptSourceSet clojure = (ClojureScriptSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojurescript");
return clojure.getClojureScript().getSourceDirectories();
});
}
代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin
Provider<FileCollection> getSourceRoots() {
return getSourceSet().map(sourceSet -> {
ClojureScriptSourceSet clojure = (ClojureScriptSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojurescript");
return clojure.getClojureScript().getSourceDirectories();
});
}
代码示例来源:origin: gradle.plugin.com.ferusgrim/GradleTodo
@Override
public void apply(final Project project) {
final TodoOutputTask task = this.makeTask(project);
task.setInput(((JavaPluginConvention) project.getConvention().getPlugins().get("java"))
.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getJava());
}
代码示例来源:origin: gradle-clojure/gradle-clojure
Provider<FileCollection> getSourceRoots() {
return getSourceSet().map(sourceSet -> {
ClojureSourceSet clojure = (ClojureSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojure");
return clojure.getClojure().getSourceDirectories();
});
}
代码示例来源:origin: com.github.moritzzimmer/fsm-gradle-plugin
@Override
public void apply(Project project) {
project.getPlugins().apply(JavaPlugin.class);
FSMPluginConvention pluginConvention = new FSMPluginConvention();
project.getConvention().getPlugins()
.put(PLUGIN_CONVENTION_NAME, pluginConvention);
configureTask(project, pluginConvention);
configureConfigurations(project.getConfigurations());
configureJarTask(project);
}
代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin
@Override
public void apply(Project project) {
project.getPlugins().apply(ClojureBasePlugin.class);
project.getPlugins().apply(ClojureCommonPlugin.class);
ClojureExtension extension = project.getExtensions().getByType(ClojureExtension.class);
configureBuilds(project, extension);
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
ClojureCommonPlugin.configureDevSource(javaConvention, sourceSet -> {
ClojureSourceSet src = (ClojureSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojure");
return src.getClojure();
});
}
代码示例来源:origin: gradle-clojure/gradle-clojure
@Override
public void apply(Project project) {
project.getPlugins().apply(ClojureBasePlugin.class);
project.getPlugins().apply(ClojureCommonPlugin.class);
ClojureExtension extension = project.getExtensions().getByType(ClojureExtension.class);
configureBuilds(project, extension);
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
ClojureCommonPlugin.configureDevSource(javaConvention, sourceSet -> {
ClojureSourceSet src = (ClojureSourceSet) new DslObject(sourceSet).getConvention().getPlugins().get("clojure");
return src.getClojure();
});
}
代码示例来源:origin: MinecraftForge/ForgeGradle
protected void mapConfigurations()
{
if (project.getPlugins().hasPlugin("maven"))
{
MavenPluginConvention mavenConv = (MavenPluginConvention) project.getConvention().getPlugins().get("maven");
Conf2ScopeMappingContainer mappings = mavenConv.getConf2ScopeMappings();
ConfigurationContainer configs = project.getConfigurations();
final int priority = 500; // 500 is more than the compile config which is at 300
mappings.setSkipUnmappedConfs(true); // dont want unmapped confs bieng compile deps..
mappings.addMapping(priority, configs.getByName(CONFIG_PROVIDED), Conf2ScopeMappingContainer.PROVIDED);
mappings.addMapping(priority, configs.getByName(CONFIG_DEOBF_COMPILE), Conf2ScopeMappingContainer.COMPILE);
mappings.addMapping(priority, configs.getByName(CONFIG_DEOBF_PROVIDED), Conf2ScopeMappingContainer.PROVIDED);
}
}
代码示例来源:origin: gradle.plugin.org.gosu-lang.gosu/gradle-gosu-plugin
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
_project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all( sourceSet -> {
DefaultGosuSourceSet gosuSourceSet = new DefaultGosuSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), _fileResolver);
new DslObject(sourceSet).getConvention().getPlugins().put("gosu", gosuSourceSet);
gosuSourceSet.getGosu().srcDir("src/" + sourceSet.getName() + "/gosu");
sourceSet.getResources().getFilter().exclude( element -> {
return gosuSourceSet.getGosu().contains(element.getFile());
});
sourceSet.getAllSource().source(gosuSourceSet.getGosu());
configureGosuCompile(javaBasePlugin, sourceSet, gosuSourceSet);
});
}
代码示例来源:origin: org.gosu-lang.gosu/gradle-gosu-plugin
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
_project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> {
GosuSourceSet gosuSourceSet = new DefaultGosuSourceSet(sourceSet.getName(), _sourceDirectorySetFactory);
Convention sourceSetConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
sourceSetConvention.getPlugins().put("gosu", gosuSourceSet);
gosuSourceSet.getGosu().srcDir("src/" + sourceSet.getName() + "/gosu");
sourceSet.getResources().getFilter().exclude(element -> gosuSourceSet.getGosu().contains(element.getFile()));
sourceSet.getAllSource().source(gosuSourceSet.getGosu());
configureGosuCompile(javaBasePlugin, sourceSet, gosuSourceSet);
});
}
内容来源于网络,如有侵权,请联系作者删除!