Commit 769b584
Write lockfile external only (#3699)
## Description
Another attempt to improve
#3522
Current status/plan on the issue above was
- pre-commit hook that converts the `Cargo.lock` file into a
`Cargo.bazel.lock` file by removing internal deps
- use `crate.from_cargo` with the `Cargo.bazel.lock` file and
`skip_cargo_lockfile_overwrite = True`
- commit `MODULE.bazel.lock` which should have less merge conflicts
since the sha of `Cargo.bazel.lock` does not change that often
This works, but we need to make sure `Cargo.lock` is up to date. This
requires another step, so we replace a slow automated step (cargo
splicing) with an extra manual/non-bazel step (updating the `Cargo.lock`
file).
New idea to iterate
- use `crate.from_cargo` with the `Cargo.bazel.lock` file but instead of
using `skip_cargo_lockfile_overwrite = True`
- we let rules_rust do the cargo dependency resolution that is happening
as part of splicing
- instead of writing back the full content into the cargo lock file, we
only write back the third party (making the pre-commit hook obsolete).
For this, I introduced the
`strip_internal_dependencies_from_cargo_lockfile` flag
This would save us the pre-commit hook as well as the manual step to
update the `Cargo.lock` file. I already did a quick verification and
`remove_internal_dependencies_from_cargo_lockfile` achieves the same
results as the python implementation I listed in
#3522
## Open Points
This is an early draft to collect feedback. Once we aligned how exactly
we want to proceed, I would like to
- [ ] add/extend an integration test to have this tested end to end
- [ ] add and example to demonstrate how this should be used
---------
Co-authored-by: Daniel Wagner-Hall <[email protected]>1 parent c6b9399 commit 769b584
File tree
19 files changed
+7538
-2689
lines changed- crate_universe
- private
- src/cli
- examples/crate_universe
- remove_internal_deps
- num_printer
- src
- printer
- src
- rng
- src
19 files changed
+7538
-2689
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
562 | 563 | | |
563 | 564 | | |
564 | 565 | | |
| |||
575 | 576 | | |
576 | 577 | | |
577 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
578 | 584 | | |
579 | 585 | | |
580 | 586 | | |
| |||
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
| 693 | + | |
687 | 694 | | |
688 | 695 | | |
689 | 696 | | |
| |||
1169 | 1176 | | |
1170 | 1177 | | |
1171 | 1178 | | |
| 1179 | + | |
1172 | 1180 | | |
1173 | 1181 | | |
1174 | 1182 | | |
| |||
1210 | 1218 | | |
1211 | 1219 | | |
1212 | 1220 | | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1213 | 1231 | | |
1214 | 1232 | | |
1215 | 1233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
380 | 391 | | |
381 | 392 | | |
382 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| 444 | + | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
458 | 459 | | |
459 | 460 | | |
460 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
461 | 467 | | |
462 | 468 | | |
463 | 469 | | |
| |||
499 | 505 | | |
500 | 506 | | |
501 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
502 | 511 | | |
503 | 512 | | |
504 | 513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
| |||
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
225 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
229 | 242 | | |
230 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
231 | 258 | | |
232 | 259 | | |
233 | 260 | | |
| |||
293 | 320 | | |
294 | 321 | | |
295 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
348 | 384 | | |
349 | 385 | | |
350 | 386 | | |
| |||
0 commit comments