Skip to content

[pigeon] Add option to ignore PigeonOptions in file when using the function runWithOptions #163159

@melvinotieno

Description

@melvinotieno

Use case

I own a library that uses pigeon library directly specifically the command runWithOptions. This library makes it possible to use pigeon with build_runner, therefore I make use of ScratchSpace. The problem is that, if an input file has PigeonOptions, the scratch space paths are overwritten with those defined in the input file. I would like if the function runWithOptions would have a flag to turn off the ability to overwrite with the PigeonOptions in the input file. This is because in my library, I already use those options in the input file to generate the paths to the scratch space

Proposal

I can see the solution to this being done in two different ways:

Proposal A

The merging of options could be moved to the run function and those options passed to runWithOptions

Proposal B

Have a flag in the function to prevent the merging of the options and the following code https://github.com/flutter/packages/blob/09888cbc304b152e69f8cd98261580765afb4b9f/packages/pigeon/lib/src/pigeon_lib.dart#L2682-L2685 can be put within that flag such that if true, then merging of the options is done

static Future<int> runWithOptions(
    PigeonOptions options, {
    List<GeneratorAdapter>? adapters,
    String? sdkPath,
    bool injectOverflowTypes = false,
    bool flagToMergeOptions = true,
  }) async {

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions