dependabot-gradle 0.129.2 → 0.130.1

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: d1dc00bb8b435b360676de16bc2f18ecade53a97e5957d6bb29e0342033631f0
4
- data.tar.gz: 616c8a64b3bc6f64ad5219903a90ec095a82b5222961f2bcb8b9a9bd0d58cc1b
3
+ metadata.gz: 3e876a71ffd580a223b7ae2330d5f52086649df029d84b1cfed5e0e7b668f0fa
4
+ data.tar.gz: a282e48a59b73806501b2b3e2c1eeebb4ce9779caca3e9e3756f691c3148b2f4
5
5
  SHA512:
6
- metadata.gz: 10c0cda388a93d7db1403ad10cedcf9c342120549daede60224a0d700c1c9e329eb6febe58bfa5dbdb008fc0445c5d850277e25d5d6b8529c1f822fa24df6f0a
7
- data.tar.gz: a14d84a747f50956c1e1eec206f4163345a9a18e7e6e30f8383a8854b86a5864bf322c83940b7f62158e113022f16769ee033376082fad7883c448f707580e81
6
+ metadata.gz: 8bb5c73e453b21ea93fae8209fc9fefdf430683b2e958a9ad3a3c1883a24f9f6586659ab9e8dbdba14a5582ec63cd0b3c38a441c0248e45de24436c634fc410f
7
+ data.tar.gz: 48b598eaa21bf1285d136a0fa09d40eeb9e56692d9b724f2186920ce4009a83adf57f25db9dc1c7e65c9895b40f926af5b3c35c55d02fdf02ac50f40bcdb0bc4
@@ -31,6 +31,7 @@ module Dependabot
31
31
  fetched_files << buildfile
32
32
  fetched_files += subproject_buildfiles
33
33
  fetched_files += dependency_script_plugins
34
+ check_required_files_present
34
35
  fetched_files
35
36
  end
36
37
 
@@ -38,7 +39,7 @@ module Dependabot
38
39
  @buildfile ||= begin
39
40
  file = supported_build_file
40
41
  @buildfile_name ||= file.name if file
41
- fetch_file_from_host(file.name) if file
42
+ file
42
43
  end
43
44
  end
44
45
 
@@ -58,7 +59,10 @@ module Dependabot
58
59
  end.compact
59
60
  end
60
61
 
62
+ # rubocop:disable Metrics/PerceivedComplexity
61
63
  def dependency_script_plugins
64
+ return [] unless buildfile
65
+
62
66
  dependency_plugin_paths =
63
67
  buildfile.content.
64
68
  scan(/apply from:\s+['"]([^'"]+)['"]/).flatten.
@@ -77,6 +81,15 @@ module Dependabot
77
81
  raise
78
82
  end.compact
79
83
  end
84
+ # rubocop:enable Metrics/PerceivedComplexity
85
+
86
+ def check_required_files_present
87
+ return if buildfile
88
+
89
+ path = Pathname.new(File.join(directory, "build.gradle")).cleanpath.to_path
90
+ path += "(.kts)?"
91
+ raise Dependabot::DependencyFileNotFound, path
92
+ end
80
93
 
81
94
  def file_exists_in_submodule?(path)
82
95
  fetch_file_from_host(path, fetch_submodules: true)
@@ -86,12 +99,7 @@ module Dependabot
86
99
  end
87
100
 
88
101
  def settings_file
89
- @settings_file ||= begin
90
- file = supported_settings_file
91
- fetch_file_from_host(file.name) if file
92
- rescue Dependabot::DependencyFileNotFound
93
- nil
94
- end
102
+ @settings_file ||= supported_settings_file
95
103
  end
96
104
 
97
105
  def supported_build_file
@@ -36,8 +36,6 @@ module Dependabot
36
36
  /(?:^|\s)dependencySet\((?<arguments>[^\)]+)\)\s*\{/.freeze
37
37
  DEPENDENCY_SET_ENTRY_REGEX = /entry\s+['"](?<name>#{PART})['"]/.freeze
38
38
  PLUGIN_BLOCK_DECLARATION_REGEX = /(?:^|\s)plugins\s*\{/.freeze
39
- PLUGIN_BLOCK_ENTRY_REGEX =
40
- /id\s+"(?<id>#{PART})"\s+version\s+"(?<version>#{VSN_PART})"/.freeze
41
39
  PLUGIN_ID_REGEX = /['"](?<id>#{PART})['"]/.freeze
42
40
 
43
41
  def parse
@@ -149,14 +147,14 @@ module Dependabot
149
147
 
150
148
  plugin_blocks.each do |blk|
151
149
  blk.lines.each do |line|
152
- name_regex = /id(\s+#{PLUGIN_ID_REGEX}|\(#{PLUGIN_ID_REGEX}\))/
150
+ name_regex = /(id|kotlin)(\s+#{PLUGIN_ID_REGEX}|\(#{PLUGIN_ID_REGEX}\))/
153
151
  name = line.match(name_regex)&.named_captures&.fetch("id")
154
152
  version_regex = /version\s+['"](?<version>#{VSN_PART})['"]/
155
153
  version = line.match(version_regex)&.named_captures&.
156
154
  fetch("version")
157
155
  next unless name && version
158
156
 
159
- details = { name: name, group: "plugins", version: version }
157
+ details = { name: name, group: "plugins", extra_groups: extra_groups(line), version: version }
160
158
  dep = dependency_from(details_hash: details, buildfile: buildfile)
161
159
  dependency_set << dep if dep
162
160
  end
@@ -165,6 +163,10 @@ module Dependabot
165
163
  dependency_set
166
164
  end
167
165
 
166
+ def extra_groups(line)
167
+ line.match(/kotlin(\s+#{PLUGIN_ID_REGEX}|\(#{PLUGIN_ID_REGEX}\))/) ? ["kotlin"] : []
168
+ end
169
+
168
170
  def argument_from_string(string, arg_name)
169
171
  string.
170
172
  match(map_value_regex(arg_name))&.
@@ -176,13 +178,14 @@ module Dependabot
176
178
  group = evaluated_value(details_hash[:group], buildfile)
177
179
  name = evaluated_value(details_hash[:name], buildfile)
178
180
  version = evaluated_value(details_hash[:version], buildfile)
181
+ extra_groups = details_hash[:extra_groups] || []
179
182
 
180
183
  dependency_name =
181
184
  if group == "plugins" then name
182
185
  else "#{group}:#{name}"
183
186
  end
184
187
  groups =
185
- if group == "plugins" then ["plugins"]
188
+ if group == "plugins" then ["plugins"] + extra_groups
186
189
  else []
187
190
  end
188
191
  source =
@@ -140,7 +140,7 @@ module Dependabot
140
140
  next false unless line.include?(dependency.name.split(":").last)
141
141
  else
142
142
  name_regex_value = /['"]#{Regexp.quote(dependency.name)}['"]/
143
- name_regex = /id(\s+#{name_regex_value}|\(#{name_regex_value}\))/
143
+ name_regex = /(id|kotlin)(\s+#{name_regex_value}|\(#{name_regex_value}\))/
144
144
  next false unless line.match?(name_regex)
145
145
  end
146
146
 
@@ -11,6 +11,7 @@ module Dependabot
11
11
  class MetadataFinder < Dependabot::MetadataFinders::Base
12
12
  DOT_SEPARATOR_REGEX = %r{\.(?!\d+([.\/_\-]|$)+)}.freeze
13
13
  PROPERTY_REGEX = /\$\{(?<property>.*?)\}/.freeze
14
+ KOTLIN_PLUGIN_REPO_PREFIX = "org.jetbrains.kotlin"
14
15
 
15
16
  private
16
17
 
@@ -101,7 +102,8 @@ module Dependabot
101
102
  return @dependency_pom_file unless @dependency_pom_file.nil?
102
103
 
103
104
  artifact_id =
104
- if plugin? then "#{dependency.name}.gradle.plugin"
105
+ if kotlin_plugin? then "#{KOTLIN_PLUGIN_REPO_PREFIX}.#{dependency.name}.gradle.plugin"
106
+ elsif plugin? then "#{dependency.name}.gradle.plugin"
105
107
  else dependency.name.split(":").last
106
108
  end
107
109
 
@@ -150,7 +152,10 @@ module Dependabot
150
152
 
151
153
  def maven_repo_dependency_url
152
154
  group_id, artifact_id =
153
- if plugin? then [dependency.name, "#{dependency.name}.gradle.plugin"]
155
+ if kotlin_plugin?
156
+ ["#{KOTLIN_PLUGIN_REPO_PREFIX}.#{dependency.name}",
157
+ "#{KOTLIN_PLUGIN_REPO_PREFIX}.#{dependency.name}.gradle.plugin"]
158
+ elsif plugin? then [dependency.name, "#{dependency.name}.gradle.plugin"]
154
159
  else dependency.name.split(":")
155
160
  end
156
161
 
@@ -158,7 +163,11 @@ module Dependabot
158
163
  end
159
164
 
160
165
  def plugin?
161
- dependency.requirements.any? { |r| r.fetch(:groups) == ["plugins"] }
166
+ dependency.requirements.any? { |r| r.fetch(:groups).include? "plugins" }
167
+ end
168
+
169
+ def kotlin_plugin?
170
+ plugin? && dependency.requirements.any? { |r| r.fetch(:groups).include? "kotlin" }
162
171
  end
163
172
 
164
173
  def auth_details
@@ -13,6 +13,7 @@ module Dependabot
13
13
  class VersionFinder
14
14
  GOOGLE_MAVEN_REPO = "https://maven.google.com"
15
15
  GRADLE_PLUGINS_REPO = "https://plugins.gradle.org/m2"
16
+ KOTLIN_PLUGIN_REPO_PREFIX = "org.jetbrains.kotlin"
16
17
  TYPE_SUFFICES = %w(jre android java).freeze
17
18
 
18
19
  GRADLE_RANGE_REGEX = /[\(\[].*,.*[\)\]]/.freeze
@@ -295,6 +296,7 @@ module Dependabot
295
296
 
296
297
  def dependency_metadata_url(repository_url)
297
298
  group_id, artifact_id = group_and_artifact_ids
299
+ group_id = "#{KOTLIN_PLUGIN_REPO_PREFIX}.#{group_id}" if kotlin_plugin?
298
300
 
299
301
  "#{repository_url}/"\
300
302
  "#{group_id.tr('.', '/')}/"\
@@ -303,7 +305,9 @@ module Dependabot
303
305
  end
304
306
 
305
307
  def group_and_artifact_ids
306
- if plugin?
308
+ if kotlin_plugin?
309
+ [dependency.name, "#{KOTLIN_PLUGIN_REPO_PREFIX}.#{dependency.name}.gradle.plugin"]
310
+ elsif plugin?
307
311
  [dependency.name, "#{dependency.name}.gradle.plugin"]
308
312
  else
309
313
  dependency.name.split(":")
@@ -311,7 +315,11 @@ module Dependabot
311
315
  end
312
316
 
313
317
  def plugin?
314
- dependency.requirements.any? { |r| r.fetch(:groups) == ["plugins"] }
318
+ dependency.requirements.any? { |r| r.fetch(:groups).include? "plugins" }
319
+ end
320
+
321
+ def kotlin_plugin?
322
+ plugin? && dependency.requirements.any? { |r| r.fetch(:groups).include? "kotlin" }
315
323
  end
316
324
 
317
325
  def central_repo_urls
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-gradle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.129.2
4
+ version: 0.130.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-04 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.129.2
19
+ version: 0.130.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.129.2
26
+ version: 0.130.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.7.0
103
+ version: 1.8.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.7.0
110
+ version: 1.8.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: 2.5.0
208
208
  requirements: []
209
- rubygems_version: 3.1.4
209
+ rubygems_version: 3.2.3
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Gradle support for dependabot