Java 类org.gradle.api.internal.project.DefaultProject 实例源码

项目:Reer    文件:ProjectBuilderImpl.java   
public Project createChildProject(String name, Project parent, File projectDir) {
    ProjectInternal parentProject = (ProjectInternal) parent;
    DefaultProject project = CLASS_GENERATOR.newInstance(
            DefaultProject.class,
            name,
            parentProject,
            (projectDir != null) ? projectDir.getAbsoluteFile() : new File(parentProject.getProjectDir(), name),
            new StringScriptSource("test build file", null),
            parentProject.getGradle(),
            parentProject.getGradle().getServiceRegistryFactory(),
            parentProject.getClassLoaderScope().createChild("project-" + name),
            parentProject.getBaseClassLoaderScope()
    );
    parentProject.addChildProject(project);
    parentProject.getProjectRegistry().addProject(project);
    return project;
}
项目:Pushjet-Android    文件:ProjectBuilderImpl.java   
public Project createChildProject(String name, Project parent, File projectDir) {
    ProjectInternal parentProject = (ProjectInternal) parent;
    DefaultProject project = CLASS_GENERATOR.newInstance(
            DefaultProject.class,
            name,
            parentProject,
            (projectDir != null) ? projectDir.getAbsoluteFile() : new File(parentProject.getProjectDir(), name),
            new StringScriptSource("test build file", null),
            parentProject.getGradle(),
            parentProject.getGradle().getServiceRegistryFactory(),
            parentProject.getClassLoaderScope().createChild(),
            parentProject.getBaseClassLoaderScope()
    );
    parentProject.addChildProject(project);
    parentProject.getProjectRegistry().addProject(project);
    return project;
}
项目:Pushjet-Android    文件:ProjectBuilderImpl.java   
public Project createChildProject(String name, Project parent, File projectDir) {
    ProjectInternal parentProject = (ProjectInternal) parent;
    DefaultProject project = CLASS_GENERATOR.newInstance(
            DefaultProject.class,
            name,
            parentProject,
            (projectDir != null) ? projectDir.getAbsoluteFile() : new File(parentProject.getProjectDir(), name),
            new StringScriptSource("test build file", null),
            parentProject.getGradle(),
            parentProject.getGradle().getServiceRegistryFactory(),
            parentProject.getClassLoaderScope().createChild()
    );
    parentProject.addChildProject(project);
    parentProject.getProjectRegistry().addProject(project);
    return project;
}
项目:curiostack    文件:GrpcApiPluginTest.java   
@Test
public void normal() throws Exception {
  Project project = ProjectBuilder.builder().withName("api").build();
  project.setGroup("org.curioswitch.test");

  project.getPluginManager().apply(DependencyManagementPlugin.class);
  DependencyManagementExtension dependencyManagement =
      project.getExtensions().getByType(DependencyManagementExtension.class);
  dependencyManagement.dependencies(
      handler -> {
        handler.dependency("io.grpc:grpc-core:5.0.0");
        handler.dependency("io.grpc:grpc-protobuf:5.0.0");
        handler.dependency("io.grpc:grpc-stub:5.0.0");
        handler.dependency("com.google.protobuf:protoc:6.0.0");
      });

  project.getPluginManager().apply("org.curioswitch.gradle-grpc-api-plugin");
  project.setProperty("archivesBaseName", "curio-test-api");

  ((DefaultProject) project).evaluate();

  Task task = project.getTasks().findByName("generateProto");
  assertThat(task).isInstanceOf(GenerateProtoTask.class).isNotNull();
  GenerateProtoTask generateProtoTask = (GenerateProtoTask) task;
  // 2 output dirs for java and grpc, but they are the same in our config.
  String outputDir = project.getBuildDir().getAbsolutePath() + "/generated/source/proto/main";
  assertThat(generateProtoTask.getAllOutputDirs().stream().map(File::getAbsolutePath))
      .containsExactly(outputDir, outputDir);
  assertThat(generateProtoTask.getGenerateDescriptorSet()).isTrue();
  assertThat(generateProtoTask.getDescriptorSetOptions().getIncludeSourceInfo()).isTrue();
  assertThat(generateProtoTask.getDescriptorSetOptions().getIncludeImports()).isTrue();
  assertThat(generateProtoTask.getDescriptorSetOptions().getPath().toString())
      .isEqualTo(
          project.getBuildDir()
              + "/resources/main/META-INF/armeria/grpc/org.curioswitch.test.curio-test-api.dsc");

  ProtobufConfigurator protobuf =
      project.getConvention().getPlugin(ProtobufConvention.class).getProtobuf();
  protobuf.protoc(
      LambdaClosure.of(
          (ExecutableLocator locator) ->
              assertThat(locator.getArtifact()).isEqualTo("com.google.protobuf:protoc:6.0.0")));
  protobuf.plugins(
      LambdaClosure.of(
          (NamedDomainObjectContainer<ExecutableLocator> locators) ->
              assertThat(locators.getByName("grpc").getArtifact())
                  .isEqualTo("io.grpc:protoc-gen-grpc-java:5.0.0")));
}
项目:property-setter-gradle-plugin    文件:PropertySetterPluginTest.java   
@Before
public void setup() {
    project = (DefaultProject) ProjectBuilder.builder().withProjectDir(new File("build/tmp/" + getClass().getSimpleName())).build();
}
项目:sources-gradle-plugin    文件:SourcesPluginTest.java   
@Test
public void shouldApplyPlugin() {
    DefaultProject project = (DefaultProject) ProjectBuilder.builder().withProjectDir(new File("build/tmp/" + getClass().getSimpleName())).build();
    project.getPlugins().apply("sources");
}