--- id: 8500e0df-a1f6-42f1-b2fa-e51d8bdc0c21 title: maven-repo-dependency-diff uti: com.xamarin.workbook platforms: - Console packages: - id: MavenNet version: 2.0.1 - id: System.Net.Http version: 4.3.3 --- ```csharp #r "MavenNet" #r "System.Net.Http" using MavenNet; using System.Linq; ``` ```csharp const string OLD_VER = "27.0.2"; const string NEW_VER = "27.1.1"; ``` ```csharp var repo = MavenNet.MavenRepository.FromGoogle(); //maven.google.com await repo.Refresh(); var groupId = "com.android.support"; var mavenGroup = repo.Groups.FirstOrDefault(g => g.Id == groupId); foreach (var item in mavenGroup.Artifacts) { var oldProj = await repo.GetProjectAsync (groupId, item.Id, OLD_VER); var newProj = await repo.GetProjectAsync (groupId, item.Id, NEW_VER); if (oldProj == null && newProj == null) continue; if (newProj == null) { Console.WriteLine (item.Id + " -> Removed"); continue; } if (oldProj == null) { Console.WriteLine (item.Id + " -> Added"); foreach (var d in newProj.Dependencies) Console.WriteLine ($"-> Dependency: {d.ArtifactId}"); continue; } var removedDeps = oldProj.Dependencies.Where (od => !newProj.Dependencies.Any (nd => nd.GroupId == od.GroupId && nd.ArtifactId == od.ArtifactId)); var addedDeps = newProj.Dependencies.Where (od => !oldProj.Dependencies.Any (nd => nd.GroupId == od.GroupId && nd.ArtifactId == od.ArtifactId)); if (removedDeps.Any () || addedDeps.Any ()) Console.WriteLine (item.Id + " dependencies changed!"); foreach (var rm in removedDeps) Console.WriteLine ($"-> Removed: {rm.ArtifactId}"); foreach (var ad in addedDeps) Console.WriteLine ($"-> Added: {ad.ArtifactId}"); } ```