Skip to content

Missing --platform CLI argument #1240

@diesieben07

Description

@diesieben07

In #1153 rebuild was given the ability to override the platform. Of course this only works if there are prebuilt binaries available for the platform you're overriding so that they can be downloaded (instead of built).
As far as I can see an error message was already added in #1153 for when cross-compilation is attempted (i.e. there are no prebuilt binaries found for the overridden platform).

However, the CLI was not updated to allow passing the --platform argument, it does not pass in the platform argument to rebuild, so rebuild always defaults to process.plattform:

rebuild/src/cli.ts

Lines 131 to 148 in 4206834

const rebuilder = rebuild({
buildPath: rootDirectory,
electronVersion: electronModuleVersion,
arch: (argv.a as string) || process.arch,
extraModules: argv.w ? (argv.w as string).split(',') : [],
onlyModules: argv.o ? (argv.o as string).split(',') : null,
force: argv.f as boolean,
headerURL: argv.d as string,
types: argv.t ? (argv.t as string).split(',') as ModuleType[] : ['prod', 'optional'],
mode: argv.p ? 'parallel' : (argv.s ? 'sequential' : undefined),
debug: argv.debug,
prebuildTagPrefix: (argv.prebuildTagPrefix as string) || 'v',
forceABI: argv.forceAbi as number,
useElectronClang: !!argv.useElectronClang,
disablePreGypCopy: !!argv.disablePreGypCopy,
projectRootPath,
buildFromSource: !!argv.buildFromSource,
});

Is this intentional? It seems strange to expose this functionality in the API but not via the CLI. For now I have written my own small wrapper script which calls rebuild directly and allows me to override platform. I would be willing to make a PR to add --platform to the CLI args, if that's acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions