-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for centralized package manager & language abstraction fo… (
#10929) * Add support for centralized package manager & language abstraction for maven * Use NOT-APPLICABLE for unknown info * Fix failing file parser ecosystem tests
- Loading branch information
Showing
6 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/maven/version" | ||
require "dependabot/maven/requirement" | ||
|
||
module Dependabot | ||
module Maven | ||
LANGUAGE = "java" | ||
|
||
class Language < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig { params(raw_version: String).void } | ||
def initialize(raw_version) | ||
super( | ||
LANGUAGE, | ||
Version.new(raw_version) | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/maven/version" | ||
require "dependabot/maven/requirement" | ||
|
||
module Dependabot | ||
module Maven | ||
ECOSYSTEM = "maven" | ||
PACKAGE_MANAGER = "maven" | ||
|
||
# Supported versions specified here: https://maven.apache.org/docs/history.html | ||
SUPPORTED_MAVEN_VERSIONS = T.let([Version.new("3")].freeze, T::Array[Dependabot::Version]) | ||
|
||
# When a version is going to be unsupported, it will be added here | ||
DEPRECATED_MAVEN_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version]) | ||
|
||
class PackageManager < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig do | ||
params( | ||
raw_version: String, | ||
requirement: T.nilable(Requirement) | ||
).void | ||
end | ||
def initialize(raw_version, requirement = nil) | ||
super( | ||
PACKAGE_MANAGER, | ||
Version.new(raw_version), | ||
DEPRECATED_MAVEN_VERSIONS, | ||
SUPPORTED_MAVEN_VERSIONS, | ||
requirement, | ||
) | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def deprecated? | ||
false | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def unsupported? | ||
false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/maven/language" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Maven::Language do | ||
let(:language) { described_class.new(version) } | ||
let(:version) { "3.0.0" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(language.version).to eq(Dependabot::Maven::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(language.name).to eq(Dependabot::Maven::LANGUAGE) | ||
end | ||
end | ||
|
||
describe "#unsupported?" do | ||
it "returns false by default" do | ||
expect(language.unsupported?).to be false | ||
end | ||
end | ||
|
||
describe "#deprecated?" do | ||
it "returns false by default" do | ||
expect(language.deprecated?).to be false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/maven/package_manager" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Maven::PackageManager do | ||
subject(:package_manager) { described_class.new(version) } | ||
|
||
let(:version) { "3.9.5" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(package_manager.version).to eq(Dependabot::Maven::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(package_manager.name).to eq(Dependabot::Maven::PACKAGE_MANAGER) | ||
end | ||
end | ||
|
||
describe "#deprecated_versions" do | ||
it "returns deprecated versions" do | ||
expect(package_manager.deprecated_versions).to eq(Dependabot::Maven::DEPRECATED_MAVEN_VERSIONS) | ||
end | ||
end | ||
|
||
describe "#supported_versions" do | ||
it "returns supported versions" do | ||
expect(package_manager.supported_versions).to eq(Dependabot::Maven::SUPPORTED_MAVEN_VERSIONS) | ||
end | ||
end | ||
end |