org.gradle.api.Project.container()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.gradle.api.Project.container()方法的一些代码示例,展示了Project.container()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.container()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:container

Project.container介绍

暂无

代码示例

代码示例来源:origin: javafxports/javafxmobile-plugin

@Inject
public DownConfiguration(Project project) {
  this.project = project;
  this.plugins = project.container(DownPluginDefinition.class);
}

代码示例来源:origin: gradle.plugin.de.lukaskoerfer.gradle/debugging

private Object createDebuggingContainer() {
  NamedDomainObjectContainer<DebugConfiguration> debugging =
    project.container(DebugConfiguration.class);
  debugging.all(this::setupDebugConfiguration);
  return debugging;
}

代码示例来源:origin: gradle.plugin.org.otherworlds/javascript

public JavaScriptExtension(Project project, FileResolver fileResolver) {
  sourceSetsContainer = project.container(
    JavaScriptSourceSet.class,
    new JavaScriptSourceSetFactory(fileResolver)
  );
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

/**
 * Creates a new {@code DependencyManagementConfigurationContainer} that will manage {@link Configuration
 * Configurations} for the given {@code project}.
 *
 * @param project the project
 */
public DependencyManagementConfigurationContainer(Project project) {
  this.delegate = project.getConfigurations();
  this.configurations = project.container(Configuration.class);
}

代码示例来源:origin: diffplug/goomph

@Override
  protected void applyOnce(Project project) {
    project.getExtensions().add(NAME, project.container(EquinoxLaunchSetupTask.class, new NamedDomainObjectFactory<EquinoxLaunchSetupTask>() {
      @Override
      public EquinoxLaunchSetupTask create(String name) {
        EquinoxLaunchSetupTask setupTask = project.getTasks().create(name, EquinoxLaunchSetupTask.class);
        setupTask.setInstallDir(new File(project.getBuildDir(), name));
        return setupTask;
      }
    }));
  }
}

代码示例来源:origin: com.diffplug.gradle/image-grinder

@Override
  public void apply(Project project) {
    project.getExtensions().add(NAME, project.container(ImageGrinderTask.class, new NamedDomainObjectFactory<ImageGrinderTask>() {
      @Override
      public ImageGrinderTask create(String name) {
        ImageGrinderTask task = project.getTasks().create(name, ImageGrinderTask.class);
        if (name.startsWith("process")) {
          Task processResources = project.getTasks().getByName(JavaPlugin.PROCESS_RESOURCES_TASK_NAME);
          processResources.dependsOn(task);
        }
        return task;
      }
    }));
  }
}

代码示例来源:origin: classmethod/gradle-aws-plugin

public AwsBeanstalkPluginExtension(Project project) {
  super(project, AWSElasticBeanstalkClient.class);
  this.version = new EbAppVersionExtension();
  this.configurationTemplates = project.container(EbConfigurationTemplateExtension.class);
  this.environment = new EbEnvironmentExtension();
}

代码示例来源:origin: gradle.plugin.org.kravemir.gradle.sass/plugin

@Override
  public void apply(Project project) {
    project.getExtensions().add("sass", project.container(
        SassCompileTask.class,
        name -> project.getTasks().create(name + "Sass", SassCompileTask.class, task -> {
          task.setSassSetName(name);
          task.setGroup("sass");
        })
    ));
  }
}

代码示例来源:origin: gradle.plugin.com.github.kaklakariada.aws/aws-sam-gradle

private SamConfig createConfigDsl() {
  log.debug("Setup serverless config DSL");
  final NamedDomainObjectContainer<Stage> stages = project.container(Stage.class);
  final SamConfigDsl samConfig = project.getExtensions().create("serverless", SamConfigDsl.class, project,
      stages);
  ((ExtensionAware) samConfig).getExtensions().add("stages", stages);
  return new SamConfig(project, samConfig);
}

代码示例来源:origin: gradle.plugin.fi.evident.gradle.beanstalk/gradle-beanstalk-plugin

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);
        });
      }
    });
  }
}

代码示例来源:origin: EvidentSolutions/gradle-beanstalk-plugin

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);
        });
      }
    });
  }
}

代码示例来源:origin: typelead/gradle-eta

private void addEtaOptionsToDefaultConfig() {
  EtaOptions options = ExtensionHelper.createExtension
    (androidExtension, ETA_OPTIONS_DSL_NAME, EtaOptions.class)
    .setExtensions(project.container(LanguageExtension.class));
  options.setProjectPath(project.getProjectDir().toPath());
}

代码示例来源:origin: typelead/gradle-eta

private EtaOptions createEtaOptions() {
    EtaOptions options = project.getObjects().newInstance(EtaOptions.class)
      .setExtensions(project.container(LanguageExtension.class));
    options.setProjectPath(project.getProjectDir().toPath());
    return options;
  }
}

代码示例来源:origin: typelead/gradle-eta

private EtaOptions createEtaOptions() {
    EtaOptions options = project.getObjects().newInstance(EtaOptions.class)
      .setExtensions(project.container(LanguageExtension.class));
    options.setProjectPath(project.getProjectDir().toPath());
    return options;
  }
}

代码示例来源:origin: CoffeePartner/capt

@Override
public void apply(Project project) {
  project.getPlugins().matching(p -> p instanceof AppPlugin || p instanceof LibraryPlugin)
      .all(c -> {
        BaseExtension baseExtension = (BaseExtension) project.getExtensions().getByName("android");
        project.getExtensions().create(NAME, GradleCaptExtension.class, project.container(CaptPluginExtension.class));
        VariantManager variantManager = new VariantManager(createGlobalResource(project, baseExtension),
            baseExtension, project);
        // callCreate configurations for separate variant
        variantManager.createConfigurationForVariant();
        CaptTransform captTransform = new CaptTransform(variantManager);
        baseExtension.registerTransform(captTransform);
      });
}

代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin

public ClojureScriptExtension(Project project) {
 this.outputDir = project.getLayout().directoryProperty();
 this.builds = project.container(ClojureScriptBuild.class, name -> {
  ClojureScriptBuild build = new ClojureScriptBuild(project, name);
  build.getOutputDir().set(outputDir.dir(name));
  return build;
 });
}

代码示例来源:origin: gradle-clojure/gradle-clojure

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;
 });
}

代码示例来源:origin: gradle-clojure/gradle-clojure

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;
 });
}

代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin

public ClojureExtension(Project project) {
 this.outputDir = project.getLayout().directoryProperty();
 this.builds = project.container(ClojureBuild.class, name -> {
  ClojureBuild build = new ClojureBuild(project, name);
  build.getOutputDir().set(outputDir.dir(name));
  return build;
 });
}

代码示例来源:origin: io.freefair.gradle/war-plugin

@Override
public void apply(Project project) {
  this.project = project;
  project.getPluginManager().apply(WarPlugin.class);
  project.getTasks().withType(War.class, warTask -> {
    NamedDomainObjectContainer<WarOverlay> warOverlays = project.container(WarOverlay.class, name -> new WarOverlay(name, warTask));
    warTask.getExtensions().add("overlays", warOverlays);
    project.afterEvaluate(p -> warOverlays.all(overlay -> {
      if (overlay.isEnabled()) {
        configureOverlay(overlay);
      } else {
        Collection<CopySpecInternal> children = (Collection<CopySpecInternal>) overlay.getWarTask().getRootSpec().getChildren();
        children.remove(overlay.getWarCopySpec());
      }
    }));
  });
}

相关文章