Java Code Examples for org.gradle.api.Project#getObjects()

The following examples show how to use org.gradle.api.Project#getObjects() . 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: FirebaseLibraryExtension.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Inject
public FirebaseLibraryExtension(Project project, LibraryType type) {
  this.project = project;
  this.type = type;
  this.testLab = new FirebaseTestLabExtension(project.getObjects());
  this.artifactId = project.getObjects().property(String.class);
  this.groupId = project.getObjects().property(String.class);

  if ("ktx".equals(project.getName()) && project.getParent() != null) {
    artifactId.set(new DefaultProvider<>(() -> project.getParent().getName() + "-ktx"));
    groupId.set(new DefaultProvider<>(() -> project.getParent().getGroup().toString()));
  } else {
    artifactId.set(new DefaultProvider<>(project::getName));
    groupId.set(new DefaultProvider<>(() -> project.getGroup().toString()));
  }
  this.staticAnalysis = initializeStaticAnalysis(project);
}
 
Example 2
Source File: ServerExtension.java    From curiostack with MIT License 6 votes vote down vote up
static ServerExtension createAndAdd(Project project) {
  var objects = project.getObjects();

  ModifiableServerExtension extension =
      project
          .getExtensions()
          .create(NAME, ModifiableServerExtension.class)
          .setImagePrefix(objects.property(String.class))
          .setImageTag(objects.property(String.class).value("latest"))
          .setBaseName(objects.property(String.class))
          .setBaseImage(objects.property(String.class).value("curiostack/java-cloud-runner:14"));
  extension.setDeployments(
      project.container(
          AutoDeployment.class, name -> AutoDeployment.create(name, objects, extension)));

  return extension;
}
 
Example 3
Source File: AndroidComponent.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AndroidComponent(Configuration compileConfiguration, DependencySet compileDependencies, Project project) {
    this.compileConfiguration = compileConfiguration;
    this.compileDependencies = compileDependencies;
    this.project = project;
    ObjectFactory factory = project.getObjects();
    apiUsage = factory.named(Usage.class, Usage.JAVA_API);
    runtimeUsage = factory.named(Usage.class, Usage.JAVA_RUNTIME);

}
 
Example 4
Source File: ToolDownloaderExtension.java    From curiostack with MIT License 5 votes vote down vote up
static ToolDownloaderExtension create(String name, Project project) {
  var objects = project.getObjects();

  var extension =
      objects
          .newInstance(ModifiableToolDownloaderExtension.class)
          .setName(name)
          .setArtifact(objects.property(String.class))
          .setVersion(objects.property(String.class))
          .setBaseUrl(objects.property(String.class))
          .setArtifactPattern(objects.property(String.class))
          .setPathSubDirs(objects.listProperty(String.class).empty())
          .setAdditionalCachedDirs(objects.listProperty(String.class).empty());

  extension.getArtifact().set(name);

  var osClassifiers =
      objects
          .newInstance(ModifiableOsValues.class)
          .setLinux(objects.property(String.class))
          .setMac(objects.property(String.class))
          .setWindows(objects.property(String.class));
  osClassifiers.getLinux().set("linux-amd64");
  osClassifiers.getMac().set("darwin-amd64");
  osClassifiers.getWindows().set("windows-amd64");
  extension.setOsClassifiers(osClassifiers);

  var osExtensions =
      objects
          .newInstance(ModifiableOsValues.class)
          .setLinux(objects.property(String.class))
          .setMac(objects.property(String.class))
          .setWindows(objects.property(String.class));
  osExtensions.getLinux().set("tar.gz");
  osExtensions.getMac().set("tar.gz");
  osExtensions.getWindows().set("zip");
  extension.setOsExtensions(osExtensions);

  return extension;
}
 
Example 5
Source File: DatabaseExtension.java    From curiostack with MIT License 5 votes vote down vote up
static DatabaseExtension create(Project project) {
  var objects = project.getObjects();
  var extension =
      project
          .getExtensions()
          .create(NAME, ModifiableDatabaseExtension.class)
          .setDbName(objects.property(String.class))
          .setAdminUser(objects.property(String.class).value("root"))
          .setAdminPassword(objects.property(String.class));

  return extension;
}
 
Example 6
Source File: GcloudExtension.java    From curiostack with MIT License 5 votes vote down vote up
static GcloudExtension create(Project project) {
  var objects = project.getObjects();
  var extension =
      project
          .getExtensions()
          .create(NAME, ModifiableGcloudExtension.class)
          .setCloudRegion(objects.property(String.class))
          .setClusterBaseName(objects.property(String.class));
  extension.setClusterRegion(
      objects.property(String.class).convention(extension.getCloudRegion()));
  extension.setClusterName(
      objects
          .property(String.class)
          .convention(clusterResourceName(extension.getClusterBaseName(), "cluster")));
  extension.setClusterProject(
      objects
          .property(String.class)
          .convention(clusterResourceName(extension.getClusterBaseName(), "cluster")));
  extension.setContainerRegistry(
      objects
          .property(String.class)
          .convention(
              extension
                  .getCloudRegion()
                  .map(
                      value -> {
                        if (value.startsWith("asia")) {
                          return "asia.gcr.io";
                        } else if (value.startsWith("europe")) {
                          return "eu.gcr.io";
                        } else {
                          return "gcr.io";
                        }
                      })));
  extension.setBuildCacheStorageBucket(
      objects
          .property(String.class)
          .convention(clusterResourceName(extension.getClusterBaseName(), "gradle-build-cache")));
  return extension;
}
 
Example 7
Source File: CiExtension.java    From curiostack with MIT License 5 votes vote down vote up
static CiExtension createAndAdd(Project project) {
  var objects = project.getObjects();

  return project
      .getExtensions()
      .create(NAME, ModifiableCiExtension.class)
      .setReleaseTagPrefixes(
          project.container(
              ReleaseTagSettings.class, name -> ReleaseTagSettings.create(name, objects)))
      .setCodeCoverageExcludedProjects(project.getObjects().listProperty(String.class).empty());
}
 
Example 8
Source File: TerraformSetupExtension.java    From curiostack with MIT License 5 votes vote down vote up
static TerraformSetupExtension create(Project project) {
  var objects = project.getObjects();

  var extension =
      project
          .getExtensions()
          .create(NAME, ModifiableTerraformSetupExtension.class)
          .setProviders(
              project.container(
                  CustomProvider.class, name -> CustomProvider.create(name, objects)));

  return extension;
}
 
Example 9
Source File: TerraformExtension.java    From curiostack with MIT License 5 votes vote down vote up
static TerraformExtension create(Project project) {
  var objects = project.getObjects();

  return project
      .getExtensions()
      .create(NAME, ModifiableTerraformExtension.class)
      .setDependencies(objects.listProperty(String.class).empty());
}
 
Example 10
Source File: StaticSiteExtension.java    From curiostack with MIT License 5 votes vote down vote up
static StaticSiteExtension create(Project project) {
  var objects = project.getObjects();

  var extension =
      project
          .getExtensions()
          .create(NAME, ModifiableStaticSiteExtension.class)
          .setFirebaseProject(objects.property(String.class))
          .setAutoDeployAlpha(objects.property(Boolean.class).convention(true))
          .setSites(objects.listProperty(SiteProject.class).empty());
  extension.setAppEngineProject(
      objects.property(String.class).convention(extension.getFirebaseProject()));

  return extension;
}
 
Example 11
Source File: GolangExtension.java    From curiostack with MIT License 5 votes vote down vote up
static ModifiableGolangExtension createAndAdd(Project project) {
  var objects = project.getObjects();
  var extension =
      project
          .getExtensions()
          .create(NAME, ModifiableGolangExtension.class)
          .setExecutableName(objects.property(String.class))
          .setGoOses(objects.listProperty(String.class).empty())
          .setGoArchs(objects.listProperty(String.class).empty())
          .setConda(objects.property(String.class).value("miniconda-build"))
          .setJib(Jib.create(objects));
  return extension;
}
 
Example 12
Source File: ProtobufExtension.java    From curiostack with MIT License 5 votes vote down vote up
static ModifiableProtobufExtension createAndAdd(Project project) {
  ObjectFactory objects = project.getObjects();

  ModifiableProtobufExtension extension =
      project
          .getExtensions()
          .create(NAME, ModifiableProtobufExtension.class)
          .setSources(
              project.container(
                  SourceDirectorySet.class,
                  name -> {
                    var directorySet =
                        objects.sourceDirectorySet(name, name).srcDir("src/" + name + "/proto");
                    directorySet.include("**/*.proto");
                    return directorySet;
                  }))
          .setOutputBaseDir(objects.property(File.class))
          .setProtoc(Executable.create(objects))
          .setDescriptorSetOptions(DescriptorSetOptions.create(objects));
  extension.setLanguages(
      project.container(
          LanguageSettings.class, name -> LanguageSettings.create(name, project.getObjects())));

  extension.getOutputBaseDir().set(project.file("build/generated/proto"));

  return extension;
}