writeSharedDocBaseline function

void writeSharedDocBaseline(
  1. File file,
  2. Set<String> lines
)

Writes lines as the baseline, sorted, with a header explaining the file.

Sorted so a diff shows what changed rather than where it moved.

Implementation

void writeSharedDocBaseline(File file, Set<String> lines) {
  final sorted = lines.toList()..sort();
  file.writeAsStringSync(
    '# Doc lines stated in BOTH spec-tree surfaces — the reviewer\'s and the\n'
    '# editor\'s. Generated; see `lib/src/spec_tree_duplication.dart` for what\n'
    '# it is for and why it is a ratchet.\n'
    '#\n'
    '# The set may SHRINK and never GROW. A new line here is a new forked\n'
    '# explanation: move the rule to `tom_som_dart_runtime` and have both trees\n'
    '# cite it. When it shrinks, re-record this file in the same commit.\n'
    '#\n'
    '# Regenerate: dart run bin/check_spec_tree_duplication.dart --record\n'
    '\n'
    '${sorted.join('\n')}\n',
  );
}