bibliothecary 8.4.2 → 8.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c21d1063a79efb1b133d650ba0d24754c26a9487341cc9e711f5387d22912602
4
- data.tar.gz: f75fd37ef4c6262b3c23e908b6a044187ac048c96398eb8e7312b020e259ca6d
3
+ metadata.gz: 6abe09e3167fa5ad9a80a6d930229647039466c357d331d5053e87339e28cc2f
4
+ data.tar.gz: 2ac7a02f2275c7d8bb1402c9536c481734e3216a0c1109a99e26c8d271e119d5
5
5
  SHA512:
6
- metadata.gz: d513694486a3af6bd68c654c022bf30e2ce601cf2f0150b41f824368ba5f826a47ec688c6a8e32adce516ac35bbe7baa234992d0d1cb24d4b630ba221ceaf92b
7
- data.tar.gz: 63ae337f307b054c7b5c846c9847780a5a2f4a9d97502fd589ff35280acfd77f026a2abcb193dc2bb48ffb309c216561841d49b53cc985659ffbb72bc930dda1
6
+ metadata.gz: 6cf5a7bd4bee3fa2490876d2f14f1ced959a7e11178476439fcfbb6951aeb8b740d46ed21e78a537028b5b09a65afbbc7aeb544dade1863a791e1e95604abc49
7
+ data.tar.gz: 5288808d2301c01c72dcb61888099c49f06753e15d9d09e86d2d934ae30671f1d80d6aa93a935ffb1b46ee3bd1b1100283bf055b61d16ca23fa8de5f7e9c3aab
@@ -12,15 +12,15 @@ module Bibliothecary
12
12
  # e.g. "| \\--- com.google.guava:guava:23.5-jre (*)"
13
13
  GRADLE_DEP_REGEX = /(\+---|\\---){1}/
14
14
 
15
- # Project declaration lines so we know the current project name
16
- # e.g. "Project ':submodules:test'" (this example is a project nested in submodules/test/ folder)
17
- GRADLE_PROJECT_DECLARATION_REGEX = /Project '?:([^\s']+)'?/
18
-
19
15
  # Dependencies that are on-disk projects, eg:
20
16
  # e.g. "\--- project :api:my-internal-project"
21
17
  # e.g. "+--- my-group:my-alias:1.2.3 -> project :client (*)"
22
18
  GRADLE_PROJECT_REGEX = /project :(\S+)?/
23
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|\*)\))$/
23
+
24
24
  # Builtin methods: https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations
25
25
  # Deprecated methods: https://docs.gradle.org/current/userguide/upgrading_version_6.html#sec:configuration_removal
26
26
  GRADLE_DEPENDENCY_METHODS = %w(api compile compileClasspath compileOnly compileOnlyApi implementation runtime runtimeClasspath runtimeOnly testCompile testCompileOnly testImplementation testRuntime testRuntimeOnly)
@@ -148,15 +148,11 @@ module Bibliothecary
148
148
 
149
149
  def self.parse_gradle_resolved(file_contents, options: {})
150
150
  current_type = nil
151
- current_project = nil
152
151
 
153
152
  file_contents.split("\n").map do |line|
154
153
  current_type_match = GRADLE_TYPE_REGEX.match(line)
155
154
  current_type = current_type_match.captures[0] if current_type_match
156
155
 
157
- current_project_match = GRADLE_PROJECT_DECLARATION_REGEX.match(line)
158
- current_project = current_project_match.captures[0] if current_project_match
159
-
160
156
  gradle_dep_match = GRADLE_DEP_REGEX.match(line)
161
157
  next unless gradle_dep_match
162
158
 
@@ -165,15 +161,17 @@ module Bibliothecary
165
161
  # gradle can import on-disk projects and deps will be listed under them, e.g. `+--- project :test:integration`,
166
162
  # so we treat these projects as "internal" deps with requirement of "1.0.0"
167
163
  if (project_match = line.match(GRADLE_PROJECT_REGEX))
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
+
168
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.
169
- project_name = (project_match[1] || current_project).gsub(/:/, "-")
168
+ project_name = project_match[1].gsub(/:/, "-")
170
169
  line = line.sub(GRADLE_PROJECT_REGEX, "internal:#{project_name}:1.0.0")
171
- else
172
- project_name = ""
173
170
  end
174
171
 
175
172
  dep = line
176
- .split(split)[1].sub(/(\((c|n|\*)\))$/, "") # 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 (*)
173
+ .split(split)[1]
174
+ .sub(GRADLE_LINE_ENDING_REGEX, "")
177
175
  .sub(/ FAILED$/, "") # dependency could not be resolved (but still may have a version)
178
176
  .sub(" -> ", ":") # handle version arrow syntax
179
177
  .strip
@@ -211,8 +209,6 @@ module Bibliothecary
211
209
  end
212
210
  end
213
211
  .compact
214
- # Prefer duplicate deps with the aliased ones first, so we don't lose the aliases in the next uniq step.
215
- .sort_by { |dep| dep.key?(:original_name) || dep.key?(:original_requirement) ? 0 : 1 }
216
212
  .uniq { |item| item.values_at(:name, :requirement, :type, :original_name, :original_requirement) }
217
213
  end
218
214
 
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.4.2"
2
+ VERSION = "8.4.4"
3
3
  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.2
4
+ version: 8.4.4
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-20 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
339
  - !ruby/object:Gem::Version
340
340
  version: '0'
341
341
  requirements: []
342
- rubygems_version: 3.1.6
342
+ rubygems_version: 3.3.22
343
343
  signing_key:
344
344
  specification_version: 4
345
345
  summary: Find and parse manifests