Search in sources :

Example 6 with GradleDslElementList

use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList in project android by JetBrains.

the class DependencyConfigurationModel method excludes.

@NotNull
public List<ExcludedDependencyModel> excludes() {
    GradleDslElementList elementList = myConfigurationElement.getPropertyElement(EXCLUDE, GradleDslElementList.class);
    if (elementList == null) {
        return ImmutableList.of();
    }
    List<ExcludedDependencyModel> excludedDependencies = new ArrayList<>();
    for (GradleDslExpressionMap excludeElement : elementList.getElements(GradleDslExpressionMap.class)) {
        excludedDependencies.add(new ExcludedDependencyModel(excludeElement));
    }
    return excludedDependencies;
}
Also used : GradleDslElementList(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList) GradleDslExpressionMap(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpressionMap) ArrayList(java.util.ArrayList) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with GradleDslElementList

use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList in project android by JetBrains.

the class DependenciesModel method all.

/**
   * @return all the dependencies (artifact, module, etc.)
   * WIP: Do not use.
   */
@NotNull
public List<DependencyModel> all() {
    List<DependencyModel> dependencies = Lists.newArrayList();
    for (String configurationName : myDslElement.getProperties()) {
        GradleDslElementList list = myDslElement.getPropertyElement(configurationName, GradleDslElementList.class);
        if (list != null) {
            for (GradleDslElement element : list.getElements(GradleDslElement.class)) {
                dependencies.addAll(ArtifactDependencyModel.create(element));
                if (element instanceof GradleDslMethodCall) {
                    GradleDslMethodCall methodCall = (GradleDslMethodCall) element;
                    dependencies.addAll(ModuleDependencyModel.create(configurationName, methodCall));
                }
            }
        }
    }
    return dependencies;
}
Also used : GradleDslElementList(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList) GradleDslMethodCall(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslMethodCall) GradleDslElement(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElement) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with GradleDslElementList

use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList in project android by JetBrains.

the class DependenciesModel method addModule.

@NotNull
public DependenciesModel addModule(@NotNull String configurationName, @NotNull String path, @Nullable String config) {
    GradleDslElementList list = getOrCreateGradleDslElementList(configurationName);
    ModuleDependencyModel.createAndAddToList(list, configurationName, path, config);
    return this;
}
Also used : GradleDslElementList(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with GradleDslElementList

use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList in project android by JetBrains.

the class DependenciesModel method addFile.

@NotNull
public DependenciesModel addFile(@NotNull String configurationName, @NotNull String file) {
    GradleDslElementList list = getOrCreateGradleDslElementList(configurationName);
    FileDependencyModel.createAndAddToList(list, configurationName, file);
    return this;
}
Also used : GradleDslElementList(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with GradleDslElementList

use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList in project android by JetBrains.

the class DependencyConfigurationDslElement method addParsedElement.

@Override
public void addParsedElement(@NotNull String property, @NotNull GradleDslElement element) {
    if (property.equals("exclude")) {
        GradleDslElementList elementList = getPropertyElement(property, GradleDslElementList.class);
        if (elementList == null) {
            elementList = new GradleDslElementList(this, property);
            super.addParsedElement(property, elementList);
        }
        elementList.addParsedElement(element);
        return;
    }
    super.addParsedElement(property, element);
}
Also used : GradleDslElementList(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList)

Aggregations

GradleDslElementList (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElementList)13 NotNull (org.jetbrains.annotations.NotNull)9 GradleDslElement (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslElement)2 GradleDslMethodCall (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslMethodCall)2 GradleDslExpressionList (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpressionList)1 GradleDslExpressionMap (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpressionMap)1 ArrayList (java.util.ArrayList)1