com.android.builder.model.SourceProviderContainer Java Examples
The following examples show how to use
com.android.builder.model.SourceProviderContainer.
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: AndroidSupport.java From meghanada-server with GNU General Public License v3.0 | 6 votes |
private static Map<String, Set<File>> getAndroidSources(ProductFlavorContainer defaultConfig) { Map<String, Set<File>> sources = new HashMap<>(8); ProductFlavor productFlavor = defaultConfig.getProductFlavor(); String name = productFlavor.getName(); SourceProvider sourceProvider = defaultConfig.getSourceProvider(); AndroidSupport.setAndroidSources(sources, sourceProvider, false); // extra Collection<SourceProviderContainer> extraSourceProviders = defaultConfig.getExtraSourceProviders(); extraSourceProviders.forEach( sourceProviderContainer -> { String artifactName = sourceProviderContainer.getArtifactName(); SourceProvider provider = sourceProviderContainer.getSourceProvider(); boolean isTest = artifactName.contains(TEST_SUFFIX); AndroidSupport.setAndroidSources(sources, provider, isTest); }); return sources; }
Example #2
Source File: BuildTypeContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
private BuildTypeContainerImpl( @NonNull BuildTypeImpl buildType, @NonNull SourceProviderImpl sourceProvider, @NonNull Collection<SourceProviderContainer> extraSourceProviders) { this.buildType = buildType; this.sourceProvider = sourceProvider; this.extraSourceProviders = extraSourceProviders; }
Example #3
Source File: BuildTypeContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Create a BuildTypeContainer from a BuildTypeData * * @param buildTypeData the build type data * @param sourceProviderContainers collection of extra source providers * @return a non-null BuildTypeContainer */ @NonNull static BuildTypeContainer create( @NonNull BuildTypeData buildTypeData, @NonNull Collection<SourceProviderContainer> sourceProviderContainers) { List<SourceProviderContainer> clonedContainers = SourceProviderContainerImpl.cloneCollection(sourceProviderContainers); return new BuildTypeContainerImpl( BuildTypeImpl.cloneBuildType(buildTypeData.getBuildType()), SourceProviderImpl.cloneProvider(buildTypeData.getSourceSet()), clonedContainers); }
Example #4
Source File: SourceProviderContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Create a {@link SourceProviderContainer} that is serializable to * use in the model sent through the tooling API. * * @param sourceProviderContainer the source provider * @return a non-null SourceProviderContainer */ @NonNull static SourceProviderContainer clone( @NonNull SourceProviderContainer sourceProviderContainer) { return create( sourceProviderContainer.getArtifactName(), sourceProviderContainer.getSourceProvider()); }
Example #5
Source File: SourceProviderContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
@NonNull static List<SourceProviderContainer> cloneCollection(@NonNull Collection<SourceProviderContainer> containers) { List<SourceProviderContainer> clones = Lists.newArrayListWithCapacity(containers.size()); for (SourceProviderContainer container : containers) { clones.add(clone(container)); } return clones; }
Example #6
Source File: SourceProviderContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
@NonNull static SourceProviderContainer create( @NonNull String name, @NonNull SourceProvider sourceProvider) { return new SourceProviderContainerImpl(name, SourceProviderImpl.cloneProvider(sourceProvider)); }
Example #7
Source File: ModelBuilder.java From javaide with GNU General Public License v3.0 | 5 votes |
@Nullable private static SourceProviderContainer getSourceProviderContainer( @NonNull Collection<SourceProviderContainer> items, @NonNull String name) { for (SourceProviderContainer item : items) { if (name.equals(item.getArtifactName())) { return item; } } return null; }
Example #8
Source File: ProductFlavorContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
private ProductFlavorContainerImpl( @NonNull ProductFlavorImpl productFlavor, @NonNull SourceProviderImpl sourceProvider, @NonNull Collection<SourceProviderContainer> extraSourceProviders) { this.productFlavor = productFlavor; this.sourceProvider = sourceProvider; this.extraSourceProviders = extraSourceProviders; }
Example #9
Source File: ProductFlavorContainerImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Create a ProductFlavorContainer from a ProductFlavorData * * @param productFlavorData the product flavor data * @param sourceProviderContainers collection of extra source providers * @return a non-null ProductFlavorContainer */ @NonNull static ProductFlavorContainer createProductFlavorContainer( @NonNull ProductFlavorData productFlavorData, @NonNull Collection<SourceProviderContainer> sourceProviderContainers) { List<SourceProviderContainer> clonedContainers = SourceProviderContainerImpl.cloneCollection(sourceProviderContainers); return new ProductFlavorContainerImpl( ProductFlavorImpl.cloneFlavor(productFlavorData.getProductFlavor(), null, null), SourceProviderImpl.cloneProvider(productFlavorData.getSourceSet()), clonedContainers); }
Example #10
Source File: ProductFlavors.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Nullable public static SourceProviderContainer getSourceProviderContainer(ProductFlavorContainer pfc, final String name) { return pfc == null || name == null ? null : Iterables.find( pfc.getExtraSourceProviders(), new Predicate<SourceProviderContainer>() { @Override public boolean apply(SourceProviderContainer t) { return name.equals(t.getArtifactName()); } }, null); }
Example #11
Source File: BuildTypeContainerImpl.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public Collection<SourceProviderContainer> getExtraSourceProviders() { return extraSourceProviders; }
Example #12
Source File: ProductFlavorContainerImpl.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public Collection<SourceProviderContainer> getExtraSourceProviders() { return extraSourceProviders; }
Example #13
Source File: ExtraModelInfo.java From javaide with GNU General Public License v3.0 | 4 votes |
public Collection<SourceProviderContainer> getExtraFlavorSourceProviders( @NonNull String flavorName) { return extraProductFlavorSourceProviders.get(flavorName); }
Example #14
Source File: ExtraModelInfo.java From javaide with GNU General Public License v3.0 | 4 votes |
public Collection<SourceProviderContainer> getExtraBuildTypeSourceProviders( @NonNull String buildTypeName) { return extraBuildTypeSourceProviders.get(buildTypeName); }
Example #15
Source File: AndroidClassPathProvider.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
@Override public Iterable<? extends File> get() { SourceProviderContainer spc = androidProjectModel != null ? ProductFlavors.getSourceProviderContainer(androidProjectModel.getDefaultConfig(), AndroidProject.ARTIFACT_ANDROID_TEST) : null; Collection<File> javaDirs = spc != null ? spc.getSourceProvider().getJavaDirectories() : Collections.<File>emptySet(); Variant variant = buildConfig.getCurrentVariant(); Iterable<File> variantJavaDirs = variant != null ? Iterables.concat( Iterables.transform( variant.getProductFlavors(), new Function<String, Collection<File>>() { @Override public Collection<File> apply(String f) { if (androidProjectModel == null) { return Collections.<File>emptySet(); } final ProductFlavorContainer flavor = ProductFlavors.findFlavorByName(androidProjectModel.getProductFlavors(), f); if (flavor == null) { return Collections.<File>emptySet(); } SourceProviderContainer flavorSPC = ProductFlavors.getSourceProviderContainer( flavor, AndroidProject.ARTIFACT_ANDROID_TEST); if (flavorSPC == null) { return Collections.<File>emptySet(); } return flavorSPC.getSourceProvider().getJavaDirectories(); } })) : Collections.<File>emptySet(); AndroidArtifact testArtifact = variant != null ? AndroidBuildVariants.instrumentTestArtifact(variant.getExtraAndroidArtifacts()) : null; Collection<File> generatedJavaDirs = testArtifact != null ? testArtifact.getGeneratedSourceFolders() : Collections.<File>emptyList(); return Iterables.concat( javaDirs, variantJavaDirs, generatedJavaDirs); }