Skip to content

Remove CCompiler.{envScript,envScriptArgs} and replace by other means #1606

Closed
@mkustermann

Description

@mkustermann

Currently we have the following class:

abstract final class CCompilerConfig {
  /// Path to a C compiler.
  Uri? get compiler;

  /// Path to a native linker.
  Uri? get linker;

  /// Path to a native archiver.
  Uri? get archiver;

  /// Path to script that sets environment variables for [compiler], [linker],
  /// and [archiver].
  Uri? get envScript;

  /// Arguments for [envScript].
  List<String>? get envScriptArgs;

  factory CCompilerConfig({
    Uri? archiver,
    Uri? compiler,
    Uri? linker,
    Uri? envScript,
    List<String>? envScriptArgs,
  }) = CCompilerConfigImpl;
}

It is very weird to have envScript and envScriptArgs here. It seems that windows-specific details are being exposed by this API.

We should consider removing these two fields and instead do that differently:

  • Either add a class CCompilerConfig { final Map<String, String> environmentVariables; } that encapsulate the additional environment variables needed when invoking CCompilerConfig.{compiler,linker,archiver}
  • Or have no replacement: The caller can figure out the additional environment, make wrapper-shell scripts for compiler/linker/archiver. Those wrapper shell scripts can set the needed environment and call the actual target compiler/linker/archiver

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions