-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build_daemon: drop pkg:uuid dev_dep (#3722)
Just inline a simple version from somewhere else
- Loading branch information
Showing
4 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ dev_dependencies: | |
mockito: ^5.0.0 | ||
test: ^1.25.5 | ||
test_descriptor: ^2.0.0 | ||
uuid: ^3.0.0 | ||
|
||
topics: | ||
- build-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// Copied from https://github.com/dart-lang/sdk/blob/9d28b1eb9f9cfb7331fef25238be5cba593e37ac/pkg/frontend_server/lib/src/uuid.dart | ||
|
||
import 'dart:math' show Random; | ||
|
||
/// A UUID generator. | ||
/// | ||
/// The generated values are 128 bit numbers encoded in a specific string | ||
/// format. | ||
/// | ||
/// Generate a version 4 (random) uuid. This is a uuid scheme that only uses | ||
/// random numbers as the source of the generated uuid. | ||
// TODO: replace with a MUCH more simple, random string that matches | ||
// the use case. | ||
String generateV4UUID() { | ||
var special = 8 + _random.nextInt(4); | ||
|
||
return '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}-' | ||
'${_bitsDigits(16, 4)}-' | ||
'4${_bitsDigits(12, 3)}-' | ||
'${_printDigits(special, 1)}${_bitsDigits(12, 3)}-' | ||
'${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}'; | ||
} | ||
|
||
final Random _random = Random(); | ||
|
||
String _bitsDigits(int bitCount, int digitCount) => | ||
_printDigits(_generateBits(bitCount), digitCount); | ||
|
||
int _generateBits(int bitCount) => _random.nextInt(1 << bitCount); | ||
|
||
String _printDigits(int value, int count) => | ||
value.toRadixString(16).padLeft(count, '0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters