Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageVersion Include="Newtonsoft.Json.Schema" Version="4.0.1" />
<PackageVersion Include="NuGet.ProjectModel" Version="7.3.0" />
<PackageVersion Include="NuGet.Versioning" Version="7.3.0" />
<PackageVersion Include="packageurl-dotnet" Version="2.0.0-rc.3" />
<PackageVersion Include="packageurl-dotnet" Version="2.0.0" />
<PackageVersion Include="Polly" Version="8.6.6" />
<PackageVersion Include="SemanticVersioning" Version="2.0.2" />
<PackageVersion Include="Serilog" Version="4.3.1" />
Expand Down
2 changes: 1 addition & 1 deletion docs/creating-a-new-detector.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class YourEcosystemComponent : TypedComponent
public string Version { get; set; }

public override ComponentType Type => ComponentType.YourType;
public override PackageUrl PackageUrl => new PackageUrl("your-type", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("your-type", null, this.Name, this.Version, null, null);
protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";
Comment thread
grvillic marked this conversation as resolved.
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public CargoComponent(string name, string version, string author = null, string
public override ComponentType Type => ComponentType.Cargo;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("cargo", string.Empty, this.Name, this.Version, null, string.Empty);
public override PackageURL PackageUrl => new PackageURL("cargo", string.Empty, this.Name, this.Version, null, string.Empty);

protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ConanComponent(string name, string version, string previous, string packa
public override ComponentType Type => ComponentType.Conan;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("conan", string.Empty, this.Name, this.Version, null, string.Empty);
public override PackageURL PackageUrl => new PackageURL("conan", string.Empty, this.Name, this.Version, null, string.Empty);

protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public CppSdkComponent(string name, string version)
public override ComponentType Type => ComponentType.CppSdk;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl
public override PackageURL PackageUrl
{
get
{
var qualifiers = new SortedDictionary<string, string>
{
{ "type", "cppsdk" },
};
return new PackageUrl("generic", null, this.Name, this.Version, qualifiers, null);
return new PackageURL("generic", null, this.Name, this.Version, qualifiers, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public GoComponent()
// https://github.com/package-url/purl-spec/blame/180c46d266c45aa2bd81a2038af3f78e87bb4a25/README.rst#L610
// The golang purl spec requires a namespace: https://github.com/package-url/purl-spec/blob/master/types/golang-definition.json
[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl
public override PackageURL PackageUrl
{
get
{
var version = string.IsNullOrWhiteSpace(this.Hash) ? this.Version : this.Hash;
var (ns, name) = this.GetNamespaceAndName();
return new PackageUrl("golang", ns, name, version, null, null);
return new PackageURL("golang", ns, name, version, null, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public LinuxComponent(string distribution, string release, string name, string v
public override ComponentType Type => ComponentType.Linux;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl
public override PackageURL PackageUrl
{
get
{
Expand All @@ -63,7 +63,7 @@ public override PackageUrl PackageUrl

if (packageType != null)
{
return new PackageUrl(packageType, this.Distribution, this.Name, this.Version, null, null);
return new PackageURL(packageType, this.Distribution, this.Name, this.Version, null, null);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public MavenComponent()
public override ComponentType Type => ComponentType.Maven;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("maven", this.GroupId, this.ArtifactId, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("maven", this.GroupId, this.ArtifactId, this.Version, null, null);

protected override string ComputeBaseId() => $"{this.GroupId} {this.ArtifactId} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public NpmComponent(string name, string version, string hash = null, NpmAuthor a
public override ComponentType Type => ComponentType.Npm;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("npm", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("npm", null, this.Name, this.Version, null, null);

protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public NuGetComponent(string name, string version, string[] authors = null)
public override ComponentType Type => ComponentType.NuGet;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("nuget", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("nuget", null, this.Name, this.Version, null, null);

protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PipComponent(string name, string version, string author = null, string li
public override ComponentType Type => ComponentType.Pip;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("pypi", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("pypi", null, this.Name, this.Version, null, null);

[SuppressMessage("Usage", "CA1308:Normalize String to Uppercase", Justification = "Casing cannot be overwritten.")]
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}".ToLowerInvariant();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public PodComponent(string name, string version, string specRepo = "")
public override ComponentType Type => ComponentType.Pod;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl
public override PackageURL PackageUrl
{
get
{
Expand All @@ -42,7 +42,7 @@ public override PackageUrl PackageUrl
qualifiers.Add("repository_url", this.SpecRepo);
}

return new PackageUrl("cocoapods", null, this.Name, this.Version, qualifiers, null);
return new PackageURL("cocoapods", null, this.Name, this.Version, qualifiers, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public RubyGemsComponent(string name, string version, string source = "")
public override ComponentType Type => ComponentType.RubyGems;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl("gem", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("gem", null, this.Name, this.Version, null, null);

protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SwiftComponent(string name, string version, string packageUrl, string has
// namespace: github.com/apple
// name: swift-asn1
[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl => new PackageUrl(
public override PackageURL PackageUrl => new PackageURL(
type: "swift",
@namespace: this.GetNamespaceFromPackageUrl(),
name: this.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal TypedComponent()
public string BaseId => this.baseId ??= this.ComputeBaseId();

[SystemTextJson.JsonPropertyName("packageUrl")]
public virtual PackageUrl PackageUrl { get; }
public virtual PackageURL PackageUrl { get; }

/// <summary>Gets or sets SPDX license expression(s) declared by the package author.</summary>
[JsonProperty("licenses", NullValueHandling = NullValueHandling.Ignore)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public VcpkgComponent(string spdxid, string name, string version, string triplet
public override ComponentType Type => ComponentType.Vcpkg;

[JsonPropertyName("packageUrl")]
public override PackageUrl PackageUrl
public override PackageURL PackageUrl
{
get
{
var qualifiers = this.PortVersion > 0
? new SortedDictionary<string, string> { { "port_version", this.PortVersion.ToString() } }
: null;

return new PackageUrl("vcpkg", null, this.Name, this.Version, qualifiers, null);
return new PackageURL("vcpkg", null, this.Name, this.Version, qualifiers, null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void PackageURL_ShouldReturnCorrectPackageURL_GithubHostname()

var component = new SwiftComponent(name, version, packageUrl, hash);

var expectedPackageURL = new PackageUrl(
var expectedPackageURL = new PackageURL(
type: "swift",
@namespace: "github.com/Alamofire",
name: name,
Expand All @@ -124,7 +124,7 @@ public void PackageURL_ShouldReturnCorrectPackageURL_GithubHostname_Alternate()

var component = new SwiftComponent(name, version, packageUrl, hash);

var expectedPackageURL = new PackageUrl(
var expectedPackageURL = new PackageURL(
type: "swift",
@namespace: "github.com/Alamofire",
name: name,
Expand All @@ -149,7 +149,7 @@ public void PackageURL_ShouldReturnCorrectPackageURL_OtherHostname()

var component = new SwiftComponent(name, version, packageUrl, hash);

var expectedPackageURL = new PackageUrl(
var expectedPackageURL = new PackageURL(
type: "swift",
@namespace: "otherhostname.com",
name: name,
Expand Down
Loading