Move snippets package back into flutter repo (#147690)

## Description

This moves the snippets package back into the Flutter repo so that API documentation generation can happen without the use of `dart pub global run` because `pub run` doesn't handle concurrency well.

The change modifies the dartdoc building process to include building an executable from the snippets tool and installing that in the cache directory for use during docs generation.

The snippets tool will reside in dev/snippets, where it originally resided before being moved to https://github.com/flutter/assets-for-api-docs.

The snippets code itself is unchanged from the code that is in https://github.com/flutter/assets-for-api-docs/packages/snippets.

## Related Issues
 - https://github.com/flutter/flutter/issues/144408
 - https://github.com/flutter/flutter/issues/147609
 - https://github.com/flutter/flutter/pull/147645

## Tests
 - Added snippets tests to the overall testing build.
This commit is contained in:
Greg Spencer
2024-05-02 23:09:03 -07:00
committed by GitHub
parent 4006d1bd7b
commit 183bc15816
22 changed files with 4757 additions and 11 deletions

View File

@@ -0,0 +1,33 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:convert';
import 'dart:io';
import 'package:process/process.dart';
class FakeProcessManager extends LocalProcessManager {
FakeProcessManager(
{this.stdout = '', this.stderr = '', this.exitCode = 0, this.pid = 1});
int runs = 0;
String stdout;
String stderr;
int exitCode;
int pid;
@override
ProcessResult runSync(
List<Object> command, {
String? workingDirectory,
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
Encoding? stdoutEncoding = systemEncoding,
Encoding? stderrEncoding = systemEncoding,
}) {
runs++;
return ProcessResult(pid, exitCode, stdout, stderr);
}
}