org.gradle.util.WrapUtil Java Examples

The following examples show how to use org.gradle.util.WrapUtil. 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: JavaBasePlugin.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private void configureBasedOnSingleProperty(final Test test) {
    String singleTest = getTaskPrefixedProperty(test, "single");
    if (singleTest == null) {
        //configure inputs so that the test task is skipped when there are no source files.
        //unfortunately, this only applies when 'test.single' is *not* applied
        //We should fix this distinction, the behavior with 'test.single' or without it should be the same
        test.getInputs().files(test.getCandidateClassFiles()).withPropertyName("test.candidateClassFiles").skipWhenEmpty();
        return;
    }
    test.prependParallelSafeAction(new Action<Task>() {
        public void execute(Task task) {
            test.getLogger().info("Running single tests with pattern: {}", test.getIncludes());
        }
    });
    test.setIncludes(WrapUtil.toSet("**/" + singleTest + "*.class"));
    test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest));
}
 
Example #2
Source File: JavaBasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureBasedOnSingleProperty(final Test test) {
    String singleTest = getTaskPrefixedProperty(test, "single");
    if (singleTest == null) {
        //configure inputs so that the test task is skipped when there are no source files.
        //unfortunately, this only applies when 'test.single' is *not* applied
        //We should fix this distinction, the behavior with 'test.single' or without it should be the same
        test.getInputs().source(test.getCandidateClassFiles());
        return;
    }
    test.doFirst(new Action<Task>() {
        public void execute(Task task) {
            test.getLogger().info("Running single tests with pattern: {}", test.getIncludes());
        }
    });
    test.setIncludes(WrapUtil.toSet(String.format("**/%s*.class", singleTest)));
    test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest));
}
 
Example #3
Source File: DefaultScriptCompilationHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public <T extends Script> Class<? extends T> loadFromDir(ScriptSource source, ClassLoader classLoader, File scriptCacheDir,
                                          Class<T> scriptBaseClass) {
    if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
        return emptyScriptGenerator.generate(scriptBaseClass);
    }
    
    try {
        URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()),
                classLoader);
        return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
    } catch (Exception e) {
        File expectedClassFile = new File(scriptCacheDir, source.getClassName()+".class");
        if(!expectedClassFile.exists()){
            throw new GradleException(String.format("Could not load compiled classes for %s from cache. Expected class file %s does not exist.", source.getDisplayName(), expectedClassFile.getAbsolutePath()), e);
        }
        throw new GradleException(String.format("Could not load compiled classes for %s from cache.", source.getDisplayName()), e);
    }
}
 
Example #4
Source File: DefaultOsgiManifest.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public DefaultManifest getEffectiveManifest() {
    ContainedVersionAnalyzer analyzer = analyzerFactory.create();
    DefaultManifest effectiveManifest = new DefaultManifest(null);
    try {
        setAnalyzerProperties(analyzer);
        Manifest osgiManifest = analyzer.calcManifest();
        java.util.jar.Attributes attributes = osgiManifest.getMainAttributes();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
        }
        effectiveManifest.attributes(this.getAttributes());
        for (Map.Entry<String, Attributes> ent : getSections().entrySet()) {
            effectiveManifest.attributes(ent.getValue(), ent.getKey());
        }
        if (classesDir != null) {
            long mod = classesDir.lastModified();
            if (mod > 0) {
                effectiveManifest.getAttributes().put(Analyzer.BND_LASTMODIFIED, mod);
            }
        }
    } catch (Exception e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
    return getEffectiveManifestInternal(effectiveManifest);
}
 
Example #5
Source File: JavaBasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureBasedOnSingleProperty(final Test test) {
    String singleTest = getTaskPrefixedProperty(test, "single");
    if (singleTest == null) {
        //configure inputs so that the test task is skipped when there are no source files.
        //unfortunately, this only applies when 'test.single' is *not* applied
        //We should fix this distinction, the behavior with 'test.single' or without it should be the same
        test.getInputs().source(test.getCandidateClassFiles());
        return;
    }
    test.doFirst(new Action<Task>() {
        public void execute(Task task) {
            test.getLogger().info("Running single tests with pattern: {}", test.getIncludes());
        }
    });
    test.setIncludes(WrapUtil.toSet(String.format("**/%s*.class", singleTest)));
    test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest));
}
 
Example #6
Source File: DefaultScriptCompilationHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public <T extends Script> Class<? extends T> loadFromDir(ScriptSource source, ClassLoader classLoader, File scriptCacheDir,
                                                         Class<T> scriptBaseClass) {
    if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
        return emptyScriptGenerator.generate(scriptBaseClass);
    }

    try {
        URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()), classLoader);
        return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
    } catch (Exception e) {
        File expectedClassFile = new File(scriptCacheDir, source.getClassName() + ".class");
        if (!expectedClassFile.exists()) {
            throw new GradleException(String.format("Could not load compiled classes for %s from cache. Expected class file %s does not exist.", source.getDisplayName(), expectedClassFile.getAbsolutePath()), e);
        }
        throw new GradleException(String.format("Could not load compiled classes for %s from cache.", source.getDisplayName()), e);
    }
}
 
Example #7
Source File: DefaultOsgiManifest.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public DefaultManifest getEffectiveManifest() {
    ContainedVersionAnalyzer analyzer = analyzerFactory.create();
    DefaultManifest effectiveManifest = new DefaultManifest(null);
    try {
        setAnalyzerProperties(analyzer);
        Manifest osgiManifest = analyzer.calcManifest();
        java.util.jar.Attributes attributes = osgiManifest.getMainAttributes();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
        }
        effectiveManifest.attributes(this.getAttributes());
        for (Map.Entry<String, Attributes> ent : getSections().entrySet()) {
            effectiveManifest.attributes(ent.getValue(), ent.getKey());
        }
        if (classesDir != null) {
            long mod = classesDir.lastModified();
            if (mod > 0) {
                effectiveManifest.getAttributes().put(Analyzer.BND_LASTMODIFIED, mod);
            }
        }
    } catch (Exception e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
    return getEffectiveManifestInternal(effectiveManifest);
}
 
Example #8
Source File: JavaBasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureBasedOnSingleProperty(final Test test) {
    String singleTest = getTaskPrefixedProperty(test, "single");
    if (singleTest == null) {
        //configure inputs so that the test task is skipped when there are no source files.
        //unfortunately, this only applies when 'test.single' is *not* applied
        //We should fix this distinction, the behavior with 'test.single' or without it should be the same
        test.getInputs().source(test.getCandidateClassFiles());
        return;
    }
    test.doFirst(new Action<Task>() {
        public void execute(Task task) {
            test.getLogger().info("Running single tests with pattern: {}", test.getIncludes());
        }
    });
    test.setIncludes(WrapUtil.toSet(String.format("**/%s*.class", singleTest)));
    test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest));
}
 
Example #9
Source File: DefaultScriptCompilationHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public <T extends Script> Class<? extends T> loadFromDir(ScriptSource source, ClassLoader classLoader, File scriptCacheDir,
                                          Class<T> scriptBaseClass) {
    if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
        return emptyScriptGenerator.generate(scriptBaseClass);
    }
    
    try {
        URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()),
                classLoader);
        return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
    } catch (Exception e) {
        File expectedClassFile = new File(scriptCacheDir, source.getClassName()+".class");
        if(!expectedClassFile.exists()){
            throw new GradleException(String.format("Could not load compiled classes for %s from cache. Expected class file %s does not exist.", source.getDisplayName(), expectedClassFile.getAbsolutePath()), e);
        }
        throw new GradleException(String.format("Could not load compiled classes for %s from cache.", source.getDisplayName()), e);
    }
}
 
Example #10
Source File: DefaultOsgiManifest.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public DefaultManifest getEffectiveManifest() {
    ContainedVersionAnalyzer analyzer = analyzerFactory.create();
    DefaultManifest effectiveManifest = new DefaultManifest(null);
    try {
        setAnalyzerProperties(analyzer);
        Manifest osgiManifest = analyzer.calcManifest();
        java.util.jar.Attributes attributes = osgiManifest.getMainAttributes();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
        }
        effectiveManifest.attributes(this.getAttributes());
        for (Map.Entry<String, Attributes> ent : getSections().entrySet()) {
            effectiveManifest.attributes(ent.getValue(), ent.getKey());
        }
        if (classesDir != null) {
            long mod = classesDir.lastModified();
            if (mod > 0) {
                effectiveManifest.getAttributes().put(Analyzer.BND_LASTMODIFIED, mod);
            }
        }
    } catch (Exception e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
    return getEffectiveManifestInternal(effectiveManifest);
}
 
Example #11
Source File: JavaBasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureBasedOnSingleProperty(final Test test) {
    String singleTest = getTaskPrefixedProperty(test, "single");
    if (singleTest == null) {
        //configure inputs so that the test task is skipped when there are no source files.
        //unfortunately, this only applies when 'test.single' is *not* applied
        //We should fix this distinction, the behavior with 'test.single' or without it should be the same
        test.getInputs().source(test.getCandidateClassFiles());
        return;
    }
    test.doFirst(new Action<Task>() {
        public void execute(Task task) {
            test.getLogger().info("Running single tests with pattern: {}", test.getIncludes());
        }
    });
    test.setIncludes(WrapUtil.toSet(String.format("**/%s*.class", singleTest)));
    test.addTestListener(new NoMatchingTestsReporter("Could not find matching test for pattern: " + singleTest));
}
 
Example #12
Source File: DefaultScriptCompilationHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public <T extends Script> Class<? extends T> loadFromDir(ScriptSource source, ClassLoader classLoader, File scriptCacheDir,
                                                         Class<T> scriptBaseClass) {
    if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
        return emptyScriptGenerator.generate(scriptBaseClass);
    }

    try {
        URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()), classLoader);
        return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
    } catch (Exception e) {
        File expectedClassFile = new File(scriptCacheDir, source.getClassName() + ".class");
        if (!expectedClassFile.exists()) {
            throw new GradleException(String.format("Could not load compiled classes for %s from cache. Expected class file %s does not exist.", source.getDisplayName(), expectedClassFile.getAbsolutePath()), e);
        }
        throw new GradleException(String.format("Could not load compiled classes for %s from cache.", source.getDisplayName()), e);
    }
}
 
Example #13
Source File: DefaultOsgiManifest.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public DefaultManifest getEffectiveManifest() {
    ContainedVersionAnalyzer analyzer = analyzerFactory.create();
    DefaultManifest effectiveManifest = new DefaultManifest(null);
    try {
        setAnalyzerProperties(analyzer);
        Manifest osgiManifest = analyzer.calcManifest();
        java.util.jar.Attributes attributes = osgiManifest.getMainAttributes();
        for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
            effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
        }
        effectiveManifest.attributes(this.getAttributes());
        for (Map.Entry<String, Attributes> ent : getSections().entrySet()) {
            effectiveManifest.attributes(ent.getValue(), ent.getKey());
        }
        if (classesDir != null) {
            long mod = classesDir.lastModified();
            if (mod > 0) {
                effectiveManifest.getAttributes().put(Analyzer.BND_LASTMODIFIED, mod);
            }
        }
    } catch (Exception e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
    return getEffectiveManifestInternal(effectiveManifest);
}
 
Example #14
Source File: DefaultConf2ScopeMappingContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Conf2ScopeMapping> getMappingsWithHighestPriority(Collection<Configuration> configurations) {
    Integer lastPriority = null;
    Set<Conf2ScopeMapping> result = new HashSet<Conf2ScopeMapping>();
    for (Conf2ScopeMapping conf2ScopeMapping : getMappingsForConfigurations(configurations)) {
        Integer thisPriority = conf2ScopeMapping.getPriority();
        if (lastPriority != null && lastPriority.equals(thisPriority)) {
            result.add(conf2ScopeMapping);
        } else if (lastPriority == null || (thisPriority != null && lastPriority < thisPriority)) {
            lastPriority = thisPriority;
            result = WrapUtil.toSet(conf2ScopeMapping);
        }
    }
    return result;
}
 
Example #15
Source File: DefaultConf2ScopeMappingContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Conf2ScopeMapping> getMappingsWithHighestPriority(Collection<Configuration> configurations) {
    Integer lastPriority = null;
    Set<Conf2ScopeMapping> result = new HashSet<Conf2ScopeMapping>();
    for (Conf2ScopeMapping conf2ScopeMapping : getMappingsForConfigurations(configurations)) {
        Integer thisPriority = conf2ScopeMapping.getPriority();
        if (lastPriority != null && lastPriority.equals(thisPriority)) {
            result.add(conf2ScopeMapping);
        } else if (lastPriority == null || (thisPriority != null && lastPriority < thisPriority)) {
            lastPriority = thisPriority;
            result = WrapUtil.toSet(conf2ScopeMapping);
        }
    }
    return result;
}
 
Example #16
Source File: DefaultManifestMergeSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addMergeDetailToManifest(String section, DefaultManifest mergedManifest, DefaultManifestMergeDetails mergeDetails) {
    if (!mergeDetails.isExcluded()) {
        if (section == null) {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()));
        } else {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()), section);
        }
    }
}
 
Example #17
Source File: BasePomFilterContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Iterable<PomFilter> getActivePomFilters() {
    Iterable<PomFilter> activeArtifactPoms;
    if (pomFilters.size() == 0 && getDefaultPomFilter() != null) {
        activeArtifactPoms = WrapUtil.toSet(getDefaultPomFilter());
    } else {
        activeArtifactPoms = pomFilters.values();
    }
    return activeArtifactPoms;
}
 
Example #18
Source File: DefaultIvyArtifactRepository.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private IvyResolver createResolver(Set<String> schemes) {
    if (schemes.isEmpty()) {
        throw new InvalidUserDataException("You must specify a base url or at least one artifact pattern for an Ivy repository.");
    }
    if (!WrapUtil.toSet("http", "https", "file").containsAll(schemes)) {
        throw new InvalidUserDataException("You may only specify 'file', 'http' and 'https' urls for an Ivy repository.");
    }
    if (WrapUtil.toSet("http", "https").containsAll(schemes)) {
        return createResolver(transportFactory.createHttpTransport(getName(), getCredentials()));
    }
    if (WrapUtil.toSet("file").containsAll(schemes)) {
        return createResolver(transportFactory.createFileTransport(getName()));
    }
    throw new InvalidUserDataException("You cannot mix file and http(s) urls for a single Ivy repository. Please declare 2 separate repositories.");
}
 
Example #19
Source File: BasePomFilterContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Iterable<PomFilter> getActivePomFilters() {
    Iterable<PomFilter> activeArtifactPoms;
    if (pomFilters.size() == 0 && getDefaultPomFilter() != null) {
        activeArtifactPoms = WrapUtil.toSet(getDefaultPomFilter());
    } else {
        activeArtifactPoms = pomFilters.values();
    }
    return activeArtifactPoms;
}
 
Example #20
Source File: DefaultConf2ScopeMappingContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Conf2ScopeMapping> getMappingsWithHighestPriority(Collection<Configuration> configurations) {
    Integer lastPriority = null;
    Set<Conf2ScopeMapping> result = new HashSet<Conf2ScopeMapping>();
    for (Conf2ScopeMapping conf2ScopeMapping : getMappingsForConfigurations(configurations)) {
        Integer thisPriority = conf2ScopeMapping.getPriority();
        if (lastPriority != null && lastPriority.equals(thisPriority)) {
            result.add(conf2ScopeMapping);
        } else if (lastPriority == null || (thisPriority != null && lastPriority < thisPriority)) {
            lastPriority = thisPriority;
            result = WrapUtil.toSet(conf2ScopeMapping);
        }
    }
    return result;
}
 
Example #21
Source File: RepositoryTransportFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public RepositoryTransport createTransport(Set<String> schemes, String name, PasswordCredentials credentials) {
    if (!WrapUtil.toSet("http", "https", "file", "sftp").containsAll(schemes)) {
        throw new InvalidUserDataException("You may only specify 'file', 'http', 'https' and 'sftp' URLs for a repository.");
    }
    if (WrapUtil.toSet("http", "https").containsAll(schemes)) {
        return createHttpTransport(name, credentials);
    }
    if (WrapUtil.toSet("file").containsAll(schemes)) {
        return createFileTransport(name);
    }
    if (WrapUtil.toSet("sftp").containsAll(schemes)) {
        return createSftpTransport(name, credentials);
    }
    throw new InvalidUserDataException("You cannot mix different URL schemes for a single repository. Please declare separate repositories.");
}
 
Example #22
Source File: BasePomFilterContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Iterable<PomFilter> getActivePomFilters() {
    Iterable<PomFilter> activeArtifactPoms;
    if (pomFilters.size() == 0 && getDefaultPomFilter() != null) {
        activeArtifactPoms = WrapUtil.toSet(getDefaultPomFilter());
    } else {
        activeArtifactPoms = pomFilters.values();
    }
    return activeArtifactPoms;
}
 
Example #23
Source File: DefaultConf2ScopeMappingContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Set<Conf2ScopeMapping> getMappingsWithHighestPriority(Collection<Configuration> configurations) {
    Integer lastPriority = null;
    Set<Conf2ScopeMapping> result = new HashSet<Conf2ScopeMapping>();
    for (Conf2ScopeMapping conf2ScopeMapping : getMappingsForConfigurations(configurations)) {
        Integer thisPriority = conf2ScopeMapping.getPriority();
        if (lastPriority != null && lastPriority.equals(thisPriority)) {
            result.add(conf2ScopeMapping);
        } else if (lastPriority == null || (thisPriority != null && lastPriority < thisPriority)) {
            lastPriority = thisPriority;
            result = WrapUtil.toSet(conf2ScopeMapping);
        }
    }
    return result;
}
 
Example #24
Source File: DefaultManifestMergeSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addMergeDetailToManifest(String section, DefaultManifest mergedManifest, DefaultManifestMergeDetails mergeDetails) {
    if (!mergeDetails.isExcluded()) {
        if (section == null) {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()));
        } else {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()), section);
        }
    }
}
 
Example #25
Source File: DefaultManifestMergeSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addMergeDetailToManifest(String section, DefaultManifest mergedManifest, DefaultManifestMergeDetails mergeDetails) {
    if (!mergeDetails.isExcluded()) {
        if (section == null) {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()));
        } else {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()), section);
        }
    }
}
 
Example #26
Source File: DefaultManifestMergeSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addMergeDetailToManifest(String section, DefaultManifest mergedManifest, DefaultManifestMergeDetails mergeDetails) {
    if (!mergeDetails.isExcluded()) {
        if (section == null) {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()));
        } else {
            mergedManifest.attributes(WrapUtil.toMap(mergeDetails.getKey(), mergeDetails.getValue()), section);
        }
    }
}
 
Example #27
Source File: BasePomFilterContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Iterable<PomFilter> getActivePomFilters() {
    Iterable<PomFilter> activeArtifactPoms;
    if (pomFilters.size() == 0 && getDefaultPomFilter() != null) {
        activeArtifactPoms = WrapUtil.toSet(getDefaultPomFilter());
    } else {
        activeArtifactPoms = pomFilters.values();
    }
    return activeArtifactPoms;
}
 
Example #28
Source File: DefaultIvyArtifactRepository.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private IvyResolver createResolver(Set<String> schemes) {
    if (schemes.isEmpty()) {
        throw new InvalidUserDataException("You must specify a base url or at least one artifact pattern for an Ivy repository.");
    }
    if (!WrapUtil.toSet("http", "https", "file").containsAll(schemes)) {
        throw new InvalidUserDataException("You may only specify 'file', 'http' and 'https' urls for an Ivy repository.");
    }
    if (WrapUtil.toSet("http", "https").containsAll(schemes)) {
        return createResolver(transportFactory.createHttpTransport(getName(), getCredentials()));
    }
    if (WrapUtil.toSet("file").containsAll(schemes)) {
        return createResolver(transportFactory.createFileTransport(getName()));
    }
    throw new InvalidUserDataException("You cannot mix file and http(s) urls for a single Ivy repository. Please declare 2 separate repositories.");
}
 
Example #29
Source File: RepositoryTransportFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public RepositoryTransport createTransport(Set<String> schemes, String name, PasswordCredentials credentials) {
    if (!WrapUtil.toSet("http", "https", "file", "sftp").containsAll(schemes)) {
        throw new InvalidUserDataException("You may only specify 'file', 'http', 'https' and 'sftp' URLs for a repository.");
    }
    if (WrapUtil.toSet("http", "https").containsAll(schemes)) {
        return createHttpTransport(name, credentials);
    }
    if (WrapUtil.toSet("file").containsAll(schemes)) {
        return createFileTransport(name);
    }
    if (WrapUtil.toSet("sftp").containsAll(schemes)) {
        return createSftpTransport(name, credentials);
    }
    throw new InvalidUserDataException("You cannot mix different URL schemes for a single repository. Please declare separate repositories.");
}
 
Example #30
Source File: DefaultConfiguration.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Set<Configuration> getHierarchy() {
    Set<Configuration> result = WrapUtil.<Configuration>toLinkedSet(this);
    collectSuperConfigs(this, result);
    return result;
}