writeTestPackageConfig method

void writeTestPackageConfig(
  1. PackageConfigFileBuilder config
)
inherited

Writes a package_config.json file from config, and for packages that have been added via newPackage.

Implementation

void writeTestPackageConfig(PackageConfigFileBuilder config) {
  var configCopy = config.copy();

  configCopy.add(
    name: 'test',
    rootPath: testPackageRootPath,
    languageVersion: testPackageLanguageVersion,
  );

  if (addFixnumPackageDep) {
    var fixnumPath = addFixnum().parent.path;
    configCopy.add(name: 'fixnum', rootPath: fixnumPath);
  }

  if (addFlutterPackageDep) {
    var skyEnginePath = addSkyEngine(sdkPath: _sdkRoot.path).parent.path;
    configCopy.add(name: 'sky_engine', rootPath: skyEnginePath);

    var flutterPath = addFlutter().parent.path;
    configCopy.add(name: 'flutter', rootPath: flutterPath);
  }

  if (addMetaPackageDep) {
    var metaPath = addMeta().parent.path;
    configCopy.add(name: 'meta', rootPath: metaPath);
  }

  if (addTestReflectiveLoaderPackageDep) {
    var testReflectiveLoaderPath = addTestReflectiveLoader().parent.path;
    configCopy.add(
      name: 'test_reflective_loader',
      rootPath: testReflectiveLoaderPath,
    );
  }

  for (var packageName in _packagesToAdd) {
    var packagePath = convertPath('/package/$packageName');
    configCopy.add(name: packageName, rootPath: packagePath);
  }

  var path = '$testPackageRootPath/.dart_tool/package_config.json';
  writePackageConfig(path, configCopy);
}