combineFiles method

  1. @override
List<TargetFile> combineFiles()
override

returns all targetFileConfigs and fileConfigs

Implementation

@override
List<TargetFile> combineFiles() {
  final targetFileConfigs = this.targetFileConfigs();

  for (final file in {...fileConfigs.keys}) {
    if (targetFileConfigs.contains(file)) {
      continue;
    }

    di<Logger>()
      ..info('')
      ..warn(
        'The configured file "$file" does not exist',
      );

    fileConfigs.remove(file);
  }

  final result = <String, FileConfig?>{}
    ..addAll({for (final file in targetFileConfigs) file: null})
    ..addAll(fileConfigs);

  final targetFiles = <TargetFile>[];

  for (final filePath in result.keys) {
    final path = p.normalize(filePath);

    if (shouldExcludePath(path, excludePaths)) {
      continue;
    }

    final target = TargetFileImpl(
      result[path],
      sourcePath: p.join(this.path, path),
      targetDir: targetDir,
      pathWithoutSourceDir: path,
    );

    targetFiles.add(target);
  }

  return targetFiles;
}