bibliothecary 8.4.0 → 8.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliothecary/parsers/maven.rb +25 -23
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a0df595a08d1414ee9e6a119f4dbb82f6b7d5601a82c03121a3c1a456977ec
|
4
|
+
data.tar.gz: 1a81bfd9393e69be750950a1d6b382c1bc8c45b0d4b9191bdaf551b4af7e5725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9773287184bc08731228578b3f88218eaa261a462a89ae823222300c71a6276e23331acaef7ee1f2cace14b14e95f5b4d3fcce836bd51ebff35844d6547aee50
|
7
|
+
data.tar.gz: 5ffc87d102724e5a1f0d6d930f094a2591de23ff921aaee6670fb4d54988a10ffedd4d968477113e8acc44ac7d64e07d68a2906a91f32d19e3e0f43503b72ef5
|
@@ -9,13 +9,17 @@ module Bibliothecary
|
|
9
9
|
# e.g. "annotationProcessor - Annotation processors and their dependencies for source set 'main'."
|
10
10
|
GRADLE_TYPE_REGEX = /^(\w+)/
|
11
11
|
|
12
|
-
# "| \\--- com.google.guava:guava:23.5-jre (*)"
|
12
|
+
# e.g. "| \\--- com.google.guava:guava:23.5-jre (*)"
|
13
13
|
GRADLE_DEP_REGEX = /(\+---|\\---){1}/
|
14
14
|
|
15
15
|
# Dependencies that are on-disk projects, eg:
|
16
|
-
# \--- project :api:my-internal-project
|
17
|
-
# +--- my-group:my-alias:1.2.3 -> project :client (*)
|
18
|
-
GRADLE_PROJECT_REGEX = /project :(\S+)
|
16
|
+
# e.g. "\--- project :api:my-internal-project"
|
17
|
+
# e.g. "+--- my-group:my-alias:1.2.3 -> project :client (*)"
|
18
|
+
GRADLE_PROJECT_REGEX = /project :(\S+)?/
|
19
|
+
|
20
|
+
# line ending legend: (c) means a dependency constraint, (n) means not resolved, or (*) means resolved previously, e.g. org.springframework.boot:spring-boot-starter-web:2.1.0.M3 (*)
|
21
|
+
# e.g. the "(n)" in "+--- my-group:my-name:1.2.3 (n)"
|
22
|
+
GRADLE_LINE_ENDING_REGEX = /(\((c|n|\*)\))$/
|
19
23
|
|
20
24
|
# Builtin methods: https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations
|
21
25
|
# Deprecated methods: https://docs.gradle.org/current/userguide/upgrading_version_6.html#sec:configuration_removal
|
@@ -143,37 +147,35 @@ module Bibliothecary
|
|
143
147
|
end
|
144
148
|
|
145
149
|
def self.parse_gradle_resolved(file_contents, options: {})
|
146
|
-
|
150
|
+
current_type = nil
|
151
|
+
|
147
152
|
file_contents.split("\n").map do |line|
|
148
|
-
|
149
|
-
|
153
|
+
current_type_match = GRADLE_TYPE_REGEX.match(line)
|
154
|
+
current_type = current_type_match.captures[0] if current_type_match
|
150
155
|
|
151
156
|
gradle_dep_match = GRADLE_DEP_REGEX.match(line)
|
152
157
|
next unless gradle_dep_match
|
153
158
|
|
154
159
|
split = gradle_dep_match.captures[0]
|
155
160
|
|
156
|
-
# gradle can import on-disk projects and deps will be listed under them, e.g. `+--- project :
|
157
|
-
# so we treat these projects as internal deps
|
161
|
+
# gradle can import on-disk projects and deps will be listed under them, e.g. `+--- project :test:integration`,
|
162
|
+
# so we treat these projects as "internal" deps with requirement of "1.0.0"
|
158
163
|
if (project_match = line.match(GRADLE_PROJECT_REGEX))
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
164
|
+
# an empty project name is self-referential (i.e. a cycle), and we don't need to track the manifest's project itself, e.g. "+--- project :"
|
165
|
+
next if project_match[1].nil?
|
166
|
+
|
167
|
+
# project names can have colons (e.g. for gradle projects in subfolders), which breaks maven artifact naming assumptions, so just replace them with hyphens.
|
168
|
+
project_name = project_match[1].gsub(/:/, "-")
|
169
|
+
line = line.sub(GRADLE_PROJECT_REGEX, "internal:#{project_name}:1.0.0")
|
163
170
|
end
|
164
171
|
|
165
172
|
dep = line
|
166
|
-
.split(split)[1]
|
173
|
+
.split(split)[1]
|
174
|
+
.sub(GRADLE_LINE_ENDING_REGEX, "")
|
167
175
|
.sub(/ FAILED$/, "") # dependency could not be resolved (but still may have a version)
|
168
176
|
.sub(" -> ", ":") # handle version arrow syntax
|
169
177
|
.strip
|
170
178
|
.split(":")
|
171
|
-
.map do |part|
|
172
|
-
part
|
173
|
-
.sub(/__PROJECT_GROUP__/, "internal")# give all projects a group namespace of "internal"
|
174
|
-
.sub(/__PROJECT_NAME__/, project_name)
|
175
|
-
.sub(/__PROJECT_REQUIREMENT__/, "1.0.0") # give all projects a requirement of "1.0.0".
|
176
|
-
end # replace placeholders after we've parsed the line
|
177
179
|
|
178
180
|
# A testImplementation line can look like this so just skip those
|
179
181
|
# \--- org.springframework.security:spring-security-test (n)
|
@@ -186,7 +188,7 @@ module Bibliothecary
|
|
186
188
|
original_requirement: dep[2],
|
187
189
|
name: dep[-3..-2].join(":"),
|
188
190
|
requirement: dep[-1],
|
189
|
-
type:
|
191
|
+
type: current_type
|
190
192
|
}
|
191
193
|
elsif dep.count == 5
|
192
194
|
# get name from renamed package resolution "org:name -> renamed_org:name:version"
|
@@ -195,14 +197,14 @@ module Bibliothecary
|
|
195
197
|
original_requirement: "*",
|
196
198
|
name: dep[-3..-2].join(":"),
|
197
199
|
requirement: dep[-1],
|
198
|
-
type:
|
200
|
+
type: current_type
|
199
201
|
}
|
200
202
|
else
|
201
203
|
# get name from version conflict resolution ("org:name:version -> version") and no-resolution ("org:name:version")
|
202
204
|
{
|
203
205
|
name: dep[0..1].join(":"),
|
204
206
|
requirement: dep[-1],
|
205
|
-
type:
|
207
|
+
type: current_type
|
206
208
|
}
|
207
209
|
end
|
208
210
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibliothecary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.4.
|
4
|
+
version: 8.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|