Java Code Examples for org.gradle.util.CollectionUtils#flattenCollections()

The following examples show how to use org.gradle.util.CollectionUtils#flattenCollections() . 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: DependenciesSettings.java    From gradle-golang-plugin with Mozilla Public License 2.0 6 votes vote down vote up
@Nullable
public Object methodMissing(@Nonnull String name, @Nullable Object args) {
    final Object[] argsArray = (Object[]) args;
    final Configuration configuration = _project.getConfigurations().findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }
    final List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        //noinspection rawtypes
        return doAdd(name, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(name, normalizedArgs.get(0), null);
    } else {
        for (final Object arg : normalizedArgs) {
            doAdd(name, arg, null);
        }
        return null;
    }
}
 
Example 2
Source File: DefaultDependencyHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
 
Example 3
Source File: DefaultDependencyHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
 
Example 4
Source File: ForkingTestClassProcessor.java    From gradle-dockerized-test-plugin with Apache License 2.0 6 votes vote down vote up
List<URL> getTestWorkerImplementationClasspath() {
    return CollectionUtils.flattenCollections(URL.class,
            moduleRegistry.getModule("gradle-core-api").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-core").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-logging").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-messaging").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-base-services").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-cli").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-native").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-testing-base").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-testing-jvm").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getModule("gradle-process-services").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("slf4j-api").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("jul-to-slf4j").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("native-platform").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("kryo").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("commons-lang").getImplementationClasspath().getAsURLs(),
            moduleRegistry.getExternalModule("junit").getImplementationClasspath().getAsURLs(),
            ForkingTestClassProcessor.class.getProtectionDomain().getCodeSource().getLocation()
    );
}
 
Example 5
Source File: DefaultDependencyHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
 
Example 6
Source File: DefaultDependencyHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
 
Example 7
Source File: ArchitectureNotationParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void describe(Collection<String> candidateFormats) {
    List<String> validList = CollectionUtils.flattenCollections(String.class,
            X86_ALIASES, X86_64_ALIASES, ITANIUM_ALIASES, PPC_32_ALIASES, PPC_64_ALIASES, SPARC_32_ALIASES, SPARC_64_ALIASES, ARM_ALIASES
    );
    candidateFormats.add("One of the following values: " + GUtil.toString(validList));
}
 
Example 8
Source File: GenerateBuildDashboard.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Report> getEnabledInputReports() {
    Set<NamedDomainObjectSet<? extends Report>> enabledReportSets = CollectionUtils.collect(aggregated, new Transformer<NamedDomainObjectSet<? extends Report>, Reporting<? extends ReportContainer<?>>>() {
        public NamedDomainObjectSet<? extends Report> transform(Reporting<? extends ReportContainer<?>> reporting) {
            return reporting.getReports().getEnabled();
        }
    });
    return new LinkedHashSet<Report>(CollectionUtils.flattenCollections(Report.class, enabledReportSets));
}
 
Example 9
Source File: TwirlCompilerAdapterV13X.java    From playframework with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<String> getDependencyNotation() {
    VersionNumber scalaAsVersion = VersionNumber.parse(scalaVersion);
    if (scalaAsVersion.compareTo(VersionNumber.parse("2.12")) >= 0) {
        // We need scala.util.parsing.input.Positional
        return (List<String>) CollectionUtils.flattenCollections(super.getDependencyNotation(), "org.scala-lang.modules:scala-parser-combinators_" + scalaVersion + ":1.1.2");
    } else {
        return super.getDependencyNotation();
    }
}
 
Example 10
Source File: GenerateBuildDashboard.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Report> getEnabledInputReports() {
    Set<NamedDomainObjectSet<? extends Report>> enabledReportSets = CollectionUtils.collect(aggregated, new Transformer<NamedDomainObjectSet<? extends Report>, Reporting<? extends ReportContainer<?>>>() {
        public NamedDomainObjectSet<? extends Report> transform(Reporting<? extends ReportContainer<?>> reporting) {
            return reporting.getReports().getEnabled();
        }
    });
    return new LinkedHashSet<Report>(CollectionUtils.flattenCollections(Report.class, enabledReportSets));
}
 
Example 11
Source File: GenerateBuildDashboard.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Report> getEnabledInputReports() {
    Set<NamedDomainObjectSet<? extends Report>> enabledReportSets = CollectionUtils.collect(aggregated, new Transformer<NamedDomainObjectSet<? extends Report>, Reporting<? extends ReportContainer<?>>>() {
        public NamedDomainObjectSet<? extends Report> transform(Reporting<? extends ReportContainer<?>> reporting) {
            return reporting.getReports().getEnabled();
        }
    });
    return new LinkedHashSet<Report>(CollectionUtils.flattenCollections(Report.class, enabledReportSets));
}
 
Example 12
Source File: GenerateBuildDashboard.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Report> getEnabledInputReports() {
    Set<NamedDomainObjectSet<? extends Report>> enabledReportSets = CollectionUtils.collect(aggregated, new Transformer<NamedDomainObjectSet<? extends Report>, Reporting<? extends ReportContainer<?>>>() {
        public NamedDomainObjectSet<? extends Report> transform(Reporting<? extends ReportContainer<?>> reporting) {
            return reporting.getReports().getEnabled();
        }
    });
    return new LinkedHashSet<Report>(CollectionUtils.flattenCollections(Report.class, enabledReportSets));
}
 
Example 13
Source File: ArchitectureNotationParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void describe(Collection<String> candidateFormats) {
    List<String> validList = CollectionUtils.flattenCollections(String.class,
            X86_ALIASES, X86_64_ALIASES, ITANIUM_ALIASES, PPC_32_ALIASES, PPC_64_ALIASES, SPARC_32_ALIASES, SPARC_64_ALIASES, ARM_ALIASES
    );
    candidateFormats.add("One of the following values: " + GUtil.toString(validList));
}
 
Example 14
Source File: ProjectionBackedModelCreator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private Iterable<String> collectDescriptions(Transformer<Iterable<String>, ModelProjection<? super T>> transformer) {
    return CollectionUtils.flattenCollections(String.class, CollectionUtils.collect(projections, transformer));
}
 
Example 15
Source File: ArchitectureNotationParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void describe(Collection<String> candidateFormats) {
    List<String> validList = CollectionUtils.flattenCollections(String.class,
            X86_ALIASES, X86_64_ALIASES, ITANIUM_ALIASES, PPC_32_ALIASES, PPC_64_ALIASES, SPARC_32_ALIASES, SPARC_64_ALIASES, ARM_ALIASES
    );
    candidateFormats.add("One of the following values: " + GUtil.toString(validList));
}
 
Example 16
Source File: ArchitectureNotationParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void describe(Collection<String> candidateFormats) {
    List<String> validList = CollectionUtils.flattenCollections(String.class,
            X86_ALIASES, X86_64_ALIASES, ITANIUM_ALIASES, PPC_32_ALIASES, PPC_64_ALIASES, SPARC_32_ALIASES, SPARC_64_ALIASES, ARM_ALIASES
    );
    candidateFormats.add("One of the following values: " + GUtil.toString(validList));
}
 
Example 17
Source File: ProjectionBackedModelCreator.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private Iterable<String> collectDescriptions(Transformer<Iterable<String>, ModelProjection<? super T>> transformer) {
    return CollectionUtils.flattenCollections(String.class, CollectionUtils.collect(projections, transformer));
}