buildFlutterTestWorkerEnvironment function

Map<String, String> buildFlutterTestWorkerEnvironment({
  1. String? suiteEncryptionKey,
  2. String? artifactRoot,
  3. String artifactDisplayRoot = 'build/ensemble_test_runner',
  4. int? workerIndex,
  5. String? reportMode,
  6. int? timeoutSeconds,
  7. required List<String> shardPaths,
  8. required List<String> shardIds,
  9. required String? reportFile,
  10. required String? progressFile,
  11. required String? appLogPath,
  12. required String? appLogDisplayPath,
  13. required Map<String, dynamic>? serviceOverrides,
  14. required List<String> arguments,
})

Implementation

Map<String, String> buildFlutterTestWorkerEnvironment({
  String? suiteEncryptionKey,
  String? artifactRoot,
  String artifactDisplayRoot = 'build/ensemble_test_runner',
  int? workerIndex,
  String? reportMode,
  int? timeoutSeconds,
  required List<String> shardPaths,
  required List<String> shardIds,
  required String? reportFile,
  required String? progressFile,
  required String? appLogPath,
  required String? appLogDisplayPath,
  required Map<String, dynamic>? serviceOverrides,
  required List<String> arguments,
}) {
  final planBatchFile = planBatchFileFromArguments(arguments);
  return {
    'ENSEMBLE_TEST_RUNNER_CONFIG': json.encode({
      if (suiteEncryptionKey != null)
        'ensembleTestEncryptionKey': suiteEncryptionKey,
      if (artifactRoot != null) 'ensembleTestArtifactRoot': artifactRoot,
      'ensembleTestArtifactDisplayRoot': artifactDisplayRoot,
      if (workerIndex != null) 'ensembleTestWorkerIndex': workerIndex,
      if (workerIndex != null)
        'ensembleTestWorkerSuffix': 'worker${workerIndex + 1}',
      'ensembleTestShardPath': shardPaths,
      'ensembleTestShardId': shardIds,
      if (reportFile != null) 'ensembleTestReportFile': reportFile,
      if (reportMode != null) 'ensembleTestReport': reportMode,
      if (timeoutSeconds != null) 'ensembleTestTimeoutSeconds': timeoutSeconds,
      if (progressFile != null) 'ensembleTestProgressFile': progressFile,
      if (appLogPath != null) 'ensembleTestAppLogFile': appLogPath,
      if (appLogDisplayPath != null)
        'ensembleTestAppLogDisplayFile': appLogDisplayPath,
      if (serviceOverrides != null && serviceOverrides.isNotEmpty)
        'ensembleTestServiceOverrides': json.encode(serviceOverrides),
      for (final selection in const [
        'id',
        'feature',
        'profile',
        'tag',
        'path',
        'device',
      ])
        if (_optionValues(arguments, '--$selection').isNotEmpty)
          'ensembleTest${selection[0].toUpperCase()}${selection.substring(1)}':
              _optionValues(arguments, '--$selection'),
      if (_inputValues(arguments).isNotEmpty)
        'ensembleTestInputs': json.encode(_inputValues(arguments)),
      if (planBatchFile != null) 'ensembleTestPlanBatchFile': planBatchFile,
    }),
  };
}