-
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.
* Initial `dotnet_sdk` updater Closes #2442 * Apply suggestions from code review Co-authored-by: Martin Costello <[email protected]> * Document that we are consciously using semver for .NET SDK versioning * Use `File.basename` for comparison * Use `gsub` to update `global.json` instead of parsing JSON * implement `look_up_source` in `MetadataFinder` * regenerate `Gemfile.lock` * bump `file_updater` from `strict` to `strong` * Remove unnecessary comments * `bundle install` * Regnerate `Gemfile.lock` --------- Co-authored-by: Martin Costello <[email protected]> Co-authored-by: Hariharan Thavachelvam <[email protected]>
- Loading branch information
1 parent
b760eb8
commit 0d9864e
Showing
53 changed files
with
16,085 additions
and
4 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
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
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
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
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
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
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
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 @@ | ||
BUNDLE_GEMFILE: "../dependabot-updater/Gemfile" |
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,5 @@ | ||
/.bundle/ | ||
!.bundle/config | ||
/.env | ||
/tmp | ||
/dependabot-*.gem |
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,4 @@ | ||
inherit_from: ../.rubocop.yml | ||
|
||
Sorbet/StrictSigil: | ||
Enabled: true |
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,7 @@ | ||
FROM ghcr.io/dependabot/dependabot-updater-core | ||
|
||
USER dependabot | ||
|
||
COPY --chown=dependabot:dependabot dotnet_sdk $DEPENDABOT_HOME/dotnet_sdk | ||
COPY --chown=dependabot:dependabot common $DEPENDABOT_HOME/common | ||
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater |
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,18 @@ | ||
## `dependabot-dotnet-sdk` | ||
|
||
.NET SDK support for [`dependabot-core`][core-repo]. | ||
|
||
### Running locally | ||
|
||
1. Start a development shell | ||
|
||
``` | ||
$ bin/docker-dev-shell dotnet-sdk | ||
``` | ||
|
||
2. Run tests | ||
``` | ||
[dependabot-core-dev] ~ $ cd dotnet-sdk && rspec | ||
``` | ||
|
||
[core-repo]: https://github.com/dependabot/dependabot-core |
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,33 @@ | ||
# frozen_string_literal: true | ||
|
||
Gem::Specification.new do |spec| | ||
common_gemspec = | ||
Bundler.load_gemspec_uncached("../common/dependabot-common.gemspec") | ||
|
||
spec.name = "dependabot-dotnet_sdk" | ||
spec.summary = "Provides Dependabot support for .NET SDK" | ||
spec.description = "dependabot-dotnet_sdk provides support for managing .NET SDK versioning via Dependabot." | ||
|
||
spec.author = common_gemspec.author | ||
spec.email = common_gemspec.email | ||
spec.homepage = common_gemspec.homepage | ||
spec.license = common_gemspec.license | ||
|
||
spec.metadata = { | ||
"bug_tracker_uri" => common_gemspec.metadata["bug_tracker_uri"], | ||
"changelog_uri" => common_gemspec.metadata["changelog_uri"] | ||
} | ||
|
||
spec.version = common_gemspec.version | ||
spec.required_ruby_version = common_gemspec.required_ruby_version | ||
spec.required_rubygems_version = common_gemspec.required_ruby_version | ||
|
||
spec.require_path = "lib" | ||
spec.files = Dir["lib/**/*"] | ||
|
||
spec.add_dependency "dependabot-common", Dependabot::VERSION | ||
|
||
common_gemspec.development_dependencies.each do |dep| | ||
spec.add_development_dependency dep.name, *dep.requirement.as_list | ||
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,20 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
# These all need to be required so the various classes can be registered in a | ||
# lookup table of package manager names to concrete classes. | ||
require "dependabot/dotnet_sdk/file_fetcher" | ||
require "dependabot/dotnet_sdk/file_parser" | ||
require "dependabot/dotnet_sdk/update_checker" | ||
require "dependabot/dotnet_sdk/file_updater" | ||
require "dependabot/dotnet_sdk/metadata_finder" | ||
require "dependabot/dotnet_sdk/requirement" | ||
require "dependabot/dotnet_sdk/version" | ||
|
||
require "dependabot/pull_request_creator/labeler" | ||
Dependabot::PullRequestCreator::Labeler | ||
.register_label_details("dotnet_sdk", name: "dotnet_sdk_package_manager", colour: "512BD4") | ||
|
||
require "dependabot/dependency" | ||
Dependabot::Dependency | ||
.register_production_check("dotnet_sdk", ->(_) { true }) |
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,46 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/file_fetchers" | ||
require "dependabot/file_fetchers/base" | ||
require "sorbet-runtime" | ||
|
||
module Dependabot | ||
module DotnetSdk | ||
class FileFetcher < Dependabot::FileFetchers::Base | ||
extend T::Sig | ||
|
||
sig { override.params(filenames: T::Array[String]).returns(T::Boolean) } | ||
def self.required_files_in?(filenames) | ||
filenames.any? { |f| File.basename(f) == "global.json" } | ||
end | ||
|
||
sig { override.returns(String) } | ||
def self.required_files_message | ||
"Repo must contain a global.json file." | ||
end | ||
|
||
sig { override.returns(T::Array[Dependabot::DependencyFile]) } | ||
def fetch_files | ||
fetched_files = [] | ||
fetched_files << root_file | ||
|
||
return fetched_files if fetched_files.any? | ||
|
||
raise Dependabot::DependencyFileNotFound.new( | ||
nil, | ||
"global.json not found in #{directory}" | ||
) | ||
end | ||
|
||
private | ||
|
||
sig { returns(T.nilable(Dependabot::DependencyFile)) } | ||
def root_file | ||
fetch_file_if_present("global.json") | ||
end | ||
end | ||
end | ||
end | ||
|
||
Dependabot::FileFetchers.register("dotnet_sdk", Dependabot::DotnetSdk::FileFetcher) |
Oops, something went wrong.