dependabot-gradle 0.162.0 → 0.164.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/gradle/file_fetcher.rb +20 -15
- data/lib/dependabot/gradle/file_parser/property_value_finder.rb +8 -4
- data/lib/dependabot/gradle/file_parser/repositories_finder.rb +13 -6
- data/lib/dependabot/gradle/file_parser.rb +16 -5
- data/lib/dependabot/gradle/file_updater.rb +1 -1
- data/lib/dependabot/gradle/update_checker/version_finder.rb +4 -6
- data/lib/dependabot/gradle/version.rb +3 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b7e103d33b9dbdae9a5d6731b4b530dc35bdc7bd951ec12ebc770aa82cb3f97
|
4
|
+
data.tar.gz: 58c43452809caefea7d79ab909953a32d2c2e650d937f453f99d7fa7f5abea9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 554a254accc568cd46b613cc97a57a1452553eb799b0776f0b77d45331b1930d964dc2d56220c7a5d5a94c7701111e51c3615fb6a05532db320b43d11313ff96
|
7
|
+
data.tar.gz: 631315b31d790b68bfaec9c9aa252151653a40f0b1d0e468318b99e3343b8b3ed33c4156b2f7fed7ab910d9d7a79fb9b447efa5c1be258bf4eda0524efd1e4de
|
@@ -28,7 +28,7 @@ module Dependabot
|
|
28
28
|
|
29
29
|
def fetch_files
|
30
30
|
fetched_files = []
|
31
|
-
fetched_files << buildfile
|
31
|
+
fetched_files << buildfile if buildfile
|
32
32
|
fetched_files += subproject_buildfiles
|
33
33
|
fetched_files += dependency_script_plugins
|
34
34
|
check_required_files_present
|
@@ -46,17 +46,23 @@ module Dependabot
|
|
46
46
|
def subproject_buildfiles
|
47
47
|
return [] unless settings_file
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
49
|
+
@subproject_buildfiles ||= begin
|
50
|
+
subproject_paths =
|
51
|
+
SettingsFileParser.
|
52
|
+
new(settings_file: settings_file).
|
53
|
+
subproject_paths
|
54
|
+
|
55
|
+
subproject_paths.map do |path|
|
56
|
+
if @buildfile_name
|
57
|
+
fetch_file_from_host(File.join(path, @buildfile_name))
|
58
|
+
else
|
59
|
+
supported_file(SUPPORTED_BUILD_FILE_NAMES.map { |f| File.join(path, f) })
|
60
|
+
end
|
61
|
+
rescue Dependabot::DependencyFileNotFound
|
62
|
+
# Gradle itself doesn't worry about missing subprojects, so we don't
|
63
|
+
nil
|
64
|
+
end.compact
|
65
|
+
end
|
60
66
|
end
|
61
67
|
|
62
68
|
# rubocop:disable Metrics/PerceivedComplexity
|
@@ -64,8 +70,7 @@ module Dependabot
|
|
64
70
|
return [] unless buildfile
|
65
71
|
|
66
72
|
dependency_plugin_paths =
|
67
|
-
buildfile.
|
68
|
-
scan(/apply from:\s+['"]([^'"]+)['"]/).flatten.
|
73
|
+
FileParser.find_include_names(buildfile).
|
69
74
|
reject { |path| path.include?("://") }.
|
70
75
|
reject { |path| !path.include?("/") && path.split(".").count > 2 }.
|
71
76
|
select { |filename| filename.include?("dependencies") }.
|
@@ -84,7 +89,7 @@ module Dependabot
|
|
84
89
|
# rubocop:enable Metrics/PerceivedComplexity
|
85
90
|
|
86
91
|
def check_required_files_present
|
87
|
-
return if buildfile
|
92
|
+
return if buildfile || (subproject_buildfiles && !subproject_buildfiles.empty?)
|
88
93
|
|
89
94
|
path = Pathname.new(File.join(directory, "build.gradle")).cleanpath.to_path
|
90
95
|
path += "(.kts)?"
|
@@ -96,11 +96,15 @@ module Dependabot
|
|
96
96
|
|
97
97
|
# Look for a property in the callsite buildfile. If that fails, look
|
98
98
|
# for the property in the top-level buildfile
|
99
|
-
|
100
|
-
|
99
|
+
all_files = [callsite_buildfile, top_level_buildfile].concat(
|
100
|
+
FileParser.find_includes(callsite_buildfile, dependency_files),
|
101
|
+
FileParser.find_includes(top_level_buildfile, dependency_files)
|
102
|
+
)
|
103
|
+
all_files.each do |file|
|
104
|
+
details = properties(file).fetch(property_name, nil)
|
105
|
+
return details if details
|
101
106
|
end
|
102
|
-
|
103
|
-
properties(top_level_buildfile).fetch(property_name, nil)
|
107
|
+
nil
|
104
108
|
end
|
105
109
|
|
106
110
|
def property_value(property_name:, callsite_buildfile:)
|
@@ -12,6 +12,8 @@ module Dependabot
|
|
12
12
|
# we're confident we're selecting repos correctly it's wise to include
|
13
13
|
# it as a default.
|
14
14
|
CENTRAL_REPO_URL = "https://repo.maven.apache.org/maven2"
|
15
|
+
GOOGLE_MAVEN_REPO = "https://maven.google.com"
|
16
|
+
GRADLE_PLUGINS_REPO = "https://plugins.gradle.org/m2"
|
15
17
|
|
16
18
|
REPOSITORIES_BLOCK_START = /(?:^|\s)repositories\s*\{/.freeze
|
17
19
|
|
@@ -32,7 +34,10 @@ module Dependabot
|
|
32
34
|
|
33
35
|
def repository_urls
|
34
36
|
repository_urls = []
|
35
|
-
repository_urls += inherited_repository_urls
|
37
|
+
repository_urls += inherited_repository_urls(top_level_buildfile)
|
38
|
+
FileParser.find_includes(top_level_buildfile, dependency_files).each do |dependency_file|
|
39
|
+
repository_urls += inherited_repository_urls(dependency_file)
|
40
|
+
end
|
36
41
|
repository_urls += own_buildfile_repository_urls
|
37
42
|
repository_urls = repository_urls.uniq
|
38
43
|
|
@@ -45,10 +50,10 @@ module Dependabot
|
|
45
50
|
|
46
51
|
attr_reader :dependency_files, :target_dependency_file
|
47
52
|
|
48
|
-
def inherited_repository_urls
|
49
|
-
return [] unless
|
53
|
+
def inherited_repository_urls(dependency_file)
|
54
|
+
return [] unless dependency_file
|
50
55
|
|
51
|
-
buildfile_content = comment_free_content(
|
56
|
+
buildfile_content = comment_free_content(dependency_file)
|
52
57
|
subproject_blocks = []
|
53
58
|
|
54
59
|
buildfile_content.scan(/(?:^|\s)allprojects\s*\{/) do
|
@@ -93,12 +98,14 @@ module Dependabot
|
|
93
98
|
end
|
94
99
|
|
95
100
|
repository_blocks.each do |block|
|
96
|
-
repository_urls <<
|
101
|
+
repository_urls << GOOGLE_MAVEN_REPO if block.match?(/\sgoogle\(/)
|
97
102
|
|
98
|
-
repository_urls <<
|
103
|
+
repository_urls << CENTRAL_REPO_URL if block.match?(/\smavenCentral\(/)
|
99
104
|
|
100
105
|
repository_urls << "https://jcenter.bintray.com/" if block.match?(/\sjcenter\(/)
|
101
106
|
|
107
|
+
repository_urls << GRADLE_PLUGINS_REPO if block.match?(/\sgradlePluginPortal\(/)
|
108
|
+
|
102
109
|
block.scan(MAVEN_REPO_REGEX) do
|
103
110
|
repository_urls << Regexp.last_match.named_captures.fetch("url")
|
104
111
|
end
|
@@ -49,6 +49,20 @@ module Dependabot
|
|
49
49
|
dependency_set.dependencies
|
50
50
|
end
|
51
51
|
|
52
|
+
def self.find_include_names(buildfile)
|
53
|
+
return [] unless buildfile
|
54
|
+
|
55
|
+
buildfile.content.
|
56
|
+
scan(/apply(\(| )\s*from(\s+=|:)\s+['"]([^'"]+)['"]/).
|
57
|
+
map { |match| match[2] }
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.find_includes(buildfile, dependency_files)
|
61
|
+
FileParser.find_include_names(buildfile).
|
62
|
+
map { |f| dependency_files.find { |bf| bf.name == f } }.
|
63
|
+
compact
|
64
|
+
end
|
65
|
+
|
52
66
|
private
|
53
67
|
|
54
68
|
def map_value_regex(key)
|
@@ -301,16 +315,13 @@ module Dependabot
|
|
301
315
|
def script_plugin_files
|
302
316
|
@script_plugin_files ||=
|
303
317
|
buildfiles.flat_map do |buildfile|
|
304
|
-
buildfile
|
305
|
-
scan(/apply from(\s+=|:)\s+['"]([^'"]+)['"]/).flatten.
|
306
|
-
map { |f| dependency_files.find { |bf| bf.name == f } }.
|
307
|
-
compact
|
318
|
+
FileParser.find_includes(buildfile, dependency_files)
|
308
319
|
end.
|
309
320
|
uniq
|
310
321
|
end
|
311
322
|
|
312
323
|
def check_required_files
|
313
|
-
raise "No build.gradle or build.gradle.kts!"
|
324
|
+
raise "No build.gradle or build.gradle.kts!" if dependency_files.empty?
|
314
325
|
end
|
315
326
|
|
316
327
|
def original_file
|
@@ -13,8 +13,6 @@ module Dependabot
|
|
13
13
|
module Gradle
|
14
14
|
class UpdateChecker
|
15
15
|
class VersionFinder
|
16
|
-
GOOGLE_MAVEN_REPO = "https://maven.google.com"
|
17
|
-
GRADLE_PLUGINS_REPO = "https://plugins.gradle.org/m2"
|
18
16
|
KOTLIN_PLUGIN_REPO_PREFIX = "org.jetbrains.kotlin"
|
19
17
|
TYPE_SUFFICES = %w(jre android java native_mt agp).freeze
|
20
18
|
|
@@ -59,7 +57,7 @@ module Dependabot
|
|
59
57
|
version_details =
|
60
58
|
repositories.map do |repository_details|
|
61
59
|
url = repository_details.fetch("url")
|
62
|
-
next google_version_details if url == GOOGLE_MAVEN_REPO
|
60
|
+
next google_version_details if url == Gradle::FileParser::RepositoriesFinder::GOOGLE_MAVEN_REPO
|
63
61
|
|
64
62
|
dependency_metadata(repository_details).css("versions > version").
|
65
63
|
select { |node| version_class.correct?(node.content) }.
|
@@ -136,10 +134,10 @@ module Dependabot
|
|
136
134
|
end
|
137
135
|
|
138
136
|
def google_version_details
|
139
|
-
url = GOOGLE_MAVEN_REPO
|
137
|
+
url = Gradle::FileParser::RepositoriesFinder::GOOGLE_MAVEN_REPO
|
140
138
|
group_id, artifact_id = group_and_artifact_ids
|
141
139
|
|
142
|
-
dependency_metadata_url = "#{GOOGLE_MAVEN_REPO}/"\
|
140
|
+
dependency_metadata_url = "#{Gradle::FileParser::RepositoriesFinder::GOOGLE_MAVEN_REPO}/"\
|
143
141
|
"#{group_id.tr('.', '/')}/"\
|
144
142
|
"group-index.xml"
|
145
143
|
|
@@ -250,7 +248,7 @@ module Dependabot
|
|
250
248
|
|
251
249
|
def plugin_repository_details
|
252
250
|
[{
|
253
|
-
"url" => GRADLE_PLUGINS_REPO,
|
251
|
+
"url" => Gradle::FileParser::RepositoriesFinder::GRADLE_PLUGINS_REPO,
|
254
252
|
"auth_headers" => {}
|
255
253
|
}] + dependency_repository_details
|
256
254
|
end
|
@@ -14,7 +14,8 @@ module Dependabot
|
|
14
14
|
NULL_VALUES = %w(0 final ga).freeze
|
15
15
|
PREFIXED_TOKEN_HIERARCHY = {
|
16
16
|
"." => { qualifier: 1, number: 4 },
|
17
|
-
"-" => { qualifier: 2, number: 3 }
|
17
|
+
"-" => { qualifier: 2, number: 3 },
|
18
|
+
"_" => { qualifier: 2, number: 3 }
|
18
19
|
}.freeze
|
19
20
|
NAMED_QUALIFIERS_HIERARCHY = {
|
20
21
|
"a" => 1, "alpha" => 1,
|
@@ -132,7 +133,7 @@ module Dependabot
|
|
132
133
|
end
|
133
134
|
|
134
135
|
def split_into_prefixed_tokens(version)
|
135
|
-
".#{version}".split(/(?=[\-\.])/)
|
136
|
+
".#{version}".split(/(?=[_\-\.])/)
|
136
137
|
end
|
137
138
|
|
138
139
|
def pad_for_comparison(prefixed_tokens, other_prefixed_tokens)
|
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.
|
4
|
+
version: 0.164.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.164.0
|
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.
|
26
|
+
version: 0.164.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dependabot-maven
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.164.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.164.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|