Skip to content

Conversation

@fortmarek
Copy link
Member

Resolves issue raised here.

In Pods projects, the resource bundle added as a dependency uses the product name. However, the target name can be different suchAlamofire-iOS-Alamofire bundle's product name is Alamofire. When creating the projectNativeTargets map, we use the product name as the key, so we don't throw here.

Note this can cause a mismatch when the targets have a different name but the same product name. I couldn't figure out a good way to match the bundle product name with a specific target when there are multiple targets with the same product. I'd think this is quite rare outside of the Cocoapods context, so I'm leaning to living with that for now and reconsider this if it causes issues down the line.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 3, 2025
@fortmarek
Copy link
Member Author

@KaiOelfke would you have time to test out these changes by pointing to this branch in tuist/tuist and running it against your Cocoapods project? It'd be great to know if there are any other issues before we release a new Tuist version.

@fortmarek fortmarek requested review from ajkolean and pepicrft March 3, 2025 10:34
@dosubot dosubot bot added the bug Something isn't working label Mar 3, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 3, 2025
@fortmarek fortmarek merged commit b3842e6 into main Mar 3, 2025
7 checks passed
@fortmarek fortmarek deleted the fix/product-name branch March 3, 2025 11:26
@KaiOelfke
Copy link

@KaiOelfke would you have time to test out these changes by pointing to this branch in tuist/tuist and running it against your Cocoapods project? It'd be great to know if there are any other issues before we release a new Tuist version.

There was one more issue. But that was not by Tuist, but an seemingly invalid pbxproj configuration on our side. E.g. a native target with name TargetA had as product name in the native target section in the pbx TargetB. In the build setting it still showed up as product name TargetA. So I don't even know how to fix this native target section from Xcode. But fixing it in a text editor resulted finally in a graph output by tuist graph.

Not sure if Tuist can lint against such things.

E26C2C3F1CA1A9620038A3F4 /* TargetA */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = E26C2CB01CA1A9620038A3F4 /* Build configuration list for PBXNativeTarget "TargetA" */;
			buildPhases = (
				E26C2C401CA1A9620038A3F4 /* [CP] Check Pods Manifest.lock */,
				E26C2C791CA1A9620038A3F4 /* Headers */,
				E26C2C411CA1A9620038A3F4 /* Sources */,
				E26C2C771CA1A9620038A3F4 /* Frameworks */,
				E26C2CAD1CA1A9620038A3F4 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = TargetA;
			packageProductDependencies = (
				// unrelated stuff here
			);
			productName = TargetB; // the problem is here
			productReference = E26C2CB31CA1A9620038A3F4 /* TargetA.framework */;
			productType = "com.apple.product-type.framework";
		};

@fortmarek Thanks for your perseverance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants