@@ -1854,9 +1854,7 @@ class _Progress {
1854
1854
void update ({bool flush = false }) {
1855
1855
if (_lastUpdate == null || _lastUpdate! .elapsedMilliseconds >= millisecondsBetweenUpdates || flush) {
1856
1856
_lastUpdate ?? = Stopwatch ();
1857
- if (quiet) {
1858
- system.stderr.write ('.' );
1859
- } else {
1857
+ if (! quiet) {
1860
1858
final String line = toString ();
1861
1859
system.stderr.write ('\r $line ' );
1862
1860
if (_lastLength > line.length) {
@@ -1881,20 +1879,22 @@ class _Progress {
1881
1879
}
1882
1880
}
1883
1881
1884
- final RegExp _signaturePattern = RegExp (r'^Signature: (\w+)$' , expectNoMatch: true );
1882
+ final RegExp _signaturePattern = RegExp (r'^Signature: (\w+)$' , multiLine : true , expectNoMatch: true );
1885
1883
1886
1884
/// Reads the signature from a golden file.
1887
1885
String ? _readSignature (String goldenPath) {
1888
1886
try {
1889
1887
final system.File goldenFile = system.File (goldenPath);
1890
1888
if (! goldenFile.existsSync ()) {
1889
+ system.stderr.writeln (' Could not find signature file ($goldenPath ).' );
1891
1890
return null ;
1892
1891
}
1893
1892
final String goldenSignature = goldenFile.readAsStringSync ();
1894
1893
final Match ? goldenMatch = _signaturePattern.matchAsPrefix (goldenSignature);
1895
1894
if (goldenMatch != null ) {
1896
1895
return goldenMatch.group (1 );
1897
1896
}
1897
+ system.stderr.writeln (' Signature file ($goldenPath ) did not match expected pattern.' );
1898
1898
} on system.FileSystemException {
1899
1899
system.stderr.writeln (' Failed to read signature file ($goldenPath ).' );
1900
1900
return null ;
@@ -1913,7 +1913,6 @@ void _writeSignature(String signature, system.IOSink sink) {
1913
1913
//
1914
1914
// Returns true if changes are detected.
1915
1915
Future <bool > _computeLicenseToolChanges (_RepositoryDirectory root, { required String goldenSignaturePath, required String outputSignaturePath }) async {
1916
- system.stderr.writeln ('Computing signature for license tool' );
1917
1916
final fs.Directory flutterNode = findChildDirectory (root.ioDirectory, 'flutter' )! ;
1918
1917
final fs.Directory toolsNode = findChildDirectory (flutterNode, 'tools' )! ;
1919
1918
final fs.Directory licenseNode = findChildDirectory (toolsNode, 'licenses' )! ;
@@ -1933,23 +1932,27 @@ Future<bool> _computeLicenseToolChanges(_RepositoryDirectory root, { required St
1933
1932
Future <void > _collectLicensesForComponent (_RepositoryDirectory componentRoot, {
1934
1933
required String inputGoldenPath,
1935
1934
String ? outputGoldenPath,
1936
- bool ? writeSignature,
1935
+ required bool writeSignature,
1937
1936
required bool force,
1938
1937
required bool quiet,
1939
1938
}) async {
1940
- // Check whether the golden file matches the signature of the current contents of this directory.
1941
- final String ? goldenSignature = _readSignature (inputGoldenPath);
1942
1939
final String signature = await componentRoot.signature;
1943
- if (! force && goldenSignature == signature) {
1944
- system.stderr.writeln (' Skipping this component - no change in signature' );
1945
- return ;
1940
+ if (writeSignature) {
1941
+ // Check whether the golden file matches the signature of the current contents of this directory.
1942
+ // (We only do this for components where we write the signature, since if there's no signature,
1943
+ // there's no point trying to read it...)
1944
+ final String ? goldenSignature = _readSignature (inputGoldenPath);
1945
+ if (! force && goldenSignature == signature) {
1946
+ system.stderr.writeln (' Skipping this component - no change in signature' );
1947
+ return ;
1948
+ }
1946
1949
}
1947
1950
1948
1951
final _Progress progress = _Progress (componentRoot.fileCount, quiet: quiet);
1949
1952
1950
1953
final system.File outFile = system.File (outputGoldenPath! );
1951
1954
final system.IOSink sink = outFile.openWrite ();
1952
- if (writeSignature! ) {
1955
+ if (writeSignature) {
1953
1956
_writeSignature (signature, sink);
1954
1957
}
1955
1958
0 commit comments