autobuild 1.23.1 → 1.25.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: cb4af40b45b8a0e1185e81a0cf63a4cf75728d1360290b0dfb3bb194bd409361
4
- data.tar.gz: 1e2a3d4f44a08126ca0ca39fe00e15c31430da623f83852827159cabd880b2e2
3
+ metadata.gz: 0f19fbfaac6c8a45aa67dc3f494e646620b109400dc52576d799e833c97f2073
4
+ data.tar.gz: 405c2943784b8247d9b14bf943ae336cd480bdee5faf1eb720cdddabed5934ee
5
5
  SHA512:
6
- metadata.gz: 6b363c75454df74373af48e1fa994a1a92471f076184bbffa85867f6f6c346d61aac1469621c56f331646695c817c445bb1b1198aee063d79ad95a9da25437d5
7
- data.tar.gz: 84751817159e35967dcaf0b7d32e13b46e9c660ec6c649b8eac0cce97a33003f50fef2a05502cbd667025143b763cc69688f0a96805b9f2764848cbc4c15785b
6
+ metadata.gz: 955461e9afe4750ba82115a26fd93133b408e257451dd33d86b6469b5c0f283a2e54c4d6e614153788ecefddb0286a8f70cdbfd326c5f294ffc0692dd55584db
7
+ data.tar.gz: 9237fd0300c8edf42905c03687fdc407030f204e745ac24aad66659909046759554517477735bb4b567874df13f2287819de86f0355d450b99fafcc0b0fc9182
@@ -8,7 +8,9 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: ["2.7", "2.6", "2.5"]
11
+ ruby-version:
12
+ - "3.0"
13
+ - "2.7"
12
14
 
13
15
  steps:
14
16
  - uses: actions/checkout@v2
@@ -19,7 +21,9 @@ jobs:
19
21
  uses: ruby/setup-ruby@v1
20
22
  with:
21
23
  ruby-version: ${{ matrix.ruby-version }}
24
+ - name: Remove vscode gems
25
+ run: bundle config set --local without vscode
22
26
  - name: Install dependencies
23
27
  run: bundle install
24
28
  - name: Run rubocop
25
- run: bundle exec rubocop
29
+ run: bundle exec rubocop
@@ -8,7 +8,10 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: ["2.7", "2.6", "2.5"]
11
+ ruby-version:
12
+ - "3.0"
13
+ - "2.7"
14
+ - "2.5"
12
15
 
13
16
  steps:
14
17
  - uses: actions/checkout@v2
@@ -19,8 +22,12 @@ jobs:
19
22
  uses: ruby/setup-ruby@v1
20
23
  with:
21
24
  ruby-version: ${{ matrix.ruby-version }}
25
+ - name: Remove vscode gems
26
+ run: bundle config set --local without vscode
22
27
  - name: Install dependencies
23
28
  run: bundle install
29
+ - name: Enable file transport in git
30
+ run: git config --global protocol.file.allow always
24
31
  - name: Run tests
25
32
  run: bundle exec rake test
26
33
  env:
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  inherit_gem:
2
4
  rubocop-rock: defaults.yml
3
5
 
@@ -111,4 +113,4 @@ Style/GlobalStdStream:
111
113
  Enabled: false
112
114
 
113
115
  Style/OptionalBooleanParameter:
114
- Enabled: false
116
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,14 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2024-07-10 18:16:42 UTC using RuboCop version 1.28.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RubyVersionGlobalsUsage:
13
+ Exclude:
14
+ - 'autobuild.gemspec'
data/Gemfile CHANGED
@@ -2,12 +2,17 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ group :lint do
6
+ gem 'parallel', '1.24.0'
7
+ gem 'rubocop', '1.28.2'
8
+ gem 'rubocop-ast', '1.17.0'
9
+ gem 'rubocop-rock'
10
+ end
11
+
5
12
  group :vscode do
6
13
  gem 'debase', '>= 0.2.2.beta10'
7
14
  gem 'pry'
8
15
  gem 'pry-byebug'
9
- gem 'rubocop', '>= 0.6.0'
10
- gem 'rubocop-rock'
11
16
  gem 'ruby-debug-ide', '>= 0.6.0'
12
17
  gem 'solargraph'
13
18
  end
data/autobuild.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  .reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
 
26
26
  s.add_runtime_dependency "concurrent-ruby", "~> 1.1"
27
+ s.add_runtime_dependency "net-smtp"
27
28
  s.add_runtime_dependency "pastel", "~> 0.7.0"
28
29
  s.add_runtime_dependency "rake", "~> 13.0"
29
30
  s.add_runtime_dependency 'tty-cursor', '~> 0.7.0'
@@ -31,8 +32,9 @@ Gem::Specification.new do |s|
31
32
  s.add_runtime_dependency 'tty-screen', '~> 0.8.0'
32
33
  s.add_runtime_dependency "utilrb", "~> 3.0", ">= 3.0"
33
34
  s.add_development_dependency "fakefs"
34
- s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
35
+ s.add_development_dependency "flexmock", ">= 2.4.0"
35
36
  s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
36
37
  s.add_development_dependency "simplecov"
37
38
  s.add_development_dependency "timecop"
39
+ s.add_development_dependency "webrick"
38
40
  end
@@ -10,7 +10,26 @@ module Autobuild
10
10
  # Exception raised when a network access is needed while only_local is true
11
11
  class NetworkAccessNeeded < RuntimeError; end
12
12
 
13
+ @default_fingerprint_mode = "commit"
14
+
13
15
  class << self
16
+ # Sets the single_branch option globally for all Git importers
17
+ # This can can be overriden in the oporter options
18
+ attr_writer :single_branch
19
+
20
+ # Whether single_branch is enabled globally
21
+ def single_branch?
22
+ !!@single_branch
23
+ end
24
+
25
+ # Sets shallow clones globally (applies to submodules as well)
26
+ attr_writer :shallow
27
+
28
+ # Whether shallow clones is enabled globally
29
+ def shallow?
30
+ !!@shallow
31
+ end
32
+
14
33
  # Sets the default alternates path used by all Git importers
15
34
  #
16
35
  # Setting it explicitly overrides any value we get from the
@@ -44,6 +63,18 @@ module Autobuild
44
63
  Array.new
45
64
  end
46
65
  end
66
+
67
+ # What git repository fingerprinting uses as reference
68
+ #
69
+ # Can either be
70
+ # - "commit" (the default). Use the commit hash of HEAD
71
+ # - "tree". Use the tree hash. This will return the same fingerprint
72
+ # for new commits that do not change the source code. However, it
73
+ # will fail to detect changes to the working copy that are due
74
+ # to git checkout filters.
75
+ #
76
+ # @return [String]
77
+ attr_accessor :default_fingerprint_mode
47
78
  end
48
79
 
49
80
  def self.default_config
@@ -142,17 +173,22 @@ module Autobuild
142
173
  Autobuild.warn " branch: 'master'"
143
174
  end
144
175
 
145
- gitopts, common = Kernel.filter_options options,
146
- push_to: nil,
147
- branch: nil,
148
- local_branch: nil,
149
- remote_branch: nil,
150
- tag: nil,
151
- commit: nil,
152
- repository_id: nil,
153
- source_id: nil,
154
- with_submodules: false,
155
- single_branch: false
176
+ gitopts, common = Kernel.filter_options(
177
+ options,
178
+ push_to: nil,
179
+ branch: nil,
180
+ local_branch: nil,
181
+ remote_branch: nil,
182
+ tag: nil,
183
+ commit: nil,
184
+ repository_id: nil,
185
+ source_id: nil,
186
+ with_submodules: false,
187
+ fingerprint_mode: Git.default_fingerprint_mode,
188
+ single_branch: Git.single_branch?,
189
+ shallow: Git.shallow?
190
+ )
191
+
156
192
  if gitopts[:branch] && branch
157
193
  raise ConfigException, "git branch specified with both the option hash "\
158
194
  "and the explicit parameter"
@@ -162,6 +198,7 @@ module Autobuild
162
198
  super(common)
163
199
 
164
200
  @single_branch = gitopts[:single_branch]
201
+ @shallow = gitopts[:shallow]
165
202
  @with_submodules = gitopts.delete(:with_submodules)
166
203
  @alternates =
167
204
  if @with_submodules
@@ -172,12 +209,13 @@ module Autobuild
172
209
 
173
210
  @remote_name = 'autobuild'
174
211
  @push_to = nil
212
+ @fingerprint_mode = gitopts[:fingerprint_mode]
175
213
  relocate(repository, gitopts)
176
214
  @additional_remotes = Array.new
177
215
  end
178
216
 
179
217
  def vcs_fingerprint(package)
180
- rev_parse(package, 'HEAD')
218
+ rev_parse(package, "HEAD", @fingerprint_mode)
181
219
  end
182
220
 
183
221
  # The name of the remote that should be set up by the importer
@@ -286,9 +324,17 @@ module Autobuild
286
324
  @single_branch
287
325
  end
288
326
 
327
+ # Whether clones should be shallow
328
+ def shallow?
329
+ @shallow
330
+ end
331
+
289
332
  # Set the {#single_branch?} predicate
290
333
  attr_writer :single_branch
291
334
 
335
+ # Set the {#shallow?} predicate
336
+ attr_writer :shallow
337
+
292
338
  # @api private
293
339
  #
294
340
  # Verifies that the package's {Package#importdir} points to a git
@@ -1255,19 +1301,60 @@ module Autobuild
1255
1301
  @lfs_installed = status.success?
1256
1302
  end
1257
1303
 
1304
+ def validate_shallow(package)
1305
+ return false unless shallow?
1306
+
1307
+ if commit
1308
+ Autoproj.warn "#{package.name}: "\
1309
+ "Cannot pin a commit while doing a shallow clone"
1310
+ return false
1311
+ end
1312
+ if tag && !single_branch?
1313
+ Autoproj.warn "#{package.name}: "\
1314
+ "Cannot pin a tag while doing a shallow clone"
1315
+ return false
1316
+ end
1317
+ if @remote_branch
1318
+ Autoproj.warn "#{package.name}: "\
1319
+ "Cannot use remote_branch while doing a shallow clone"
1320
+ return false
1321
+ end
1322
+ true
1323
+ end
1324
+
1258
1325
  def checkout(package, _options = Hash.new)
1326
+ shallow_clone = validate_shallow(package)
1327
+
1259
1328
  base_dir = File.expand_path('..', package.importdir)
1260
1329
  FileUtils.mkdir_p(base_dir) unless File.directory?(base_dir)
1261
1330
 
1262
1331
  clone_options = Array.new
1263
- clone_options << '--recurse-submodules' if with_submodules?
1332
+ if with_submodules?
1333
+ clone_options << '--recurse-submodules'
1334
+ clone_options << '--shallow-submodules' if shallow_clone
1335
+ end
1336
+
1337
+ clone_options << '--depth' << '1' if shallow_clone
1338
+
1264
1339
  if single_branch?
1265
- if remote_branch.start_with?("refs/")
1266
- raise ArgumentError, "you cannot provide a full ref for"\
1267
- " the remote branch while cloning a single branch"
1340
+ if tag
1341
+ if tag.start_with?("refs/")
1342
+ raise ArgumentError, "you cannot provide a full ref for"\
1343
+ " the tag while cloning a single branch"
1344
+ end
1345
+ clone_options << "--branch=#{tag}"
1346
+ elsif remote_branch
1347
+ if remote_branch.start_with?("refs/")
1348
+ raise ArgumentError, "you cannot provide a full ref for"\
1349
+ " the remote branch while cloning a single branch"
1350
+ end
1351
+ clone_options << "--branch=#{remote_branch}"
1268
1352
  end
1269
- clone_options << "--branch=#{remote_branch}" << "--single-branch"
1353
+ clone_options << "--single-branch"
1354
+ elsif shallow_clone
1355
+ clone_options << "--no-single-branch"
1270
1356
  end
1357
+
1271
1358
  each_alternate_path(package) do |path|
1272
1359
  clone_options << '--reference' << path
1273
1360
  end
@@ -1278,7 +1365,7 @@ module Autobuild
1278
1365
  Autobuild.tool('git'), 'clone', '-o', remote_name, *clone_options,
1279
1366
  repository, package.importdir, retry: true)
1280
1367
 
1281
- update_remotes_configuration(package)
1368
+ update_remotes_configuration(package, only_local: false)
1282
1369
  update(package, only_local: !remote_branch.start_with?("refs/"),
1283
1370
  reset: :force)
1284
1371
  if with_submodules?
@@ -540,10 +540,10 @@ module Autobuild
540
540
  File.readlines(patches_file).map do |line|
541
541
  line = line.rstrip
542
542
  if line =~ /^(.*)\s+(\d+)$/
543
- path = File.expand_path($1, package.srcdir)
543
+ path = File.expand_path($1, package.importdir)
544
544
  level = Integer($2)
545
545
  else
546
- path = File.expand_path(line, package.srcdir)
546
+ path = File.expand_path(line, package.importdir)
547
547
  level = 0
548
548
  end
549
549
  [path, level, File.read(path)]
@@ -618,7 +618,7 @@ module Autobuild
618
618
  File.open(patchlist(package), 'w') do |f|
619
619
  patch_state = cur_patches.map do |path, level|
620
620
  path = Pathname.new(path).
621
- relative_path_from(Pathname.new(package.srcdir)).to_s
621
+ relative_path_from(Pathname.new(package.importdir)).to_s
622
622
  "#{path} #{level}"
623
623
  end
624
624
  f.write(patch_state.join("\n"))
@@ -39,6 +39,11 @@ module Autobuild
39
39
 
40
40
  attr_reader :prefix_path, :module_path
41
41
 
42
+ # Arguments that will be passed to the 'make' test target
43
+ def test_args
44
+ @test_args ||= ["-V"]
45
+ end
46
+
42
47
  # Whether files that are not within CMake's install manifest but are
43
48
  # present in the prefix should be deleted. Note that the contents of
44
49
  # {#log_dir} are unaffected.
@@ -73,6 +78,9 @@ module Autobuild
73
78
  self.class.defines.merge(additional_defines).merge(defines)
74
79
  end
75
80
 
81
+ # Arguments to be passed to the 'make' test target
82
+ attr_reader :test_args
83
+
76
84
  # If true, always run cmake before make during the build
77
85
  attr_accessor :always_reconfigure
78
86
  # If true, we always remove the CMake cache before reconfiguring.
@@ -115,6 +123,7 @@ module Autobuild
115
123
  def initialize(options)
116
124
  @defines = Hash.new
117
125
  super
126
+ @test_args = self.class.test_args.dup
118
127
  @delete_obsolete_files_in_prefix = self.class.
119
128
  delete_obsolete_files_in_prefix?
120
129
  end
@@ -269,13 +278,23 @@ module Autobuild
269
278
  run('doc', Autobuild.tool(:doxygen), doxyfile)
270
279
  end
271
280
 
272
- def common_utility_handling(utility, target, *args, start_msg, done_msg)
281
+ def common_utility_handling( # rubocop:disable Metrics/ParameterLists
282
+ utility,
283
+ target,
284
+ start_msg,
285
+ done_msg,
286
+ post_process: nil,
287
+ args: []
288
+ )
273
289
  utility.source_ref_dir = builddir
274
290
  utility.task do
275
291
  progress_start start_msg, :done_message => done_msg do
276
292
  if internal_doxygen_mode?
277
293
  run_doxygen
278
294
  else
295
+ unless args.empty?
296
+ args = ["ARGS=#{args.map { |a| %("#{a}") }.join(' ')}"]
297
+ end
279
298
  run(utility.name,
280
299
  Autobuild.tool(:make),
281
300
  "-j#{parallel_build_level}",
@@ -284,6 +303,24 @@ module Autobuild
284
303
  end
285
304
  yield if block_given?
286
305
  end
306
+
307
+ post_process&.call
308
+ end
309
+ end
310
+
311
+ def with_coverage(&block)
312
+ @with_coverage ||= block
313
+ end
314
+
315
+ def coverage_block
316
+ proc do
317
+ next unless test_utility.coverage_enabled?
318
+ next unless @with_coverage
319
+
320
+ progress_start "generating coverage report for %s",
321
+ done_message: "generated coverage report for %s" do
322
+ @with_coverage.call
323
+ end
287
324
  end
288
325
  end
289
326
 
@@ -297,9 +334,11 @@ module Autobuild
297
334
 
298
335
  def with_tests(target = 'test', &block)
299
336
  common_utility_handling(
300
- test_utility, target, "ARGS=-V",
337
+ test_utility, target,
301
338
  "running tests for %s",
302
- "successfully ran tests for %s", &block)
339
+ "successfully ran tests for %s",
340
+ args: test_args,
341
+ post_process: coverage_block, &block)
303
342
  end
304
343
 
305
344
  CMAKE_EQVS = {
@@ -277,7 +277,7 @@ module Autobuild
277
277
  until messages.empty?
278
278
  msg = messages.shift.strip
279
279
  margin = messages.empty? ? 1 : 2
280
- if lines.last.size + margin + msg.size > width
280
+ if lines.last.size + margin + msg.size + 1 > width
281
281
  lines.last << ","
282
282
  lines << +""
283
283
  lines.last << indent << indent << msg
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.23.1".freeze unless defined? Autobuild::VERSION
2
+ VERSION = "1.25.0".freeze unless defined? Autobuild::VERSION
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.1
4
+ version: 1.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2025-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-smtp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pastel
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -132,22 +146,16 @@ dependencies:
132
146
  name: flexmock
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '2.0'
138
149
  - - ">="
139
150
  - !ruby/object:Gem::Version
140
- version: 2.0.0
151
+ version: 2.4.0
141
152
  type: :development
142
153
  prerelease: false
143
154
  version_requirements: !ruby/object:Gem::Requirement
144
155
  requirements:
145
- - - "~>"
146
- - !ruby/object:Gem::Version
147
- version: '2.0'
148
156
  - - ">="
149
157
  - !ruby/object:Gem::Version
150
- version: 2.0.0
158
+ version: 2.4.0
151
159
  - !ruby/object:Gem::Dependency
152
160
  name: minitest
153
161
  requirement: !ruby/object:Gem::Requirement
@@ -196,6 +204,20 @@ dependencies:
196
204
  - - ">="
197
205
  - !ruby/object:Gem::Version
198
206
  version: '0'
207
+ - !ruby/object:Gem::Dependency
208
+ name: webrick
209
+ requirement: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
199
221
  description: Collection of classes to handle build systems (CMake, autotools, ...)
200
222
  and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
201
223
  to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)
@@ -210,6 +232,7 @@ files:
210
232
  - ".github/workflows/test.yml"
211
233
  - ".gitignore"
212
234
  - ".rubocop.yml"
235
+ - ".rubocop_todo.yml"
213
236
  - Changes.txt
214
237
  - Gemfile
215
238
  - Manifest.txt