@Test public void testCompound() throws Exception { ResolvedManifest resolved = new GithubStyleUrlCoordinateResolver().resolve(environment, new SoftNameDependency ("https: assert resolved != null; assert resolved.cdepManifestYml.coordinate != null; assertThat(resolved.cdepManifestYml.coordinate.groupId).isEqualTo("com.github.jomof"); assertThat(resolved.cdepManifestYml.coordinate.artifactId).isEqualTo("firebase/database"); assertThat(resolved.cdepManifestYml.coordinate.version.value).isEqualTo("2.1.3-rev5"); assert resolved.cdepManifestYml.android != null; assert resolved.cdepManifestYml.android.archives != null; assertThat(resolved.cdepManifestYml.android.archives.length).isEqualTo(21); }
@Nullable @Override public ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency) throws IOException, NoSuchAlgorithmException { String coordinate = dependency.compile; assert coordinate != null; Matcher match = pattern.matcher(coordinate); if (match.find()) { String baseUrl = match.group(1); String segments[] = baseUrl.split("\\."); String groupId = ""; for (int i = 0; i < segments.length; ++i) { groupId += segments[segments.length - i - 1]; groupId += "."; } String user = match.group(2); groupId += user; String artifactId = match.group(3); Version version = new Version(match.group(4)); String subArtifact = match.group(5); if (subArtifact.length() > 0) { require(subArtifact.startsWith("-"), "Url is incorrectly formed at '%s': %s", subArtifact, coordinate); artifactId += "/" + subArtifact.substring(1); } Coordinate provisionalCoordinate = new Coordinate(groupId, artifactId, version); CDepManifestYml cdepManifestYml = environment.tryGetManifest(provisionalCoordinate, new URL(coordinate)); if (cdepManifestYml == null) { return null; } require(groupId.equals(cdepManifestYml.coordinate.groupId), "groupId '%s' from manifest did not agree with github url %s", cdepManifestYml.coordinate.groupId, coordinate); require(artifactId.startsWith(cdepManifestYml.coordinate.artifactId), "artifactId '%s' from manifest did not agree with '%s' from github url %s", artifactId, cdepManifestYml.coordinate.artifactId, coordinate); require(version.equals(cdepManifestYml.coordinate.version), "version '%s' from manifest did not agree with version %s github url %s", cdepManifestYml.coordinate.version, version, coordinate); return new ResolvedManifest(new URL(coordinate), cdepManifestYml); } return null; }
GithubStyleUrlCoordinateResolver extends CoordinateResolver { @Nullable @Override public ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency) throws IOException, NoSuchAlgorithmException { String coordinate = dependency.compile; assert coordinate != null; Matcher match = pattern.matcher(coordinate); if (match.find()) { String baseUrl = match.group(1); String segments[] = baseUrl.split("\\."); String groupId = ""; for (int i = 0; i < segments.length; ++i) { groupId += segments[segments.length - i - 1]; groupId += "."; } String user = match.group(2); groupId += user; String artifactId = match.group(3); Version version = new Version(match.group(4)); String subArtifact = match.group(5); if (subArtifact.length() > 0) { require(subArtifact.startsWith("-"), "Url is incorrectly formed at '%s': %s", subArtifact, coordinate); artifactId += "/" + subArtifact.substring(1); } Coordinate provisionalCoordinate = new Coordinate(groupId, artifactId, version); CDepManifestYml cdepManifestYml = environment.tryGetManifest(provisionalCoordinate, new URL(coordinate)); if (cdepManifestYml == null) { return null; } require(groupId.equals(cdepManifestYml.coordinate.groupId), "groupId '%s' from manifest did not agree with github url %s", cdepManifestYml.coordinate.groupId, coordinate); require(artifactId.startsWith(cdepManifestYml.coordinate.artifactId), "artifactId '%s' from manifest did not agree with '%s' from github url %s", artifactId, cdepManifestYml.coordinate.artifactId, coordinate); require(version.equals(cdepManifestYml.coordinate.version), "version '%s' from manifest did not agree with version %s github url %s", cdepManifestYml.coordinate.version, version, coordinate); return new ResolvedManifest(new URL(coordinate), cdepManifestYml); } return null; } }
GithubStyleUrlCoordinateResolver extends CoordinateResolver { @Nullable @Override public ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency) throws IOException, NoSuchAlgorithmException { String coordinate = dependency.compile; assert coordinate != null; Matcher match = pattern.matcher(coordinate); if (match.find()) { String baseUrl = match.group(1); String segments[] = baseUrl.split("\\."); String groupId = ""; for (int i = 0; i < segments.length; ++i) { groupId += segments[segments.length - i - 1]; groupId += "."; } String user = match.group(2); groupId += user; String artifactId = match.group(3); Version version = new Version(match.group(4)); String subArtifact = match.group(5); if (subArtifact.length() > 0) { require(subArtifact.startsWith("-"), "Url is incorrectly formed at '%s': %s", subArtifact, coordinate); artifactId += "/" + subArtifact.substring(1); } Coordinate provisionalCoordinate = new Coordinate(groupId, artifactId, version); CDepManifestYml cdepManifestYml = environment.tryGetManifest(provisionalCoordinate, new URL(coordinate)); if (cdepManifestYml == null) { return null; } require(groupId.equals(cdepManifestYml.coordinate.groupId), "groupId '%s' from manifest did not agree with github url %s", cdepManifestYml.coordinate.groupId, coordinate); require(artifactId.startsWith(cdepManifestYml.coordinate.artifactId), "artifactId '%s' from manifest did not agree with '%s' from github url %s", artifactId, cdepManifestYml.coordinate.artifactId, coordinate); require(version.equals(cdepManifestYml.coordinate.version), "version '%s' from manifest did not agree with version %s github url %s", cdepManifestYml.coordinate.version, version, coordinate); return new ResolvedManifest(new URL(coordinate), cdepManifestYml); } return null; }  }
GithubStyleUrlCoordinateResolver extends CoordinateResolver { @Nullable @Override public ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency) throws IOException, NoSuchAlgorithmException { String coordinate = dependency.compile; assert coordinate != null; Matcher match = pattern.matcher(coordinate); if (match.find()) { String baseUrl = match.group(1); String segments[] = baseUrl.split("\\."); String groupId = ""; for (int i = 0; i < segments.length; ++i) { groupId += segments[segments.length - i - 1]; groupId += "."; } String user = match.group(2); groupId += user; String artifactId = match.group(3); Version version = new Version(match.group(4)); String subArtifact = match.group(5); if (subArtifact.length() > 0) { require(subArtifact.startsWith("-"), "Url is incorrectly formed at '%s': %s", subArtifact, coordinate); artifactId += "/" + subArtifact.substring(1); } Coordinate provisionalCoordinate = new Coordinate(groupId, artifactId, version); CDepManifestYml cdepManifestYml = environment.tryGetManifest(provisionalCoordinate, new URL(coordinate)); if (cdepManifestYml == null) { return null; } require(groupId.equals(cdepManifestYml.coordinate.groupId), "groupId '%s' from manifest did not agree with github url %s", cdepManifestYml.coordinate.groupId, coordinate); require(artifactId.startsWith(cdepManifestYml.coordinate.artifactId), "artifactId '%s' from manifest did not agree with '%s' from github url %s", artifactId, cdepManifestYml.coordinate.artifactId, coordinate); require(version.equals(cdepManifestYml.coordinate.version), "version '%s' from manifest did not agree with version %s github url %s", cdepManifestYml.coordinate.version, version, coordinate); return new ResolvedManifest(new URL(coordinate), cdepManifestYml); } return null; }  @Nullable @Override ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency); }
GithubStyleUrlCoordinateResolver extends CoordinateResolver { @Nullable @Override public ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency) throws IOException, NoSuchAlgorithmException { String coordinate = dependency.compile; assert coordinate != null; Matcher match = pattern.matcher(coordinate); if (match.find()) { String baseUrl = match.group(1); String segments[] = baseUrl.split("\\."); String groupId = ""; for (int i = 0; i < segments.length; ++i) { groupId += segments[segments.length - i - 1]; groupId += "."; } String user = match.group(2); groupId += user; String artifactId = match.group(3); Version version = new Version(match.group(4)); String subArtifact = match.group(5); if (subArtifact.length() > 0) { require(subArtifact.startsWith("-"), "Url is incorrectly formed at '%s': %s", subArtifact, coordinate); artifactId += "/" + subArtifact.substring(1); } Coordinate provisionalCoordinate = new Coordinate(groupId, artifactId, version); CDepManifestYml cdepManifestYml = environment.tryGetManifest(provisionalCoordinate, new URL(coordinate)); if (cdepManifestYml == null) { return null; } require(groupId.equals(cdepManifestYml.coordinate.groupId), "groupId '%s' from manifest did not agree with github url %s", cdepManifestYml.coordinate.groupId, coordinate); require(artifactId.startsWith(cdepManifestYml.coordinate.artifactId), "artifactId '%s' from manifest did not agree with '%s' from github url %s", artifactId, cdepManifestYml.coordinate.artifactId, coordinate); require(version.equals(cdepManifestYml.coordinate.version), "version '%s' from manifest did not agree with version %s github url %s", cdepManifestYml.coordinate.version, version, coordinate); return new ResolvedManifest(new URL(coordinate), cdepManifestYml); } return null; }  @Nullable @Override ResolvedManifest resolve(@NotNull ManifestProvider environment, @NotNull SoftNameDependency dependency);  }