Java Code Examples for org.gradle.api.project#container()
The following examples show how to use
org.gradle.api.project#container() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasExtensionFactory.java From atlas with Apache License 2.0 | 6 votes |
public AtlasExtension createExtendsion(Project project, Instantiator instantiator) { AtlasExtension atlasExtension = getExtendsion(project); if (null != atlasExtension) { return atlasExtension; } final NamedDomainObjectContainer<TBuildType> buildTypeContainer = project.container(TBuildType.class, new TBuildTypeFactory( instantiator, project, project.getLogger())); final NamedDomainObjectContainer<PatchConfig> patchConfigContainer = project.container(PatchConfig.class, new PatchConfigFactory( instantiator, project, project .getLogger())); final NamedDomainObjectContainer<DexConfig>dexConfigContainer = project.container(DexConfig.class,new DexConfigFactory(instantiator,project,project.getLogger())); return project.getExtensions().create("atlas", AtlasExtension.class, project, instantiator, buildTypeContainer, patchConfigContainer,dexConfigContainer); }
Example 2
Source File: BeanstalkPlugin.java From gradle-beanstalk-plugin with MIT License | 6 votes |
public void apply(Project project) { NamedDomainObjectContainer<BeanstalkDeployment> deployments = project.container(BeanstalkDeployment.class); BeanstalkPluginExtension beanstalk = project.getExtensions().create("beanstalk", BeanstalkPluginExtension.class); ((ExtensionAware) beanstalk).getExtensions().add("deployments", deployments); project.afterEvaluate(p -> { for (BeanstalkDeployment deployment : deployments) { String name = deployment.getName(); String task = "deploy" + Character.toUpperCase(name.charAt(0)) + name.substring(1); p.getTasks().create(task, DeployTask.class, deployTask -> { deployTask.setBeanstalk(beanstalk); deployTask.setDeployment(deployment); }); } }); }
Example 3
Source File: CondaPlugin.java From curiostack with MIT License | 5 votes |
@Override public void apply(Project project) { checkState( project.getParent() == null, "gradle-conda-plugin can only be applied to the root project."); project.getPlugins().apply(ToolDownloaderPlugin.class); condas = project.container( CondaExtension.class, name -> CondaExtension.create(name, project.getObjects())); project.getExtensions().add("conda", condas); condas.configureEach(conda -> addCondaTasks(project, conda)); }
Example 4
Source File: ClojureScriptExtension.java From clojurephant with Apache License 2.0 | 5 votes |
public ClojureScriptExtension(Project project) { this.outputDir = project.getObjects().directoryProperty(); this.builds = project.container(ClojureScriptBuild.class, name -> { ClojureScriptBuild build = new ClojureScriptBuild(project, name); build.getOutputDir().set(outputDir.dir(name)); return build; }); }
Example 5
Source File: ClojureExtension.java From clojurephant with Apache License 2.0 | 5 votes |
public ClojureExtension(Project project) { this.outputDir = project.getObjects().directoryProperty(); this.builds = project.container(ClojureBuild.class, name -> { ClojureBuild build = new ClojureBuild(project, name); build.getOutputDir().set(outputDir.dir(name)); return build; }); }
Example 6
Source File: SamplesExtension.java From native-samples with Apache License 2.0 | 5 votes |
public SamplesExtension(Project project) { externalRepos = project.container(ExternalRepo.class, name -> { return project.getObjects().newInstance(ExternalRepo.class, name); }); samples = project.container(Sample.class, name -> { return project.getObjects().newInstance(Sample.class, name); }); }
Example 7
Source File: JdkDownloadPlugin.java From crate with Apache License 2.0 | 5 votes |
@Override public void apply(Project project) { NamedDomainObjectContainer<Jdk> jdksContainer = project.container( Jdk.class, name -> new Jdk(name, project.getConfigurations().create("jdk_" + name), project.getObjects()) ); project.getExtensions().add(EXTENSION_NAME, jdksContainer); project.afterEvaluate(p -> jdksContainer.all(jdk -> { jdk.finalizeValues(); // depend on the jdk directory "artifact" from the root project var dependencies = project.getDependencies(); Map<String, Object> depConfig = Map.of( "path", ":", "configuration", configName( "extract", jdk.vendor(), jdk.version(), jdk.platform())); dependencies.add( jdk.configuration().getName(), dependencies.project(depConfig)); setupRootJdkDownload(project.getRootProject(), jdk); }) ); }
Example 8
Source File: AttachConfiguration.java From client-gradle-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Inject public AttachConfiguration(Project project) { this.project = project; this.services = project.container(AttachServiceDefinition.class); }
Example 9
Source File: DownConfiguration.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Inject public DownConfiguration(Project project) { this.project = project; this.plugins = project.container(DownPluginDefinition.class); }
Example 10
Source File: AndroidConfigHelper.java From javaide with GNU General Public License v3.0 | 4 votes |
public static NamedDomainObjectContainer<AndroidSourceSet> createSourceSetsContainer( @NonNull final Project project, @NonNull Instantiator instantiator, final boolean isLibrary) { NamedDomainObjectContainer<AndroidSourceSet> sourceSetsContainer = project.container( AndroidSourceSet.class, new AndroidSourceSetFactory(instantiator, project, isLibrary)); sourceSetsContainer.whenObjectAdded(new Action<AndroidSourceSet>() { @Override public void execute(AndroidSourceSet sourceSet) { ConfigurationContainer configurations = project.getConfigurations(); createConfiguration( configurations, sourceSet.getCompileConfigurationName(), "Classpath for compiling the ${sourceSet.name} sources."); String packageConfigDescription; if (isLibrary) { packageConfigDescription = "Classpath only used when publishing '${sourceSet.name}'."; } else { packageConfigDescription = "Classpath packaged with the compiled '${sourceSet.name}' classes."; } createConfiguration( configurations, sourceSet.getPackageConfigurationName(), packageConfigDescription); createConfiguration( configurations, sourceSet.getProvidedConfigurationName(), "Classpath for only compiling the ${sourceSet.name} sources."); createConfiguration( configurations, sourceSet.getWearAppConfigurationName(), "Link to a wear app to embed for object '${sourceSet.name}'."); sourceSet.setRoot(String.format("src/%s", sourceSet.getName())); } }); return sourceSetsContainer; }
Example 11
Source File: ToolDownloaderPlugin.java From curiostack with MIT License | 4 votes |
@Override public void apply(Project project) { checkState( project.getParent() == null, "gradle-tool-downloader-plugin can only be applied to the root project."); var platformHelper = new PlatformHelper(); tools = project.container( ToolDownloaderExtension.class, name -> ToolDownloaderExtension.create(name, project)); project.getExtensions().add("tools", tools); toolManager = new DownloadedToolManager(project, tools); project .getExtensions() .getByType(ExtraPropertiesExtension.class) .set("toolManager", toolManager); var downloadAll = project.getTasks().register("toolsDownloadAll"); var setupAll = project.getTasks().register("toolsSetupAll"); tools.configureEach( tool -> { var taskSuffix = TaskUtil.toTaskSuffix(tool.getName()); var task = project .getTasks() .register( "toolsDownload" + taskSuffix, DownloadToolTask.class, tool, platformHelper, toolManager); var setup = project .getTasks() .register("toolsSetup" + taskSuffix, SetupTask.class, tool.getName()); setup.configure(t -> t.dependsOn(task)); downloadAll.configure(t -> t.dependsOn(task)); setupAll.configure(t -> t.dependsOn(setup)); }); }