コード例 #1
0
ファイル: Test.java プロジェクト: timofonic/Pushjet-Android
  @Inject
  public Test(
      ListenerManager listenerManager,
      StyledTextOutputFactory textOutputFactory,
      FileResolver fileResolver,
      Factory<WorkerProcessBuilder> processBuilderFactory,
      ActorFactory actorFactory,
      Instantiator instantiator,
      ProgressLoggerFactory progressLoggerFactory) {
    this.progressLoggerFactory = progressLoggerFactory;
    this.instantiator = instantiator;
    testListenerBroadcaster = listenerManager.createAnonymousBroadcaster(TestListener.class);
    testOutputListenerBroadcaster =
        listenerManager.createAnonymousBroadcaster(TestOutputListener.class);
    this.textOutputFactory = textOutputFactory;
    forkOptions = new DefaultJavaForkOptions(fileResolver);
    forkOptions.setEnableAssertions(true);
    testExecuter = new DefaultTestExecuter(processBuilderFactory, actorFactory);
    testLogging = instantiator.newInstance(DefaultTestLoggingContainer.class, instantiator);
    testReporter = new DefaultTestReport();

    reports = instantiator.newInstance(DefaultTestTaskReports.class, this);
    reports.getJunitXml().setEnabled(true);
    reports.getHtml().setEnabled(true);

    filter = instantiator.newInstance(DefaultTestFilter.class);
  }
コード例 #2
0
 public DefaultComponentMetadataHandler getComponentMetadataHandler() {
   if (componentMetadataHandler == null) {
     Instantiator instantiator = parent.get(Instantiator.class);
     componentMetadataHandler =
         instantiator.newInstance(DefaultComponentMetadataHandler.class, instantiator);
   }
   return componentMetadataHandler;
 }
コード例 #3
0
 public void layout(String layoutName) {
   if ("maven".equals(layoutName)) {
     layout = instantiator.newInstance(MavenRepositoryLayout.class);
   } else if ("pattern".equals(layoutName)) {
     layout = instantiator.newInstance(PatternRepositoryLayout.class);
   } else {
     layout = instantiator.newInstance(GradleRepositoryLayout.class);
   }
 }
コード例 #4
0
ファイル: VisualStudioPlugin.java プロジェクト: k3mist/gradle
    @Model
    public static VisualStudioExtensionInternal visualStudio(ServiceRegistry serviceRegistry) {
      Instantiator instantiator = serviceRegistry.get(Instantiator.class);
      ProjectLocator projectLocator = serviceRegistry.get(ProjectLocator.class);
      FileResolver fileResolver = serviceRegistry.get(FileResolver.class);

      return instantiator.newInstance(
          DefaultVisualStudioExtension.class, instantiator, projectLocator, fileResolver);
    }
コード例 #5
0
 @Override
 protected Configuration doCreate(String name) {
   return instantiator.newInstance(
       DefaultConfiguration.class,
       context.absoluteProjectPath(name),
       name,
       this,
       dependencyResolver,
       listenerManager,
       dependencyMetaDataProvider,
       instantiator.newInstance(DefaultResolutionStrategy.class));
 }
コード例 #6
0
 public ConfigurationContainerInternal getConfigurationContainer() {
   if (configurationContainer == null) {
     final Instantiator instantiator = parent.get(Instantiator.class);
     ConfigurationResolver resolver = createDependencyResolver(getResolveRepositoryHandler());
     configurationContainer =
         instantiator.newInstance(
             DefaultConfigurationContainer.class,
             resolver,
             instantiator,
             domainObjectContext,
             parent.get(ListenerManager.class),
             dependencyMetaDataProvider);
   }
   return configurationContainer;
 }
コード例 #7
0
 @Override
 public DeploymentDescriptor securityRole(Action<? super EarSecurityRole> action) {
   EarSecurityRole role = instantiator.newInstance(DefaultEarSecurityRole.class);
   action.execute(role);
   securityRoles.add(role);
   return this;
 }
コード例 #8
0
ファイル: JacocoPlugin.java プロジェクト: Cazen/gradle
  public void apply(ProjectInternal project) {
    project.getPluginManager().apply(ReportingBasePlugin.class);
    this.project = project;
    addJacocoConfigurations();
    JacocoAgentJar agent = instantiator.newInstance(JacocoAgentJar.class, project);
    JacocoPluginExtension extension =
        project
            .getExtensions()
            .create(PLUGIN_EXTENSION_NAME, JacocoPluginExtension.class, project, agent);
    final ReportingExtension reportingExtension =
        (ReportingExtension) project.getExtensions().getByName(ReportingExtension.NAME);
    ((IConventionAware) extension)
        .getConventionMapping()
        .map(
            "reportsDir",
            new Callable<File>() {
              @Override
              public File call() {
                return reportingExtension.file("jacoco");
              }
            });

    configureAgentDependencies(agent, extension);
    configureTaskClasspathDefaults(extension);
    applyToDefaultTasks(extension);
    configureDefaultOutputPathForJacocoMerge();
    configureJacocoReportsDefaults(extension);
    addDefaultReportTasks(extension);
  }
コード例 #9
0
 public FlatDirectoryArtifactRepository createFlatDirRepository() {
   return instantiator.newInstance(
       DefaultFlatDirArtifactRepository.class,
       fileResolver,
       transportFactory,
       locallyAvailableResourceFinder,
       metaDataParser);
 }
コード例 #10
0
 public DefaultIvyPublication(
     String name,
     Instantiator instantiator,
     IvyPublicationIdentity publicationIdentity,
     NotationParser<Object, IvyArtifact> ivyArtifactNotationParser,
     ProjectDependencyPublicationResolver projectDependencyResolver,
     FileCollectionFactory fileCollectionFactory) {
   this.name = name;
   this.publicationIdentity = publicationIdentity;
   this.projectDependencyResolver = projectDependencyResolver;
   configurations = instantiator.newInstance(DefaultIvyConfigurationContainer.class, instantiator);
   ivyArtifacts =
       instantiator.newInstance(
           DefaultIvyArtifactSet.class, name, ivyArtifactNotationParser, fileCollectionFactory);
   ivyDependencies = instantiator.newInstance(DefaultIvyDependencySet.class);
   descriptor = instantiator.newInstance(DefaultIvyModuleDescriptorSpec.class, this);
 }
コード例 #11
0
 public MavenArtifactRepository createMavenRepository() {
   return instantiator.newInstance(
       DefaultMavenArtifactRepository.class,
       fileResolver,
       createPasswordCredentials(),
       transportFactory,
       locallyAvailableResourceFinder,
       metaDataParser);
 }
コード例 #12
0
 public void apply(Project project) {
   RepositoryHandler repositories =
       artifactPublicationServicesFactory.create().getRepositoryHandler();
   PublicationContainer publications =
       instantiator.newInstance(DefaultPublicationContainer.class, instantiator);
   project
       .getExtensions()
       .create(
           PublishingExtension.NAME, DefaultPublishingExtension.class, repositories, publications);
 }
コード例 #13
0
 public IvyArtifactRepository createIvyRepository() {
   return instantiator.newInstance(
       DefaultIvyArtifactRepository.class,
       fileResolver,
       createPasswordCredentials(),
       transportFactory,
       locallyAvailableResourceFinder,
       instantiator,
       resolverStrategy);
 }
コード例 #14
0
 protected PluginManagerInternal createPluginManager(Instantiator instantiator) {
   PluginApplicator applicator =
       new RuleBasedPluginApplicator<ProjectInternal>(
           project, get(ModelRuleExtractor.class), get(ModelRuleSourceDetector.class));
   return instantiator.newInstance(
       DefaultPluginManager.class,
       get(PluginRegistry.class),
       new DependencyInjectingInstantiator(this),
       applicator);
 }
コード例 #15
0
 protected T parseMap(
     @MapKey("group") @Optional String group,
     @MapKey("name") @Optional String name,
     @MapKey("version") @Optional String version,
     @MapKey("configuration") @Optional String configuration,
     @MapKey("ext") @Optional String ext,
     @MapKey("classifier") @Optional String classifier) {
   T dependency = instantiator.newInstance(resultingType, group, name, version, configuration);
   ModuleFactoryHelper.addExplicitArtifactsIfDefined(dependency, ext, classifier);
   return dependency;
 }
コード例 #16
0
 public MavenArtifactRepository createMavenLocalRepository() {
   MavenArtifactRepository mavenRepository =
       instantiator.newInstance(
           DefaultMavenLocalArtifactRepository.class,
           fileResolver,
           createPasswordCredentials(),
           transportFactory,
           locallyAvailableResourceFinder,
           resolverStrategy);
   final File localMavenRepository = localMavenRepositoryLocator.getLocalMavenRepository();
   mavenRepository.setUrl(localMavenRepository);
   return mavenRepository;
 }
コード例 #17
0
  private T createDependencyFromString(String notation) {

    ParsedModuleStringNotation parsedNotation = splitModuleFromExtension(notation);
    T moduleDependency =
        instantiator.newInstance(
            wantedType,
            parsedNotation.getGroup(),
            parsedNotation.getName(),
            parsedNotation.getVersion());
    ModuleFactoryHelper.addExplicitArtifactsIfDefined(
        moduleDependency, parsedNotation.getArtifactType(), parsedNotation.getClassifier());

    return moduleDependency;
  }
コード例 #18
0
 private FunctionalSourceSet createGoogleTestSources(
     final Instantiator instantiator,
     final String suiteName,
     ProjectSourceSet projectSourceSet,
     final FileResolver fileResolver) {
   final FunctionalSourceSet functionalSourceSet =
       instantiator.newInstance(
           DefaultFunctionalSourceSet.class, suiteName, instantiator, projectSourceSet);
   functionalSourceSet.registerFactory(
       CppSourceSet.class,
       new NamedDomainObjectFactory<CppSourceSet>() {
         public CppSourceSet create(String name) {
           return BaseLanguageSourceSet.create(
               DefaultCppSourceSet.class, name, suiteName, fileResolver, instantiator);
         }
       });
   return functionalSourceSet;
 }
コード例 #19
0
  public void apply(final Project project) {
    RepositoryHandler repositories = publicationServices.createRepositoryHandler();
    PublicationContainer publications =
        instantiator.newInstance(DefaultPublicationContainer.class, instantiator);

    // TODO Registering an extension should register it with the model registry as well
    final PublishingExtension extension =
        project
            .getExtensions()
            .create(
                PublishingExtension.NAME,
                DefaultPublishingExtension.class,
                repositories,
                publications);

    project.afterEvaluate(
        new Action<Project>() {
          public void execute(Project project) {
            for (Publication publication : extension.getPublications()) {
              PublicationInternal internalPublication = (PublicationInternal) publication;
              publicationRegistry.registerPublication(
                  project.getPath(),
                  new DefaultProjectPublication(internalPublication.getCoordinates()));
            }
          }
        });

    ModelPath extensionModelPath = ModelPath.path(PublishingExtension.NAME);

    modelRules.register(extensionModelPath.toString(), extension);

    modelRules.rule(
        new ModelRule() {
          public void triggerDeferredConfigurables(PublishingExtension publishingExtension) {
            project.getExtensions().getByType(DefaultPublishingExtension.class);
          }
        });

    Task publishLifecycleTask = project.getTasks().create(PUBLISH_LIFECYCLE_TASK_NAME);
    publishLifecycleTask.setDescription("Publishes all publications produced by this project.");
    publishLifecycleTask.setGroup(PUBLISH_TASK_GROUP);
  }
コード例 #20
0
 public static <T extends BaseLanguageSourceSet> T create(
     Class<T> type,
     String name,
     String parentName,
     FileResolver fileResolver,
     Instantiator instantiator) {
   if (type.equals(BaseLanguageSourceSet.class)) {
     throw new ModelInstantiationException(
         "Cannot create instance of abstract class BaseLanguageSourceSet.");
   }
   nextSourceSetInfo.set(new SourceSetInfo(name, parentName, type.getSimpleName(), fileResolver));
   try {
     try {
       return instantiator.newInstance(type);
     } catch (ObjectInstantiationException e) {
       throw new ModelInstantiationException(
           String.format("Could not create LanguageSourceSet of type %s", type.getSimpleName()),
           e.getCause());
     }
   } finally {
     nextSourceSetInfo.set(null);
   }
 }
コード例 #21
0
 protected SoftwareComponentContainer createSoftwareComponentContainer() {
   Instantiator instantiator = get(Instantiator.class);
   return instantiator.newInstance(DefaultSoftwareComponentContainer.class, instantiator);
 }
コード例 #22
0
 private PasswordCredentials createPasswordCredentials() {
   return instantiator.newInstance(DefaultPasswordCredentials.class);
 }
コード例 #23
0
 @Model
 TestSuiteContainer testSuites(ServiceRegistry serviceRegistry) {
   Instantiator instantiator = serviceRegistry.get(Instantiator.class);
   return instantiator.newInstance(DefaultTestSuiteContainer.class, instantiator);
 }
コード例 #24
0
 private DefaultRepositoryHandler createRepositoryHandler() {
   Instantiator instantiator = parent.get(Instantiator.class);
   return instantiator.newInstance(
       DefaultRepositoryHandler.class, getRepositoryFactory(), instantiator);
 }