async function getClosureDep(deps, args) {
  // First, try to identify Closure's base.js among the input files. This will
  // help us get the path to Closure.
  // We only consider base.js dependencies that were specified in the command
  // line as input files; in other words, we exclude dependencies that come from
  // dependency (deps.js) files. The reason for this is two-fold:
  // (1) If we find base.js via a dependency file, it may not help us determine
  //     the path to Closure Library, For example, Closure Library's own deps.js
  //     file only lists the relative path from Closure Library to base.js,
  //     which is always "base.js".
  // (2) We aren't guaranteed to be able to read a file that is only referenced
  //     in a dependency file.
  let baseJsInputDependency = null;
  const depsCalledBaseJs = deps.filter(
      d => !d.isParsedFromDepsFile() && d.path.endsWith(`${path.sep}base.js`));
  for (const dep of depsCalledBaseJs) {
    const contents = await fs.readFile(dep.path, 'utf8');
    // We assume that the string '@provideGoog' exists in the file iff the file
    // is Closure's base.js.
    if (contents.indexOf('@provideGoog') !== -1) {
      baseJsInputDependency = dep;
      break;
    }
  }

  // It's OK if we didn't find base.js among the input files, as long as
  // --closure-path is specified.
  // Here, ensure that the path to Closure Library is specified as *exactly* one
  // of (1) the --closure-path argument, or (2) the path to the input base.js.
  if (!args.closurePath && !baseJsInputDependency) {
    throw new Error(
        'Could not find path to Closure. Closure\'s base.js either needs to ' +
        'be included or --closure-path provided.');
  } else if (args.closurePath && baseJsInputDependency) {
    throw new Error(
        'Both --closure-path and Closure\'s base.js file should not be ' +
        'inputs.');
  }

  // Now that we know the path to Closure Library, we can return the dependency
  // for base.js.
  let closureDep = null;
  if (args.closurePath) {
    // Having --closure-path argument set implies that base.js is not among the
    // input files, as we validated earlier in this function.
    // Therefore, either base.js is included via a dependency file (in which
    // case, simply set the path to closure in the corresponding Dependency
    // object), or it's not included as a dependency at all (in which case, add
    // it).
    const baseJsFromDepsFile = deps.find(
        d => d.isParsedFromDepsFile() && d.closureRelativePath === 'base.js');
    if (baseJsFromDepsFile) {
      baseJsFromDepsFile.setClosurePath(args.closurePath);
      closureDep = baseJsFromDepsFile;
    } else {
      closureDep = new depGraph.Dependency(
          depGraph.DependencyType.SCRIPT,
          path.join(args.closurePath, 'base.js'), [], []);
      deps.push(closureDep);
    }
  } else {
    // We found base.js among the input files earlier, so simply return that.
    closureDep = baseJsInputDependency;
  }

  return closureDep;
}
Finds or creates a dependency for Closure's base.js. This also determines the
path to Closure Library.

@param {!Array<!depGraph.Dependency>} deps
@param {!Arguments} args
@return {!depGraph.Dependency}