spotify / XCRemoteCache

Other
833 stars 52 forks source link

integrate command failed with multiple `--consumer-eligible-configurations` #241

Open jkmathew opened 1 month ago

jkmathew commented 1 month ago

My integration setup

Expected/desired behavior The xcprepare integrate should work with multiple --consumer-eligible-configurations.

Minimal reproduction of the problem with instructions

Run the integrate command with comma-separated consumer-eligible-configurations

Consumer Logs

Filtering the log data using "sender == "xcprepare""
Timestamp               Ty Process[PID:TID]
2024-08-14 17:24:49.475 E  xcprepare[59946:3ceea] XCRemoteCache cannot be initialized with a consumer mode. Error: statusError("status 64: Error: Unexpected argument \134'Release\134'\134nUsage: xc-prepare-main prepare [--configuration <configuration> ...] [--platform <platform> ...] [--xcode <xcode>] [--format <format>]", 64).

I ran this command,

XCRemoteCache/xcprepare integrate --input MyProj.xcodeproj --mode consumer --consumer-eligible-configurations "Debug,Release"

No matter what is the value of consumer-eligible-configurations if there is a comma, it fails. If I run separately it either runs without error or fails with noArtifactsToReuse depending on the availability of artefacts, Which is expected.

Environment

polac24 commented 4 weeks ago

Yes, that is a bug. The fix is easy: in XcodeProjIntegrate.swift we should prefix each configuration with --configuration, so something like:

let args = consumerEligibleConfigurations.flatMap {["--configuration", $0]} + consumerEligiblePlatforms.flatMap {["--platform", $0]}

If you could prepare a PR with (bonus points for a test), that would be a good starter task.