com.android.builder.model.SourceProvider Java Examples

The following examples show how to use com.android.builder.model.SourceProvider. 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: MergeAwbAssets.java    From atlas with Apache License 2.0 6 votes vote down vote up
@Override
        public void execute(@NonNull MergeAwbAssets mergeAssetsTask) {
            BaseVariantData variantData = scope.getVariantData();
            VariantConfiguration variantConfig = variantData.getVariantConfiguration();

            mergeAssetsTask.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
            mergeAssetsTask.setVariantName(variantConfig.getFullName());
            mergeAssetsTask.setIncrementalFolder(scope.getIncrementalDir(getName()));
            final Project project = scope.getGlobalScope().getProject();

            final Function<SourceProvider, Collection<File>> assetDirFunction =
                    SourceProvider::getShadersDirectories;
//            mergeAssetsTask.assetSetSupplier =
//                    () -> variantConfig.getSourceFilesAsAssetSets(assetDirFunction);
//            mergeAssetsTask.sourceFolderInputs =
//                    TaskInputHelper.bypassFileSupplier(
//                            () -> variantConfig.getSourceFiles(assetDirFunction));
            mergeAssetsTask.assetSetSupplier = () -> ImmutableList.of();
            mergeAssetsTask.sourceFolderInputs = () -> ImmutableList.of();

            mergeAssetsTask.awbBundle = awbBundle;
            if (!variantConfig.getType().equals(VariantType.LIBRARY)) {
                mergeAssetsTask.libraries = awbBundle.getAndroidLibraries();
            }
            mergeAssetsTask.setOutputDir(variantContext.getMergeShadersOutputDir(awbBundle));
        }
 
Example #2
Source File: BaseArtifactImpl.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
BaseArtifactImpl(@NonNull String name,
                 @NonNull String assembleTaskName,
                 @NonNull String compileTaskName,
                 @NonNull File classesFolder,
                 @NonNull File javaResourcesFolder,
                 @NonNull Dependencies dependencies,
                 @Nullable SourceProvider variantSourceProvider,
                 @Nullable SourceProvider multiFlavorSourceProviders,
                 @NonNull Collection<File> generatedSourceFolders) {
    this.name = name;
    this.assembleTaskName = assembleTaskName;
    this.compileTaskName = compileTaskName;
    this.classesFolder = classesFolder;
    this.javaResourcesFolder = javaResourcesFolder;
    this.dependencies = dependencies;
    this.variantSourceProvider = variantSourceProvider;
    this.multiFlavorSourceProviders = multiFlavorSourceProviders;
    this.generatedSourceFolders = generatedSourceFolders;
}
 
Example #3
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the configuration with the base source sets, and an optional tested variant.
 *
 * @param defaultConfig           the default configuration. Required.
 * @param defaultSourceProvider   the default source provider. Required
 * @param buildType               the build type for this variant. Required.
 * @param buildTypeSourceProvider the source provider for the build type.
 * @param type                    the type of the project.
 * @param signingConfigOverride   an optional Signing override to be used for signing.
 */
public VariantConfiguration(
        @NonNull D defaultConfig,
        @NonNull SourceProvider defaultSourceProvider,
        @NonNull T buildType,
        @Nullable SourceProvider buildTypeSourceProvider,
        @NonNull VariantType type,
        @Nullable SigningConfig signingConfigOverride) {
    checkNotNull(defaultConfig);
    checkNotNull(defaultSourceProvider);
    checkNotNull(buildType);
    checkNotNull(type);
    checkArgument(
            true,
            "You have to specify the tested variant for this variant type.");

    mDefaultConfig = checkNotNull(defaultConfig);
    mDefaultSourceProvider = checkNotNull(defaultSourceProvider);
    mBuildType = checkNotNull(buildType);
    mBuildTypeSourceProvider = buildTypeSourceProvider;
    mType = checkNotNull(type);
    mSigningConfigOverride = signingConfigOverride;
    mMergedFlavor = DefaultProductFlavor.clone(mDefaultConfig);
}
 
Example #4
Source File: SourceProviderImpl.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
static SourceProviderImpl cloneProvider(@NonNull SourceProvider sourceProvider) {
    SourceProviderImpl sourceProviderClone = new SourceProviderImpl();

    sourceProviderClone.name = sourceProvider.getName();
    sourceProviderClone.manifestFile = sourceProvider.getManifestFile();
    sourceProviderClone.javaDirs = sourceProvider.getJavaDirectories();
    sourceProviderClone.resourcesDirs = sourceProvider.getResourcesDirectories();
    sourceProviderClone.aidlDirs = sourceProvider.getAidlDirectories();
    sourceProviderClone.cDirs = sourceProvider.getCDirectories();
    sourceProviderClone.cppDirs = sourceProvider.getCDirectories();
    sourceProviderClone.resDirs = sourceProvider.getResDirectories();
    sourceProviderClone.assetsDirs = sourceProvider.getAssetsDirectories();
    sourceProviderClone.libsDirs = sourceProvider.getJniLibsDirectories();

    return sourceProviderClone;
}
 
Example #5
Source File: JavaArtifactImpl.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public static JavaArtifactImpl clone(@NonNull JavaArtifact javaArtifact) {
    SourceProvider variantSP = javaArtifact.getVariantSourceProvider();
    SourceProvider flavorsSP = javaArtifact.getMultiFlavorSourceProvider();

    return new JavaArtifactImpl(
            javaArtifact.getName(),
            javaArtifact.getAssembleTaskName(),
            javaArtifact.getCompileTaskName(),
            javaArtifact.getIdeSetupTaskNames(),
            javaArtifact.getGeneratedSourceFolders(),
            javaArtifact.getClassesFolder(),
            javaArtifact.getJavaResourcesFolder(),
            javaArtifact.getMockablePlatformJar(),
            DependenciesImpl.cloneDependenciesForJavaArtifacts(javaArtifact.getDependencies()),
            variantSP != null ? SourceProviderImpl.cloneProvider(variantSP) : null,
            flavorsSP != null ? SourceProviderImpl.cloneProvider(flavorsSP) : null);
}
 
Example #6
Source File: JavaArtifactImpl.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public JavaArtifactImpl(@NonNull String name,
                        @NonNull String assembleTaskName,
                        @NonNull String compileTaskName,
                        @NonNull Iterable<String> ideSetupTaskNames,
                        @NonNull Collection<File> generatedSourceFolders,
                        @NonNull File classesFolder,
                        @NonNull File javaResourcesFolder,
                        @Nullable File mockablePlatformJar,
                        @NonNull Dependencies dependencies,
                        @Nullable SourceProvider variantSourceProvider,
                        @Nullable SourceProvider multiFlavorSourceProviders) {
    super(name, assembleTaskName, compileTaskName, classesFolder, javaResourcesFolder,
            dependencies,
            variantSourceProvider, multiFlavorSourceProviders, generatedSourceFolders);
    this.ideSetupTaskNames = Sets.newHashSet(ideSetupTaskNames);
    this.mockablePlatformJar = mockablePlatformJar;
}
 
Example #7
Source File: BaseVariantData.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns a list of configuration name for wear connection, from highest to lowest priority.
 *
 * @return list of config.
 */
@NonNull
public List<String> getWearConfigNames() {
    List<SourceProvider> providers = variantConfiguration.getSortedSourceProviders();

    // this is the wrong order, so let's reverse it as we gather the names.
    final int count = providers.size();
    List<String> names = Lists.newArrayListWithCapacity(count);
    for (int i = count - 1; i >= 0; i--) {
        DefaultAndroidSourceSet sourceSet = (DefaultAndroidSourceSet) providers.get(i);

        names.add(sourceSet.getWearAppConfigurationName());
    }

    return names;
}
 
Example #8
Source File: LintGradleProject.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public List<File> getResourceFolders() {
    if (mResourceFolders == null) {
        mResourceFolders = Lists.newArrayList();
        for (SourceProvider provider : getSourceProviders()) {
            Collection<File> resDirs = provider.getResDirectories();
            for (File res : resDirs) {
                if (res.exists()) { // model returns path whether or not it exists
                    mResourceFolders.add(res);
                }
            }
        }

        for (File file : mVariant.getMainArtifact().getGeneratedResourceFolders()) {
            if (file.exists()) {
                mResourceFolders.add(file);
            }
        }

    }

    return mResourceFolders;
}
 
Example #9
Source File: AndroidSupport.java    From meghanada-server with GNU General Public License v3.0 6 votes vote down vote up
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 #10
Source File: BlazeAndroidModel.java    From intellij with Apache License 2.0 6 votes vote down vote up
/** Creates a new {@link BlazeAndroidModel}. */
public BlazeAndroidModel(
    Project project,
    File rootDirPath,
    SourceProvider sourceProvider,
    String applicationId,
    int minSdkVersion,
    boolean desugarJava8Libs) {
  this.project = project;
  this.rootDirPath = rootDirPath;
  this.sourceProvider = sourceProvider;
  this.sourceProviders = ImmutableList.of(sourceProvider);
  this.applicationId = applicationId;
  this.minSdkVersion = minSdkVersion;
  this.desugarJava8Libs = desugarJava8Libs;
}
 
Example #11
Source File: LintGradleProject.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public List<File> getJavaSourceFolders() {
    if (mJavaSourceFolders == null) {
        mJavaSourceFolders = Lists.newArrayList();
        for (SourceProvider provider : getSourceProviders()) {
            Collection<File> srcDirs = provider.getJavaDirectories();
            for (File srcDir : srcDirs) {
                if (srcDir.exists()) { // model returns path whether or not it exists
                    mJavaSourceFolders.add(srcDir);
                }
            }
        }

        for (File file : mVariant.getMainArtifact().getGeneratedSourceFolders()) {
            if (file.exists()) {
                mJavaSourceFolders.add(file);
            }
        }
    }

    return mJavaSourceFolders;
}
 
Example #12
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add a new configured ProductFlavor.
 * <p>
 * If multiple flavors are added, the priority follows the order they are added when it
 * comes to resolving Android resources overlays (ie earlier added flavors supersedes
 * latter added ones).
 *
 * @param productFlavor  the configured product flavor
 * @param sourceProvider the source provider for the product flavor
 * @param dimensionName  the name of the dimension associated with the flavor
 * @return the config object
 */
@NonNull
public VariantConfiguration addProductFlavor(
        @NonNull F productFlavor,
        @NonNull SourceProvider sourceProvider,
        @NonNull String dimensionName) {

    mFlavors.add(productFlavor);
    mFlavorSourceProviders.add(sourceProvider);
    mFlavorDimensionNames.add(dimensionName);

    mMergedFlavor = DefaultProductFlavor.mergeFlavors(mMergedFlavor, productFlavor);

    return this;
}
 
Example #13
Source File: ExtraModelInfo.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void registerBuildTypeSourceProvider(@NonNull String name,
                                            @NonNull CoreBuildType buildType,
                                            @NonNull SourceProvider sourceProvider) {
    if (extraArtifactMap.get(name) == null) {
        throw new IllegalArgumentException(String.format(
                "Artifact with name %1$s is not yet registered. Use registerArtifactType()",
                name));
    }

    extraBuildTypeSourceProviders.put(buildType.getName(),
            new DefaultSourceProviderContainer(name, sourceProvider));

}
 
Example #14
Source File: ExtraModelInfo.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void registerProductFlavorSourceProvider(@NonNull String name,
                                                @NonNull CoreProductFlavor productFlavor,
                                                @NonNull SourceProvider sourceProvider) {
    if (extraArtifactMap.get(name) == null) {
        throw new IllegalArgumentException(String.format(
                "Artifact with name %1$s is not yet registered. Use registerArtifactType()",
                name));
    }

    extraProductFlavorSourceProviders.put(productFlavor.getName(),
            new DefaultSourceProviderContainer(name, sourceProvider));

}
 
Example #15
Source File: BlazeAndroidModelTest.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
protected void initTest(Container applicationServices, Container projectServices) {
  applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
  applicationServices.register(
      FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
  applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
  applicationServices.register(BlazeBuildService.class, new BlazeBuildService());
  projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
  projectServices.register(ProjectViewManager.class, new MockProjectViewManager());

  BlazeProjectDataManager mockProjectDataManager =
      new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder().build());
  projectServices.register(BlazeProjectDataManager.class, mockProjectDataManager);

  BlazeImportSettingsManager manager = new BlazeImportSettingsManager(project);
  manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
  projectServices.register(BlazeImportSettingsManager.class, manager);
  projectServices.register(JvmPsiConversionHelper.class, new JvmPsiConversionHelperImpl());

  facade =
      new MockJavaPsiFacade(
          project,
          ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));

  projectServices.register(JavaPsiFacade.class, facade);
  module = new MockModule(() -> {});
  model = new BlazeAndroidModel(project, null, mock(SourceProvider.class), null, 0, false);
}
 
Example #16
Source File: ExtraModelInfo.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void registerMultiFlavorSourceProvider(@NonNull String name,
                                              @NonNull String flavorName,
                                              @NonNull SourceProvider sourceProvider) {
    if (extraArtifactMap.get(name) == null) {
        throw new IllegalArgumentException(String.format(
                "Artifact with name %1$s is not yet registered. Use registerArtifactType()",
                name));
    }

    extraMultiFlavorSourceProviders.put(flavorName,
            new DefaultSourceProviderContainer(name, sourceProvider));
}
 
Example #17
Source File: ExtraModelInfo.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void registerJavaArtifact(
        @NonNull String name,
        @NonNull BaseVariant variant,
        @NonNull String assembleTaskName,
        @NonNull String javaCompileTaskName,
        @NonNull Collection<File> generatedSourceFolders,
        @NonNull Iterable<String> ideSetupTaskNames,
        @NonNull Configuration configuration,
        @NonNull File classesFolder,
        @NonNull File javaResourcesFolder,
        @Nullable SourceProvider sourceProvider) {
    ArtifactMetaData artifactMetaData = extraArtifactMap.get(name);
    if (artifactMetaData == null) {
        throw new IllegalArgumentException(String.format(
                "Artifact with name %1$s is not yet registered. Use registerArtifactType()",
                name));
    }
    if (artifactMetaData.getType() != ArtifactMetaData.TYPE_JAVA) {
        throw new IllegalArgumentException(
                String.format("Artifact with name %1$s is not of type JAVA", name));
    }

    JavaArtifact artifact = new JavaArtifactImpl(
            name, assembleTaskName, javaCompileTaskName, ideSetupTaskNames,
            generatedSourceFolders, classesFolder, javaResourcesFolder, null,
            new ConfigurationDependencies(configuration), sourceProvider, null);

    extraJavaArtifacts.put(variant.getName(), artifact);
}
 
Example #18
Source File: GradleVariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a {@link GradleVariantConfiguration} for a normal (non-test) variant.
 */
public GradleVariantConfiguration(
        @NonNull CoreProductFlavor defaultConfig,
        @NonNull SourceProvider defaultSourceProvider,
        @NonNull CoreBuildType buildType,
        @Nullable SourceProvider buildTypeSourceProvider,
        @NonNull VariantType type,
        @Nullable SigningConfig signingConfigOverride) {
    super(defaultConfig, defaultSourceProvider, buildType, buildTypeSourceProvider, type,
            signingConfigOverride);
}
 
Example #19
Source File: GradleVariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public VariantConfiguration addProductFlavor(
        @NonNull CoreProductFlavor productFlavor,
        @NonNull SourceProvider sourceProvider,
        @NonNull String dimensionName) {
    checkNotNull(productFlavor);
    checkNotNull(sourceProvider);
    checkNotNull(dimensionName);
    super.addProductFlavor(productFlavor, sourceProvider, dimensionName);
    return this;
}
 
Example #20
Source File: BaseExtension.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public void registerJavaArtifact(
        @NonNull String name,
        @NonNull BaseVariant variant,
        @NonNull String assembleTaskName,
        @NonNull String javaCompileTaskName,
        @NonNull Collection<File> generatedSourceFolders,
        @NonNull Iterable<String> ideSetupTaskNames,
        @NonNull Configuration configuration,
        @NonNull File classesFolder,
        @NonNull File javaResourceFolder,
        @Nullable SourceProvider sourceProvider) {
    extraModelInfo.registerJavaArtifact(name, variant, assembleTaskName,
            javaCompileTaskName, generatedSourceFolders, ideSetupTaskNames,
            configuration, classesFolder, javaResourceFolder, sourceProvider);
}
 
Example #21
Source File: MergeAwbAssets.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
        public void execute(@NonNull MergeAwbAssets mergeAssetsTask) {
            BaseVariantData variantData = scope.getVariantData();
            VariantConfiguration variantConfig = variantData.getVariantConfiguration();
            mergeAssetsTask.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
            mergeAssetsTask.setVariantName(variantConfig.getFullName());
            mergeAssetsTask.setIncrementalFolder(scope.getIncrementalDir(getName()));
            final Project project = scope.getGlobalScope().getProject();

            final Function<SourceProvider, Collection<File>> assetDirFunction =
                    SourceProvider::getAssetsDirectories;
//            mergeAssetsTask.assetSetSupplier =
//                    () -> variantConfig.getSourceFilesAsAssetSets(assetDirFunction);

            mergeAssetsTask.assetSetSupplier = ()-> ImmutableList.of();
            mergeAssetsTask.sourceFolderInputs = () -> ImmutableList.of();
//            mergeAssetsTask.sourceFolderInputs =
//                    TaskInputHelper.bypassFileSupplier(
//                            () -> variantConfig.getSourceFiles(assetDirFunction));

            mergeAssetsTask.shadersOutputDir = project.files(variantContext.getAwbShadersOutputDir(awbBundle));
            if (variantData.copyApkTask != null) {
                mergeAssetsTask.copyApk = project.files(variantData.copyApkTask.getDestinationDir());
            }

            AaptOptions options = scope.getGlobalScope().getExtension().getAaptOptions();
            if (options != null) {
                mergeAssetsTask.ignoreAssets = options.getIgnoreAssets();
            }

            if (!variantConfig.getType().equals(VariantType.LIBRARY)) {
                mergeAssetsTask.libraries = awbBundle.getAndroidLibraries();
            }

            mergeAssetsTask.awbBundle = awbBundle;
            mergeAssetsTask.variantContext = (AppVariantContext) this.variantContext;
            mergeAssetsTask.setOutputDir(outputDir);
        }
 
Example #22
Source File: BlazeAndroidProjectStructureSyncerCompat.java    From intellij with Apache License 2.0 5 votes vote down vote up
static void updateAndroidFacetWithSourceAndModel(
    AndroidFacet facet, SourceProvider sourceProvider, BlazeAndroidModel androidModel) {
  facet.getProperties().RES_FOLDERS_RELATIVE_PATH =
      sourceProvider.getResDirectories().stream()
          .map(it -> pathToUrl(it.getAbsolutePath()))
          .collect(
              Collectors.joining(
                  AndroidFacetProperties.PATH_LIST_SEPARATOR_IN_FACET_CONFIGURATION));
  facet.getProperties().TEST_RES_FOLDERS_RELATIVE_PATH = "";
  AndroidModel.set(facet, androidModel);
}
 
Example #23
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier
 * items are meant to be overridden by later items.
 *
 * @return a list of source provider
 */
@NonNull
public List<SourceProvider> getSortedSourceProviders() {
    List<SourceProvider> providers = Lists.newArrayList();

    // first the default source provider
    providers.add(mDefaultSourceProvider);

    // the list of flavor must be reversed to use the right overlay order.
    for (int n = mFlavorSourceProviders.size() - 1; n >= 0; n--) {
        providers.add(mFlavorSourceProviders.get(n));
    }

    // multiflavor specific overrides flavor
    if (mMultiFlavorSourceProvider != null) {
        providers.add(mMultiFlavorSourceProvider);
    }

    // build type overrides flavors
    if (mBuildTypeSourceProvider != null) {
        providers.add(mBuildTypeSourceProvider);
    }

    // variant specific overrides all
    if (mVariantSourceProvider != null) {
        providers.add(mVariantSourceProvider);
    }

    return providers;
}
 
Example #24
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public List<File> getAidlSourceList() {
    List<SourceProvider> providers = getSortedSourceProviders();

    List<File> sourceList = Lists.newArrayListWithExpectedSize(providers.size());

    for (SourceProvider provider : providers) {
        sourceList.addAll(provider.getAidlDirectories());
    }

    return sourceList;
}
 
Example #25
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public List<File> getJniSourceList() {
    List<SourceProvider> providers = getSortedSourceProviders();

    List<File> sourceList = Lists.newArrayListWithExpectedSize(providers.size());

    for (SourceProvider provider : providers) {
        sourceList.addAll(provider.getCDirectories());
    }

    return sourceList;
}
 
Example #26
Source File: VariantConfiguration.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public List<File> getJniLibsList() {
    List<SourceProvider> providers = getSortedSourceProviders();

    List<File> sourceList = Lists.newArrayListWithExpectedSize(providers.size());

    for (SourceProvider provider : providers) {
        sourceList.addAll(provider.getJniLibsDirectories());
    }

    return sourceList;
}
 
Example #27
Source File: ProcessJavaResConfigAction.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void execute(@NonNull Sync processResources) {
    scope.getVariantData().processJavaResourcesTask = processResources;

    // set the input
    processResources.from(((AndroidSourceSet) scope.getVariantConfiguration().getDefaultSourceSet()).getResources().getSourceFiles());
    processResources.from(((AndroidSourceSet) scope.getVariantConfiguration().getBuildTypeSourceSet()).getResources().getSourceFiles());
    if (scope.getVariantConfiguration().hasFlavors()) {
        for (SourceProvider flavorSourceSet : scope.getVariantConfiguration().getFlavorSourceProviders()) {
            processResources.from(((AndroidSourceSet) flavorSourceSet).getResources().getSourceFiles());
        }

    }
    processResources.setDestinationDir(new File(scope.getSourceFoldersJavaResDestinationDir(), "src"));
}
 
Example #28
Source File: AndroidArtifactImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
AndroidArtifactImpl(
        @NonNull String name,
        @NonNull Collection<AndroidArtifactOutput> outputs,
        @NonNull String assembleTaskName,
        boolean isSigned,
        @Nullable String signingConfigName,
        @NonNull String applicationId,
        @NonNull String sourceGenTaskName,
        @NonNull String compileTaskName,
        @NonNull List<File> generatedSourceFolders,
        @NonNull List<File> generatedResourceFolders,
        @NonNull File classesFolder,
        @NonNull File javaResourcesFolder,
        @NonNull Dependencies dependencies,
        @Nullable SourceProvider variantSourceProvider,
        @Nullable SourceProvider multiFlavorSourceProviders,
        @NonNull Collection<NativeLibrary> nativeLibraries,
        @NonNull Map<String, ClassField> buildConfigFields,
        @NonNull Map<String, ClassField> resValues) {
    super(name, assembleTaskName, compileTaskName, classesFolder, javaResourcesFolder,
            dependencies, variantSourceProvider, multiFlavorSourceProviders,
            generatedSourceFolders);

    this.outputs = outputs;
    this.isSigned = isSigned;
    this.signingConfigName = signingConfigName;
    this.applicationId = applicationId;
    this.sourceGenTaskName = sourceGenTaskName;
    this.generatedResourceFolders = generatedResourceFolders;
    this.nativeLibraries = nativeLibraries;
    this.buildConfigFields = buildConfigFields;
    this.resValues = resValues;
}
 
Example #29
Source File: ModelBuilder.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private static SourceProviders determineSourceProviders(
        @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData) {
    SourceProvider variantSourceProvider =
            variantData.getVariantConfiguration().getVariantSourceProvider();
    SourceProvider multiFlavorSourceProvider =
            variantData.getVariantConfiguration().getMultiFlavorSourceProvider();

    return new SourceProviders(
            variantSourceProvider != null ?
                    SourceProviderImpl.cloneProvider(variantSourceProvider) :
                    null,
            multiFlavorSourceProvider != null ?
                    SourceProviderImpl.cloneProvider(multiFlavorSourceProvider) :
                    null);
}
 
Example #30
Source File: SourceProviderContainerImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
static SourceProviderContainer create(
        @NonNull String name,
        @NonNull SourceProvider sourceProvider) {
    return new SourceProviderContainerImpl(name,
            SourceProviderImpl.cloneProvider(sourceProvider));
}