Example #1
0
  @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);
  }
 public DefaultComponentMetadataHandler getComponentMetadataHandler() {
   if (componentMetadataHandler == null) {
     Instantiator instantiator = parent.get(Instantiator.class);
     componentMetadataHandler =
         instantiator.newInstance(DefaultComponentMetadataHandler.class, instantiator);
   }
   return componentMetadataHandler;
 }
 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);
   }
 }
Example #4
0
    @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);
    }
 @Override
 protected Configuration doCreate(String name) {
   return instantiator.newInstance(
       DefaultConfiguration.class,
       context.absoluteProjectPath(name),
       name,
       this,
       dependencyResolver,
       listenerManager,
       dependencyMetaDataProvider,
       instantiator.newInstance(DefaultResolutionStrategy.class));
 }
 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;
 }
 @Override
 public DeploymentDescriptor securityRole(Action<? super EarSecurityRole> action) {
   EarSecurityRole role = instantiator.newInstance(DefaultEarSecurityRole.class);
   action.execute(role);
   securityRoles.add(role);
   return this;
 }
Example #8
0
  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);
  }
 public FlatDirectoryArtifactRepository createFlatDirRepository() {
   return instantiator.newInstance(
       DefaultFlatDirArtifactRepository.class,
       fileResolver,
       transportFactory,
       locallyAvailableResourceFinder,
       metaDataParser);
 }
Example #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);
 }
 public MavenArtifactRepository createMavenRepository() {
   return instantiator.newInstance(
       DefaultMavenArtifactRepository.class,
       fileResolver,
       createPasswordCredentials(),
       transportFactory,
       locallyAvailableResourceFinder,
       metaDataParser);
 }
Example #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);
 }
 public IvyArtifactRepository createIvyRepository() {
   return instantiator.newInstance(
       DefaultIvyArtifactRepository.class,
       fileResolver,
       createPasswordCredentials(),
       transportFactory,
       locallyAvailableResourceFinder,
       instantiator,
       resolverStrategy);
 }
 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);
 }
 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;
 }
 public MavenArtifactRepository createMavenLocalRepository() {
   MavenArtifactRepository mavenRepository =
       instantiator.newInstance(
           DefaultMavenLocalArtifactRepository.class,
           fileResolver,
           createPasswordCredentials(),
           transportFactory,
           locallyAvailableResourceFinder,
           resolverStrategy);
   final File localMavenRepository = localMavenRepositoryLocator.getLocalMavenRepository();
   mavenRepository.setUrl(localMavenRepository);
   return mavenRepository;
 }
  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;
  }
 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;
 }
Example #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);
  }
 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);
   }
 }
 protected SoftwareComponentContainer createSoftwareComponentContainer() {
   Instantiator instantiator = get(Instantiator.class);
   return instantiator.newInstance(DefaultSoftwareComponentContainer.class, instantiator);
 }
 private PasswordCredentials createPasswordCredentials() {
   return instantiator.newInstance(DefaultPasswordCredentials.class);
 }
 @Model
 TestSuiteContainer testSuites(ServiceRegistry serviceRegistry) {
   Instantiator instantiator = serviceRegistry.get(Instantiator.class);
   return instantiator.newInstance(DefaultTestSuiteContainer.class, instantiator);
 }
 private DefaultRepositoryHandler createRepositoryHandler() {
   Instantiator instantiator = parent.get(Instantiator.class);
   return instantiator.newInstance(
       DefaultRepositoryHandler.class, getRepositoryFactory(), instantiator);
 }