Search in sources :

Example 1 with VersionGradleEditorEntity

use of com.android.tools.idea.gradle.editor.entity.VersionGradleEditorEntity in project android by JetBrains.

the class GradleEditorModelParserFacade method buildEntities.

@NotNull
private static List<GradleEditorEntityGroup> buildEntities(@NotNull GradleEditorModelParseContext context) {
    VersionGradleEditorEntity entity = GradleEditorModelParserV1.buildGradlePluginVersion(context);
    GradleCoordinate androidGradlePluginVersion = null;
    if (entity != null) {
        String currentVersion = entity.getCurrentValue();
        if (!currentVersion.isEmpty()) {
            androidGradlePluginVersion = GradleCoordinate.parseVersionOnly(currentVersion);
        }
    }
    if (androidGradlePluginVersion == null) {
        androidGradlePluginVersion = GradleCoordinate.parseVersionOnly("0");
    }
    Comparator<GradleCoordinate> c = GradleCoordinate.COMPARE_PLUS_HIGHER;
    for (GradleEditorModelParser parser : ourParsers) {
        if (c.compare(androidGradlePluginVersion, parser.getMinSupportedAndroidGradlePluginVersion()) >= 0 && c.compare(androidGradlePluginVersion, parser.getMaxSupportedAndroidGradlePluginVersion()) < 0) {
            return parser.buildEntities(context);
        }
    }
    return Collections.emptyList();
}
Also used : VersionGradleEditorEntity(com.android.tools.idea.gradle.editor.entity.VersionGradleEditorEntity) GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)1 VersionGradleEditorEntity (com.android.tools.idea.gradle.editor.entity.VersionGradleEditorEntity)1 NotNull (org.jetbrains.annotations.NotNull)1