bibliothecary 8.4.2 → 8.4.3

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: c21d1063a79efb1b133d650ba0d24754c26a9487341cc9e711f5387d22912602
4
- data.tar.gz: f75fd37ef4c6262b3c23e908b6a044187ac048c96398eb8e7312b020e259ca6d
3
+ metadata.gz: 27a0df595a08d1414ee9e6a119f4dbb82f6b7d5601a82c03121a3c1a456977ec
4
+ data.tar.gz: 1a81bfd9393e69be750950a1d6b382c1bc8c45b0d4b9191bdaf551b4af7e5725
5
5
  SHA512:
6
- metadata.gz: d513694486a3af6bd68c654c022bf30e2ce601cf2f0150b41f824368ba5f826a47ec688c6a8e32adce516ac35bbe7baa234992d0d1cb24d4b630ba221ceaf92b
7
- data.tar.gz: 63ae337f307b054c7b5c846c9847780a5a2f4a9d97502fd589ff35280acfd77f026a2abcb193dc2bb48ffb309c216561841d49b53cc985659ffbb72bc930dda1
6
+ metadata.gz: 9773287184bc08731228578b3f88218eaa261a462a89ae823222300c71a6276e23331acaef7ee1f2cace14b14e95f5b4d3fcce836bd51ebff35844d6547aee50
7
+ data.tar.gz: 5ffc87d102724e5a1f0d6d930f094a2591de23ff921aaee6670fb4d54988a10ffedd4d968477113e8acc44ac7d64e07d68a2906a91f32d19e3e0f43503b72ef5
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.4.2"
2
+ VERSION = "8.4.3"
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.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-20 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb