Example #1
0
  private ArtifactResult findDependencies(
      RepositoryManager manager, Node node, Boolean fetchSingleArtifact) {
    final ArtifactContext ac = ArtifactContext.fromNode(node);
    if (ac == null) return null;

    final String name = ac.getName();
    String[] groupArtifactIds = nameToGroupArtifactIds(name);
    if (groupArtifactIds == null) {
      return null;
    }
    final String groupId = groupArtifactIds[0];
    final String artifactId = groupArtifactIds[1];
    final String version = ac.getVersion();

    String repositoryDisplayString = NodeUtils.getRepositoryDisplayString(node);
    CmrRepository repository = NodeUtils.getRepository(node);

    if (CeylonUtils.arrayContains(ac.getSuffixes(), ArtifactContext.LEGACY_SRC)) {
      return fetchWithClassifier(
          repository, groupId, artifactId, version, "sources", repositoryDisplayString);
    }

    return fetchDependencies(
        manager,
        repository,
        groupId,
        artifactId,
        version,
        fetchSingleArtifact != null ? fetchSingleArtifact : ac.isIgnoreDependencies(),
        repositoryDisplayString);
  }
 private ArtifactResult handleNotFound(ArtifactContext context, String foundSuffix) {
   String[] suffixes = context.getSuffixes();
   for (String suffix : suffixes) {
     if (suffix.equals(foundSuffix)) {
       break;
     }
     context.setSuffixes(suffix); // Make sure we'll have only one suffix
     ArtifactResult result = artifactNotFound(context);
     if (result != null) {
       // Seems we were able to find this artifact anyway, so lets return it
       return result;
     }
   }
   context.setSuffixes(suffixes); // Restore the original suffixes
   return null;
 }