Ejemplo n.º 1
0
        public static string ToFileSuffix(this PomComponentKind kind, PackageReference pr)
        {
            switch (kind)
            {
            case PomComponentKind.PomXml: return(".pom");

            case PomComponentKind.Binary: return("." + pr.Packaging);

            case PomComponentKind.JavadocJar: return("-javadoc.jar");

            case PomComponentKind.SourcesJar: return("-sources.jar");
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 2
0
 public static string BuildLocalCachePath(string basePath, PackageReference pr, PomComponentKind kind)
 {
     if (string.IsNullOrEmpty(pr.GroupId))
     {
         throw new ArgumentException("groupId is empty for " + pr);
     }
     if (string.IsNullOrEmpty(pr.ArtifactId))
     {
         throw new ArgumentException("artifactId is empty for " + pr);
     }
     if (string.IsNullOrEmpty(pr.Version))
     {
         throw new ArgumentException("version is empty for " + pr);
     }
     return(Path.Combine(basePath ?? "", pr.GroupId, pr.ArtifactId, pr.Version, $"{pr.ArtifactId}-{pr.Version}{kind.ToFileSuffix (pr)}"));
 }
Ejemplo n.º 3
0
 public override bool CanTryDownloading(PackageReference pr)
 {
     if (pr.GroupId.StartsWith("android.arch.") ||
         pr.GroupId.StartsWith("com.android.databinding") ||
         pr.GroupId.StartsWith("com.android.java.tools.build") ||
         pr.GroupId.StartsWith("com.android.support") ||
         pr.GroupId.StartsWith("com.android.tools") ||
         pr.GroupId.StartsWith("com.android.tools"))
     {
         return(true);
     }
     switch (pr.GroupId)
     {
     case "com.google.firebase":
     case "com.google.android.gms":
     case "com.google.android.support":
     case "com.google.android.wearable":
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 public virtual bool ShouldSkipDownload(PackageReference pr)
 {
     return(false);
 }
Ejemplo n.º 5
0
 public override bool CanTryDownloading(PackageReference pr)
 {
     return(IsAndroidSdkComponent(pr.GroupId));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// constructs a download URL, or throw <see cref="T:RepositoryDownloadException" />
 /// </summary>
 /// <returns>The download URL.</returns>
 /// <param name="pkg">Package.</param>
 /// <param name="kind">Pom component kind.</param>
 public virtual string BuildDownloadUrl(PackageReference pkg, PomComponentKind kind)
 {
     return(BuildDownloadUrl(BaseUrl, pkg, kind));
 }
Ejemplo n.º 7
0
 public virtual bool CanTryDownloading(PackageReference pr)
 {
     return(!IsAndroidSdkComponent(pr.GroupId));
 }
Ejemplo n.º 8
0
 bool IsScopeCovered(Options options, PackageReference p)
 {
     return(p.Scope == "compile" || options.ExtraScopes.Contains(p.Scope));
 }
Ejemplo n.º 9
0
 public Entry Find(PackageReference package, PomComponentKind kind)
 {
     return(Entries.FirstOrDefault(e => e.ComponentKind == kind && e.Package.Equals(package)));
 }
Ejemplo n.º 10
0
 public bool Exists(PackageReference package, PomComponentKind kind)
 {
     return(Find(package, kind) != null);
 }
Ejemplo n.º 11
0
 public Entry(PackageReference package, PomComponentKind kind, string localFile)
 {
     Package       = package;
     ComponentKind = kind;
     LocalFile     = localFile;
 }