dependabot-core 0.83.2 → 0.84.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cc523139eab2f6d894afd461ef4edc6c8b40b34a6dbe708fc28b9bf9a9f6d9d
4
- data.tar.gz: f4097498fa7a9d69b3ee097df38c44a976e7fbfb5699f51b91e0373b4dd8161a
3
+ metadata.gz: 2880406c8c17102a5713287fd3ab34721ca7e5563a0313efc6e15ff2b621bff5
4
+ data.tar.gz: ea431d85e1adf3c90c3666af8391e90481e6fe4b1a0c4da5e20dca3469fee0fe
5
5
  SHA512:
6
- metadata.gz: e862129876b49b7fa5f95f7eea565ad65b6802ea7e6975651fc8fce33a590da1d20ce5a50ff3c8c710cdb69a3dee8222b2c6dde88695731517e586fbd0c74689
7
- data.tar.gz: d4ab7597f3d11fdaaec2009510de6bee55809521129c05f17ef5d92896c866fb61f6232a9080b8da51534cf0ee0efca438b49bbb4db48af257e04837ba068ef8
6
+ metadata.gz: 8a7f8734af8757aabb9e338de4857db4f8b9c45ee69db2742d7df1851c63e294c6adb90d574d609f2c72407e4cd0e2713dfbb1d0dd595e9a66510061e5a40045
7
+ data.tar.gz: b46aba02cc071a14ce688a30a565533dd21aafd35a0b46fd5e1a457df4eb6e2d783bd9bed04f0b2a268e1b4e6f48df6373a7dceb13535e440641fb74d52293da
@@ -1,3 +1,8 @@
1
+ ## v0.84.0, 14 December 2018
2
+
3
+ - Move Gradle into separate gem
4
+ - Add safeguard for not filtering releases by nil
5
+
1
6
  ## v0.83.2, 14 December 2018
2
7
 
3
8
  - Rust: Handle unfetchable git refs better
@@ -3,7 +3,6 @@
3
3
  require "dependabot/file_fetchers/ruby/bundler"
4
4
  require "dependabot/file_fetchers/java_script/npm_and_yarn"
5
5
  require "dependabot/file_fetchers/java/maven"
6
- require "dependabot/file_fetchers/java/gradle"
7
6
  require "dependabot/file_fetchers/php/composer"
8
7
  require "dependabot/file_fetchers/elixir/hex"
9
8
  require "dependabot/file_fetchers/go/dep"
@@ -15,7 +14,6 @@ module Dependabot
15
14
  "bundler" => FileFetchers::Ruby::Bundler,
16
15
  "npm_and_yarn" => FileFetchers::JavaScript::NpmAndYarn,
17
16
  "maven" => FileFetchers::Java::Maven,
18
- "gradle" => FileFetchers::Java::Gradle,
19
17
  "composer" => FileFetchers::Php::Composer,
20
18
  "hex" => FileFetchers::Elixir::Hex,
21
19
  "dep" => FileFetchers::Go::Dep,
@@ -3,7 +3,6 @@
3
3
  require "dependabot/file_parsers/ruby/bundler"
4
4
  require "dependabot/file_parsers/java_script/npm_and_yarn"
5
5
  require "dependabot/file_parsers/java/maven"
6
- require "dependabot/file_parsers/java/gradle"
7
6
  require "dependabot/file_parsers/php/composer"
8
7
  require "dependabot/file_parsers/elixir/hex"
9
8
  require "dependabot/file_parsers/go/dep"
@@ -15,7 +14,6 @@ module Dependabot
15
14
  "bundler" => FileParsers::Ruby::Bundler,
16
15
  "npm_and_yarn" => FileParsers::JavaScript::NpmAndYarn,
17
16
  "maven" => FileParsers::Java::Maven,
18
- "gradle" => FileParsers::Java::Gradle,
19
17
  "composer" => FileParsers::Php::Composer,
20
18
  "hex" => FileParsers::Elixir::Hex,
21
19
  "dep" => FileParsers::Go::Dep,
@@ -3,7 +3,6 @@
3
3
  require "dependabot/file_updaters/ruby/bundler"
4
4
  require "dependabot/file_updaters/java_script/npm_and_yarn"
5
5
  require "dependabot/file_updaters/java/maven"
6
- require "dependabot/file_updaters/java/gradle"
7
6
  require "dependabot/file_updaters/php/composer"
8
7
  require "dependabot/file_updaters/elixir/hex"
9
8
  require "dependabot/file_updaters/go/dep"
@@ -15,7 +14,6 @@ module Dependabot
15
14
  "bundler" => FileUpdaters::Ruby::Bundler,
16
15
  "npm_and_yarn" => FileUpdaters::JavaScript::NpmAndYarn,
17
16
  "maven" => FileUpdaters::Java::Maven,
18
- "gradle" => FileUpdaters::Java::Gradle,
19
17
  "composer" => FileUpdaters::Php::Composer,
20
18
  "hex" => FileUpdaters::Elixir::Hex,
21
19
  "dep" => FileUpdaters::Go::Dep,
@@ -13,7 +13,6 @@ module Dependabot
13
13
  "bundler" => MetadataFinders::Ruby::Bundler,
14
14
  "npm_and_yarn" => MetadataFinders::JavaScript::NpmAndYarn,
15
15
  "maven" => MetadataFinders::Java::Maven,
16
- "gradle" => MetadataFinders::Java::Maven,
17
16
  "composer" => MetadataFinders::Php::Composer,
18
17
  "hex" => MetadataFinders::Elixir::Hex,
19
18
  "dep" => MetadataFinders::Go::Dep,
@@ -96,10 +96,14 @@ module Dependabot
96
96
  end
97
97
 
98
98
  def filter_releases_using_previous_release(releases)
99
+ return releases if releases.index(previous_release).nil?
100
+
99
101
  releases.first(releases.index(previous_release))
100
102
  end
101
103
 
102
104
  def filter_releases_using_updated_release(releases)
105
+ return releases if releases.index(updated_release).nil?
106
+
103
107
  releases[releases.index(updated_release)..-1]
104
108
  end
105
109
 
@@ -3,7 +3,6 @@
3
3
  require "dependabot/update_checkers/ruby/bundler"
4
4
  require "dependabot/update_checkers/java_script/npm_and_yarn"
5
5
  require "dependabot/update_checkers/java/maven"
6
- require "dependabot/update_checkers/java/gradle"
7
6
  require "dependabot/update_checkers/php/composer"
8
7
  require "dependabot/update_checkers/elixir/hex"
9
8
  require "dependabot/update_checkers/go/dep"
@@ -15,7 +14,6 @@ module Dependabot
15
14
  "bundler" => UpdateCheckers::Ruby::Bundler,
16
15
  "npm_and_yarn" => UpdateCheckers::JavaScript::NpmAndYarn,
17
16
  "maven" => UpdateCheckers::Java::Maven,
18
- "gradle" => UpdateCheckers::Java::Gradle,
19
17
  "composer" => UpdateCheckers::Php::Composer,
20
18
  "hex" => UpdateCheckers::Elixir::Hex,
21
19
  "dep" => UpdateCheckers::Go::Dep,
@@ -22,7 +22,6 @@ module Dependabot
22
22
  "submodules" => Gem::Version,
23
23
  "docker" => Gem::Version,
24
24
  "maven" => Utils::Java::Version,
25
- "gradle" => Utils::Java::Version,
26
25
  "npm_and_yarn" => Utils::JavaScript::Version,
27
26
  "composer" => Utils::Php::Version,
28
27
  "hex" => Utils::Elixir::Version,
@@ -46,7 +45,6 @@ module Dependabot
46
45
  "submodules" => Utils::Ruby::Requirement,
47
46
  "docker" => Utils::Ruby::Requirement,
48
47
  "maven" => Utils::Java::Requirement,
49
- "gradle" => Utils::Java::Requirement,
50
48
  "npm_and_yarn" => Utils::JavaScript::Requirement,
51
49
  "composer" => Utils::Php::Requirement,
52
50
  "hex" => Utils::Elixir::Requirement,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.83.2"
4
+ VERSION = "0.84.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.83.2
4
+ version: 0.84.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -378,8 +378,6 @@ files:
378
378
  - lib/dependabot/file_fetchers/elixir/hex.rb
379
379
  - lib/dependabot/file_fetchers/go/dep.rb
380
380
  - lib/dependabot/file_fetchers/go/modules.rb
381
- - lib/dependabot/file_fetchers/java/gradle.rb
382
- - lib/dependabot/file_fetchers/java/gradle/settings_file_parser.rb
383
381
  - lib/dependabot/file_fetchers/java/maven.rb
384
382
  - lib/dependabot/file_fetchers/java_script/npm_and_yarn.rb
385
383
  - lib/dependabot/file_fetchers/java_script/npm_and_yarn/path_dependency_builder.rb
@@ -396,9 +394,6 @@ files:
396
394
  - lib/dependabot/file_parsers/go/dep.rb
397
395
  - lib/dependabot/file_parsers/go/modules.rb
398
396
  - lib/dependabot/file_parsers/go/modules/go_mod_parser.rb
399
- - lib/dependabot/file_parsers/java/gradle.rb
400
- - lib/dependabot/file_parsers/java/gradle/property_value_finder.rb
401
- - lib/dependabot/file_parsers/java/gradle/repositories_finder.rb
402
397
  - lib/dependabot/file_parsers/java/maven.rb
403
398
  - lib/dependabot/file_parsers/java/maven/property_value_finder.rb
404
399
  - lib/dependabot/file_parsers/java/maven/repositories_finder.rb
@@ -421,9 +416,6 @@ files:
421
416
  - lib/dependabot/file_updaters/go/dep/manifest_updater.rb
422
417
  - lib/dependabot/file_updaters/go/modules.rb
423
418
  - lib/dependabot/file_updaters/go/modules/go_mod_updater.rb
424
- - lib/dependabot/file_updaters/java/gradle.rb
425
- - lib/dependabot/file_updaters/java/gradle/dependency_set_updater.rb
426
- - lib/dependabot/file_updaters/java/gradle/property_value_updater.rb
427
419
  - lib/dependabot/file_updaters/java/maven.rb
428
420
  - lib/dependabot/file_updaters/java/maven/declaration_finder.rb
429
421
  - lib/dependabot/file_updaters/java/maven/property_value_updater.rb
@@ -436,6 +428,7 @@ files:
436
428
  - lib/dependabot/file_updaters/php/composer.rb
437
429
  - lib/dependabot/file_updaters/php/composer/lockfile_updater.rb
438
430
  - lib/dependabot/file_updaters/php/composer/manifest_updater.rb
431
+ - lib/dependabot/file_updaters/ruby/.DS_Store
439
432
  - lib/dependabot/file_updaters/ruby/bundler.rb
440
433
  - lib/dependabot/file_updaters/ruby/bundler/gemfile_updater.rb
441
434
  - lib/dependabot/file_updaters/ruby/bundler/gemspec_dependency_name_finder.rb
@@ -483,9 +476,6 @@ files:
483
476
  - lib/dependabot/update_checkers/go/dep/requirements_updater.rb
484
477
  - lib/dependabot/update_checkers/go/dep/version_resolver.rb
485
478
  - lib/dependabot/update_checkers/go/modules.rb
486
- - lib/dependabot/update_checkers/java/gradle.rb
487
- - lib/dependabot/update_checkers/java/gradle/multi_dependency_updater.rb
488
- - lib/dependabot/update_checkers/java/gradle/version_finder.rb
489
479
  - lib/dependabot/update_checkers/java/maven.rb
490
480
  - lib/dependabot/update_checkers/java/maven/property_updater.rb
491
481
  - lib/dependabot/update_checkers/java/maven/requirements_updater.rb
@@ -543,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
543
533
  version: 2.7.3
544
534
  requirements: []
545
535
  rubyforge_project:
546
- rubygems_version: 2.7.7
536
+ rubygems_version: 2.7.6
547
537
  signing_key:
548
538
  specification_version: 4
549
539
  summary: Automated dependency management
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dependabot/file_fetchers/base"
4
-
5
- module Dependabot
6
- module FileFetchers
7
- module Java
8
- class Gradle < Dependabot::FileFetchers::Base
9
- require_relative "gradle/settings_file_parser"
10
-
11
- def self.required_files_in?(filenames)
12
- filenames.include?("build.gradle")
13
- end
14
-
15
- def self.required_files_message
16
- "Repo must contain a build.gradle."
17
- end
18
-
19
- private
20
-
21
- def fetch_files
22
- fetched_files = []
23
- fetched_files << buildfile
24
- fetched_files += subproject_buildfiles
25
- fetched_files
26
- end
27
-
28
- def buildfile
29
- @buildfile ||= fetch_file_from_host("build.gradle")
30
- end
31
-
32
- def subproject_buildfiles
33
- return [] unless settings_file
34
-
35
- subproject_paths =
36
- SettingsFileParser.
37
- new(settings_file: settings_file).
38
- subproject_paths
39
-
40
- subproject_paths.map do |path|
41
- fetch_file_from_host(File.join(path, "build.gradle"))
42
- rescue Dependabot::DependencyFileNotFound
43
- # Gradle itself doesn't worry about missing subprojects, so we don't
44
- nil
45
- end.compact
46
- end
47
-
48
- def settings_file
49
- @settings_file ||= fetch_file_from_host("settings.gradle")
50
- rescue Dependabot::DependencyFileNotFound
51
- nil
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dependabot/file_fetchers/java/gradle"
4
-
5
- module Dependabot
6
- module FileFetchers
7
- module Java
8
- class Gradle
9
- class SettingsFileParser
10
- INCLUDE_ARGS_REGEX =
11
- /(?:^|\s)include(?:\(|\s)(\s*[^\s,\)]+(?:,\s*[^\s,\)]+)*)/.freeze
12
-
13
- def initialize(settings_file:)
14
- @settings_file = settings_file
15
- end
16
-
17
- def subproject_paths
18
- subprojects = []
19
-
20
- comment_free_content.scan(function_regex("include")) do
21
- args = Regexp.last_match.named_captures.fetch("args")
22
- args = args.split(",")
23
- args = args.map { |p| p.gsub(/["']/, "").strip }.compact
24
- subprojects += args
25
- end
26
-
27
- subprojects = subprojects.uniq
28
-
29
- subproject_dirs = subprojects.map do |proj|
30
- if comment_free_content.match?(project_dir_regex(proj))
31
- comment_free_content.match(project_dir_regex(proj)).
32
- named_captures.fetch("path").sub(%r{^/}, "")
33
- else
34
- proj.tr(":", "/").sub(%r{^/}, "")
35
- end
36
- end
37
-
38
- subproject_dirs.uniq
39
- end
40
-
41
- private
42
-
43
- attr_reader :settings_file
44
-
45
- def comment_free_content
46
- settings_file.content.
47
- gsub(%r{(?<=^|\s)//.*$}, "\n").
48
- gsub(%r{(?<=^|\s)/\*.*?\*/}m, "")
49
- end
50
-
51
- def function_regex(function_name)
52
- /
53
- (?:^|\s)#{Regexp.quote(function_name)}(?:\(|\s)
54
- (?<args>\s*[^\s,\)]+(?:,\s*[^\s,\)]+)*)
55
- /mx
56
- end
57
-
58
- def project_dir_regex(proj)
59
- prefixed_proj = Regexp.quote(":#{proj.gsub(/^:/, '')}")
60
- /['"]#{prefixed_proj}['"].*dir\s*=.*['"](?<path>.*?)['"]/i
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,236 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dependabot/dependency"
4
- require "dependabot/file_parsers/base"
5
- require "dependabot/shared_helpers"
6
-
7
- # The best Gradle documentation is at:
8
- # - https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.
9
- # DependencyHandler.html
10
- module Dependabot
11
- module FileParsers
12
- module Java
13
- class Gradle < Dependabot::FileParsers::Base
14
- require "dependabot/file_parsers/base/dependency_set"
15
- require_relative "gradle/property_value_finder"
16
-
17
- PROPERTY_REGEX =
18
- /
19
- (?:\$\{property\((?<property_name>[^:\s]*?)\)\})|
20
- (?:\$\{(?<property_name>[^:\s]*?)\})|
21
- (?:\$(?<property_name>[^:\s]*))
22
- /x.freeze
23
-
24
- PART = %r{[^\s,@'":/\\]+}.freeze
25
- VSN_PART = %r{[^\s,'":/\\]+}.freeze
26
- DEPENDENCY_DECLARATION_REGEX =
27
- /(?:\(|\s)\s*['"](?<declaration>#{PART}:#{PART}:#{VSN_PART})['"]/.
28
- freeze
29
- DEPENDENCY_SET_DECLARATION_REGEX =
30
- /(?:^|\s)dependencySet\((?<arguments>[^\)]+)\)\s*\{/.freeze
31
- DEPENDENCY_SET_ENTRY_REGEX = /entry\s+['"](?<name>#{PART})['"]/.freeze
32
-
33
- def parse
34
- dependency_set = DependencySet.new
35
- buildfiles.each do |buildfile|
36
- dependency_set += buildfile_dependencies(buildfile)
37
- end
38
- dependency_set.dependencies
39
- end
40
-
41
- private
42
-
43
- def map_value_regex(key)
44
- /(?:^|\s|,|\()#{Regexp.quote(key)}:\s*['"](?<value>[^'"]+)['"]/
45
- end
46
-
47
- def buildfile_dependencies(buildfile)
48
- dependency_set = DependencySet.new
49
-
50
- dependency_set += shortform_buildfile_dependencies(buildfile)
51
- dependency_set += keyword_arg_buildfile_dependencies(buildfile)
52
- dependency_set += dependency_set_dependencies(buildfile)
53
-
54
- dependency_set
55
- end
56
-
57
- def shortform_buildfile_dependencies(buildfile)
58
- dependency_set = DependencySet.new
59
-
60
- prepared_content(buildfile).scan(DEPENDENCY_DECLARATION_REGEX) do
61
- declaration = Regexp.last_match.named_captures.fetch("declaration")
62
-
63
- group, name, version = declaration.split(":")
64
- details = { group: group, name: name, version: version }
65
-
66
- dep = dependency_from(details_hash: details, buildfile: buildfile)
67
- dependency_set << dep if dep
68
- end
69
-
70
- dependency_set
71
- end
72
-
73
- def keyword_arg_buildfile_dependencies(buildfile)
74
- dependency_set = DependencySet.new
75
-
76
- prepared_content(buildfile).lines.each do |line|
77
- name = argument_from_string(line, "name")
78
- group = argument_from_string(line, "group")
79
- version = argument_from_string(line, "version")
80
- next unless name && group && version
81
-
82
- details = { name: name, group: group, version: version }
83
-
84
- dep = dependency_from(details_hash: details, buildfile: buildfile)
85
- dependency_set << dep if dep
86
- end
87
-
88
- dependency_set
89
- end
90
-
91
- def dependency_set_dependencies(buildfile)
92
- dependency_set = DependencySet.new
93
-
94
- dependency_set_blocks = []
95
-
96
- prepared_content(buildfile).scan(DEPENDENCY_SET_DECLARATION_REGEX) do
97
- mch = Regexp.last_match
98
- dependency_set_blocks <<
99
- {
100
- arguments: mch.named_captures.fetch("arguments"),
101
- block: mch.post_match[0..closing_bracket_index(mch.post_match)]
102
- }
103
- end
104
-
105
- dependency_set_blocks.each do |blk|
106
- group = argument_from_string(blk[:arguments], "group")
107
- version = argument_from_string(blk[:arguments], "version")
108
-
109
- next unless group && version
110
-
111
- blk[:block].scan(DEPENDENCY_SET_ENTRY_REGEX).flatten.each do |name|
112
- dep = dependency_from(
113
- details_hash: { group: group, name: name, version: version },
114
- buildfile: buildfile,
115
- in_dependency_set: true
116
- )
117
- dependency_set << dep if dep
118
- end
119
- end
120
-
121
- dependency_set
122
- end
123
-
124
- def argument_from_string(string, arg_name)
125
- string.
126
- match(map_value_regex(arg_name))&.
127
- named_captures&.
128
- fetch("value")
129
- end
130
-
131
- def dependency_from(details_hash:, buildfile:, in_dependency_set: false)
132
- group = evaluated_value(details_hash[:group], buildfile)
133
- name = evaluated_value(details_hash[:name], buildfile)
134
- version = evaluated_value(details_hash[:version], buildfile)
135
-
136
- dependency_name = "#{group}:#{name}"
137
-
138
- # If we can't evaluate a property they we won't be able to
139
- # update this dependency
140
- return if "#{dependency_name}:#{version}".match?(PROPERTY_REGEX)
141
-
142
- Dependency.new(
143
- name: dependency_name,
144
- version: version,
145
- requirements: [{
146
- requirement: version,
147
- file: buildfile.name,
148
- source: nil,
149
- groups: [],
150
- metadata: dependency_metadata(details_hash, in_dependency_set)
151
- }],
152
- package_manager: "gradle"
153
- )
154
- end
155
-
156
- def dependency_metadata(details_hash, in_dependency_set)
157
- version_property_name =
158
- details_hash[:version].
159
- match(PROPERTY_REGEX)&.
160
- named_captures&.fetch("property_name")
161
-
162
- return unless version_property_name || in_dependency_set
163
-
164
- metadata = {}
165
- if version_property_name
166
- metadata[:property_name] = version_property_name
167
- end
168
- if in_dependency_set
169
- metadata[:dependency_set] = {
170
- group: details_hash[:group],
171
- version: details_hash[:version]
172
- }
173
- end
174
- metadata
175
- end
176
-
177
- def evaluated_value(value, buildfile)
178
- return value unless value.scan(PROPERTY_REGEX).count == 1
179
-
180
- property_name = value.match(PROPERTY_REGEX).
181
- named_captures.fetch("property_name")
182
- property_value = property_value_finder.property_value(
183
- property_name: property_name,
184
- callsite_buildfile: buildfile
185
- )
186
-
187
- return value unless property_value
188
-
189
- value.gsub(PROPERTY_REGEX, property_value)
190
- end
191
-
192
- def property_value_finder
193
- @property_value_finder ||=
194
- PropertyValueFinder.new(dependency_files: dependency_files)
195
- end
196
-
197
- def prepared_content(buildfile)
198
- # Remove any comments
199
- prepared_content =
200
- buildfile.content.
201
- gsub(%r{(?<=^|\s)//.*$}, "\n").
202
- gsub(%r{(?<=^|\s)/\*.*?\*/}m, "")
203
-
204
- # Remove the dependencyVerification section added by Gradle Witness
205
- # (TODO: Support updating this in the FileUpdater)
206
- prepared_content.dup.scan(/dependencyVerification\s*{/) do
207
- mtch = Regexp.last_match
208
- block = mtch.post_match[0..closing_bracket_index(mtch.post_match)]
209
- prepared_content.gsub!(block, "")
210
- end
211
-
212
- prepared_content
213
- end
214
-
215
- def closing_bracket_index(string)
216
- closes_required = 1
217
-
218
- string.chars.each_with_index do |char, index|
219
- closes_required += 1 if char == "{"
220
- closes_required -= 1 if char == "}"
221
- return index if closes_required.zero?
222
- end
223
- end
224
-
225
- def buildfiles
226
- @buildfiles ||=
227
- dependency_files.select { |f| f.name.end_with?("build.gradle") }
228
- end
229
-
230
- def check_required_files
231
- raise "No build.gradle!" unless get_original_file("build.gradle")
232
- end
233
- end
234
- end
235
- end
236
- end