private Collection<Provider<ASTType>> buildASTCollection( RoundEnvironment round, Class<? extends Annotation> annotation) { return reloadableASTElementFactory.buildProviders(round.getElementsAnnotatedWith(annotation)); }
@Override public boolean process( Set<? extends TypeElement> typeElements, RoundEnvironment roundEnvironment) { long start = System.currentTimeMillis(); // setup transfuse processor with manifest and R classes File manifestFile = manifestLocator.findManifest(); Manifest manifest = manifestParser.readManifest(manifestFile); RResourceComposite r = new RResourceComposite( buildR(rBuilder, manifest.getApplicationPackage() + ".R"), buildR(rBuilder, "android.R")); configurationScope.enter(); configurationScope.seed( ScopeKey.of(File.class) .annotatedBy("@javax.inject.Named(value=" + TransfuseAndroidModule.MANIFEST_FILE + ")"), manifestFile); configurationScope.seed(ScopeKey.of(RResource.class), r); configurationScope.seed( ScopeKey.of(Manifest.class) .annotatedBy( "@javax.inject.Named(value=" + TransfuseAndroidModule.ORIGINAL_MANIFEST + ")"), manifest); TransfuseProcessor transfuseProcessor = processorProvider.get(); if (!baseModuleConfiguration) { transfuseProcessor.submit( TransfuseModule.class, reloadableASTElementFactory.buildProviders( Collections.singleton(elements.getTypeElement(APIModule.class.getName())))); baseModuleConfiguration = true; } transfuseProcessor.submit( Application.class, buildASTCollection(roundEnvironment, Application.class)); transfuseProcessor.submit( TransfuseModule.class, buildASTCollection(roundEnvironment, TransfuseModule.class)); transfuseProcessor.submit( ImplementedBy.class, buildASTCollection(roundEnvironment, ImplementedBy.class)); transfuseProcessor.submit(Factory.class, buildASTCollection(roundEnvironment, Factory.class)); transfuseProcessor.submit(Activity.class, buildASTCollection(roundEnvironment, Activity.class)); transfuseProcessor.submit( BroadcastReceiver.class, buildASTCollection(roundEnvironment, BroadcastReceiver.class)); transfuseProcessor.submit(Service.class, buildASTCollection(roundEnvironment, Service.class)); transfuseProcessor.submit(Fragment.class, buildASTCollection(roundEnvironment, Fragment.class)); transfuseProcessor.execute(); if (roundEnvironment.processingOver()) { transfuseProcessor.checkForErrors(); } logger.info("Transfuse took " + (System.currentTimeMillis() - start) + "ms to process"); configurationScope.exit(); return true; }