dependabot-bazel 0.358.0 → 0.359.0

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: 86a337c9ca53f3945dc5865f6a0043114f6c0a1c2211ec517815dc5ca77f7f38
4
- data.tar.gz: bd9c4cb47ef64d64a392d76f3f8fe76df94c9829f996a5c460a6065eec1fef1f
3
+ metadata.gz: f99443594cd6420cc0a862357e60375f7e680554f6d9391485fb5b975e166474
4
+ data.tar.gz: 3e898b1560e8827289b03df2ae3dec20b7cdf1ebe5eef05aa5c6280b92aec37c
5
5
  SHA512:
6
- metadata.gz: 5c0b5bdc9dcca0e67738132a6fc2987eb6fc5ecf84ba8191e5e1e3b5879faaafbd45fae5205a5895e9b0e51a490f0da98997683ce091de7fde08c7c9743152ad
7
- data.tar.gz: 4201907839a568e89b61034bbb313c7faca116e61b23804730db5979fabe71692b0c530323ee767de974bb2bff4af9cfb9f7d4e65d4947c5e737c90480e2aa7c
6
+ metadata.gz: 809bde25ebb43c9aea3d4319a795e57d77529e1c6228102da06fb53ae7d9b9fa7874c952457aaee7dcab412962d8d3f200e1f976fb54718a7ce738cc804cfd06
7
+ data.tar.gz: 5378eb34ca54851e868e85b38127e18acd601e72a1c6bdf9710744606fd5552342ca8b95d2a121b54786337aa32d490b95e8be3de0f8fe0d53246119fec8c1ab
@@ -9,7 +9,7 @@ module Dependabot
9
9
  module Bazel
10
10
  class FileFetcher < Dependabot::FileFetchers::Base
11
11
  # Extracts file and directory paths referenced in MODULE.bazel files.
12
- # Handles attributes like lock_file, requirements_lock, patches, and local_path_override.
12
+ # Handles attributes like lock_file, requirements_lock, patches, from_file, and local_path_override.
13
13
  class ModulePathExtractor
14
14
  extend T::Sig
15
15
 
@@ -31,13 +31,14 @@ module Dependabot
31
31
  sig { returns(DependencyFile) }
32
32
  attr_reader :module_file
33
33
 
34
- # Extracts file paths from lock_file, requirements_lock, and patches attributes.
34
+ # Extracts file paths from lock_file, requirements_lock, patches, and from_file attributes.
35
35
  sig { params(content: String).returns(T::Array[String]) }
36
36
  def extract_file_attribute_paths(content)
37
37
  (
38
38
  extract_lock_file_paths(content) +
39
39
  extract_requirements_lock_paths(content) +
40
- extract_patches_paths(content)
40
+ extract_patches_paths(content) +
41
+ extract_from_file_paths(content)
41
42
  ).compact
42
43
  end
43
44
 
@@ -65,6 +66,11 @@ module Dependabot
65
66
  patches
66
67
  end
67
68
 
69
+ sig { params(content: String).returns(T::Array[String]) }
70
+ def extract_from_file_paths(content)
71
+ content.scan(/from_file\s*=\s*"([^"]+)"/).map { |match| PathConverter.label_to_path(T.must(match[0])) }
72
+ end
73
+
68
74
  # Extracts directory paths from local_path_override attributes.
69
75
  sig { params(content: String).returns(T::Array[String]) }
70
76
  def extract_directory_paths(content)
@@ -206,6 +206,8 @@ module Dependabot
206
206
  end
207
207
 
208
208
  # Fetches files and tracks their directories for BUILD file resolution.
209
+ # Directories are tracked even if the referenced file doesn't exist yet,
210
+ # as Bazel requires BUILD files to recognize directories as valid packages.
209
211
  sig do
210
212
  params(
211
213
  paths: T::Array[String],
@@ -215,12 +217,12 @@ module Dependabot
215
217
  def fetch_paths_and_track_directories(paths, directories)
216
218
  files = T.let([], T::Array[DependencyFile])
217
219
  paths.each do |path|
218
- fetched_file = fetch_file_if_present(path)
219
- next unless fetched_file
220
-
221
- files << fetched_file
220
+ # Track the directory regardless of whether the file exists
222
221
  dir = File.dirname(path)
223
222
  directories.add(dir) unless dir == "."
223
+
224
+ fetched_file = fetch_file_if_present(path)
225
+ files << fetched_file if fetched_file
224
226
  end
225
227
  files
226
228
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-bazel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.358.0
4
+ version: 0.359.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.358.0
18
+ version: 0.359.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.358.0
25
+ version: 0.359.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -269,7 +269,7 @@ licenses:
269
269
  - MIT
270
270
  metadata:
271
271
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
272
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.358.0
272
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.359.0
273
273
  rdoc_options: []
274
274
  require_paths:
275
275
  - lib