bibliothecary 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/bibliothecary/parsers/maven.rb +62 -36
- 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: 78844f8813583a84df76e0ad0c72f9b8136b47d82aec8194e3e6766049ba721b
|
4
|
+
data.tar.gz: bb84e383f0bbded7361d7efbf4550f100d08281a294def960c95ddb1dca4f97c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f537a3fd368046789baf28c758b8f60d8832b7601f2ae78211a78d4d583ee7ddc4d4729f1ca3387e92958756586a6c1608099a4849db70c9e0a2a3b7405ff564
|
7
|
+
data.tar.gz: 8b9d7e93affe8df9d4e898bf4c128f912f16dd2e1c61ba7dfde0163690df91c173ed0a75c48717a702ddb45dfff2053527b5730c3d76738e7bf51b2344d09cff
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
13
13
|
|
14
14
|
### Removed
|
15
15
|
|
16
|
+
|
17
|
+
## [11.0.1] - 2024-12-20
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- Alow retrieving maven versions from parent poms
|
22
|
+
|
16
23
|
## [11.0.0] - 2024-11-22
|
17
24
|
|
18
25
|
### Changed
|
@@ -294,48 +294,74 @@ module Bibliothecary
|
|
294
294
|
parse_pom_manifest(file_contents, {}, options: options)
|
295
295
|
end
|
296
296
|
|
297
|
-
# parent_properties is used by Libraries:
|
298
|
-
# https://github.com/librariesio/libraries.io/blob/e970925aade2596a03268b6e1be785eba8502c62/app/models/package_manager/maven.rb#L129
|
299
297
|
def self.parse_pom_manifest(file_contents, parent_properties = {}, options: {}) # rubocop:disable Lint/UnusedMethodArgument
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
298
|
+
parse_pom_manifests([file_contents], parent_properties)
|
299
|
+
end
|
300
|
+
|
301
|
+
# @param files [Array<String>] Ordered array of strings containing the
|
302
|
+
# pom.xml bodies. The first element should be the child file.
|
303
|
+
# @param merged_properties [Hash]
|
304
|
+
def self.parse_pom_manifests(files, merged_properties)
|
305
|
+
documents = files.map do |file|
|
306
|
+
doc = Ox.parse(file)
|
307
|
+
doc.respond_to?("project") ? doc.project : doc
|
308
|
+
end
|
309
|
+
|
310
|
+
mergedDependencyManagements = {}
|
311
|
+
documents.each do |document|
|
312
|
+
document.locate("dependencyManagement/dependencies/dependency").each do |dep|
|
313
|
+
groupId = extract_pom_dep_info(document, dep, "groupId", merged_properties)
|
314
|
+
artifactId = extract_pom_dep_info(document, dep, "artifactId", merged_properties)
|
315
|
+
key = "#{groupId}:#{artifactId}"
|
316
|
+
mergedDependencyManagements[key] ||=
|
317
|
+
{
|
318
|
+
groupId: groupId,
|
319
|
+
artifactId: artifactId,
|
320
|
+
version: extract_pom_dep_info(document, dep, "version", merged_properties),
|
321
|
+
scope: extract_pom_dep_info(document, dep, "scope", merged_properties),
|
322
|
+
}
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
dep_hashes = {}
|
327
|
+
documents.each do |document|
|
328
|
+
document.locate("dependencies/dependency").each do |dep|
|
329
|
+
groupId = extract_pom_dep_info(document, dep, "groupId", merged_properties)
|
330
|
+
artifactId = extract_pom_dep_info(document, dep, "artifactId", merged_properties)
|
331
|
+
key = "#{groupId}:#{artifactId}"
|
332
|
+
unless dep_hashes.key?(key)
|
333
|
+
dep_hashes[key] = {
|
334
|
+
name: key,
|
335
|
+
requirement: nil,
|
336
|
+
type: nil,
|
337
|
+
optional: nil,
|
338
|
+
}
|
326
339
|
end
|
340
|
+
dep_hash = dep_hashes[key]
|
341
|
+
|
342
|
+
dep_hash[:requirement] ||= extract_pom_dep_info(document, dep, "version", merged_properties)
|
343
|
+
dep_hash[:type] ||= extract_pom_dep_info(document, dep, "scope", merged_properties)
|
327
344
|
|
328
|
-
dep_hash = {
|
329
|
-
name: "#{groupId}:#{artifactId}",
|
330
|
-
requirement: version,
|
331
|
-
type: scope || "runtime",
|
332
|
-
}
|
333
345
|
# optional field is, itself, optional, and will be either "true" or "false"
|
334
|
-
optional = extract_pom_dep_info(
|
335
|
-
dep_hash[:optional]
|
336
|
-
|
346
|
+
optional = extract_pom_dep_info(document, dep, "optional", merged_properties)
|
347
|
+
if dep_hash[:optional].nil? && !optional.nil?
|
348
|
+
dep_hash[:optional] = optional == "true"
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
# Anything that wasn't covered by a dependency version, get from the
|
354
|
+
# dependencyManagements
|
355
|
+
dep_hashes.each do |key, dep_hash|
|
356
|
+
if (dependencyManagement = mergedDependencyManagements[key])
|
357
|
+
dep_hash[:requirement] ||= dependencyManagement[:version]
|
358
|
+
dep_hash[:type] ||= dependencyManagement[:scope]
|
337
359
|
end
|
360
|
+
|
361
|
+
dep_hash[:type] ||= "runtime"
|
338
362
|
end
|
363
|
+
|
364
|
+
dep_hashes.map{|key, dep_hash| Dependency.new(**dep_hash)}
|
339
365
|
end
|
340
366
|
|
341
367
|
def self.parse_gradle(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
|
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: 11.0.
|
4
|
+
version: 11.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|