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 uiPath = addUI().parent.path;
    configCopy.add(name: 'ui', rootPath: uiPath);

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

  if (addJsPackageDep) {
    var jsPath = addJs().parent.path;
    configCopy.add(name: 'js', rootPath: jsPath);
  }

  if (addKernelPackageDep) {
    var kernelPath = addKernel().parent.path;
    configCopy.add(name: 'kernel', rootPath: kernelPath);
  }

  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);
}