AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 601 forks source link

Xcode 10 Beta: Unable to Compile #281

Closed richardtop closed 3 years ago

richardtop commented 6 years ago

New Issue Checklist

Environment

Issue Description

Showing All Messages

image

Complete output when you encounter the issue (if any)

Showing All Messages

Prepare build
note: Using new build systemnote: Planning buildnote: Using build description from memory

Build system information
error: Cycle inside OHHTTPStubs; building could produce unreliable results.
Cycle details:
→ Target 'OHHTTPStubs' has link command with output '/Users/USERNAME/Library/Developer/Xcode/DerivedData/AppName-dccqjpeftvorbzfhjfzvjwlkqkxo/Build/Products/Debug-iphonesimulator/OHHTTPStubs/OHHTTPStubs.framework/OHHTTPStubs'

Build failed    07/06/2018, 14.20    0.1 seconds
AliSoftware commented 6 years ago

Thanks for the issue report.

I'm a little confused because the demo projects in Examples/Swift/OHHTTPStubsDemo — which include OHHTTPStubs via CocoaPods too (even if they do so using :path => ../..) — are compiling fine in Xcode 10b1, and the library project compiles in 10b1 too… I'll have to investigate some more to reproduce the issue.

AliSoftware commented 6 years ago

@richardtop Are we using the same versions and doing the same settings?

I've created a brand new project with Xcode 10b1, added a Podfile with OHHTTPStubs in it, and built the workspace… and still haven't seen the error.

Are you using OHTTPStubs with or without the Swift subspec? Are you using OHHTTPStubs from ObjC or Swift? Do you have a minimalistic workspace to share so I can reproduce the issue?

Thanks

richardtop commented 6 years ago

I'm adding the library to the project with CocoaPods: pod 'OHHTTPStubs/Swift'

The issue is not always reproducible and making a clean build usually resolves it.

My Xcode version is 10.0 beta (10L176w), I'll try using the newest beta.

Actually, it seems, I'm already using the latest beta.

AliSoftware commented 6 years ago

Hi

I'm sorry I've tried multiple setups but still can't reproduce the issue.

See below, I got a project that compiles without this cycling issue.

ohhttpstubs-xcode10b1

I've attached the sample project I used in a ZIP here, which is a simple as it can get: I create a brand new project with Xcode 10b1, then ran pod init, added pod 'OHHTTPStubs/Swift to the Podfile, ran pod install, added import OHHTTPStubs and called stub(…) in the Issue281Tests.swift file, built and ran the tests. So I have no idea how to make the issue you see appear.

Please provide a sample project (reduced to the minimum if possible) where you reproduce this in a ZIP file, as this issue of build cycles seems worrisome and I'd love to investigate further.

richardtop commented 6 years ago

I understand, the issue is pretty hard to reproduce in my project. Cleaning the build folder always leads to build success, so I speculate, the issue has to deal with the derived data. Most likely, the issue isn't a library issue at all, but a byproduct of ß-Xcode instability, or has to deal with my project settings.

I'll try to investigate it deeper when it occurs again and post the results here.

richardtop commented 6 years ago

I've encountered a problem once again, using Swift 4.1, btw.

Here is the output:


Showing All Messages
:-1: Cycle in dependencies between targets 'AppName' and 'OHHTTPStubs'; building could produce unreliable results.
Cycle path:  → Pods-AppName → OHHTTPStubs → AppName
Cycle details:
→ Target 'AppName' has compile command for Swift source files
→ Target 'Pods-AppName' has target dependency on Target 'OHHTTPStubs'
→ Target 'OHHTTPStubs' has copy command from '/Users/user/Documents/Code/AppName-ios/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h' to '/Users/user/Library/Developer/Xcode/DerivedData/AppName-dccqjpeftvorbzfhjfzvjwlkqkxo/Build/Products/Debug-iphonesimulator/OHHTTPStubs/OHHTTPStubs.framework/Headers/OHHTTPStubs-umbrella.h'
○ Target 'OHHTTPStubs' has link command with output '/Users/user/Library/Developer/Xcode/DerivedData/AppName-dccqjpeftvorbzfhjfzvjwlkqkxo/Build/Products/Debug-iphonesimulator/OHHTTPStubs/OHHTTPStubs.framework/OHHTTPStubs'
○ Target 'OHHTTPStubs' has link command with output '/Users/user/Library/Developer/Xcode/DerivedData/AppName-dccqjpeftvorbzfhjfzvjwlkqkxo/Build/Products/Debug-iphonesimulator/OHHTTPStubs/OHHTTPStubs.framework/OHHTTPStubs'
richardtop commented 6 years ago

A bit more insight: usually this issue happens when adding a new .swift file. Cleaning and building the project usually resolves it.

AliSoftware commented 6 years ago

Thanks for the feedback.

tbh, I don't have any free time lately to dig into that much, between work, summer leave & other project, so I can't guarantee you that I'll be able to investigate it very soon, I just wanted to let you know.

Maybe @Liquidsoul have some bandwidth to investigate it more? Otherwise, don't hesitate to ping us back in while if we didn't give any news after a while

woguan commented 5 years ago

Hi @AliSoftware I am also facing this issue:

error: Cycle in dependencies between targets 'xxxxxx' and 'OHHTTPStubs'; building could produce unreliable results. Cycle path: xxxxxx → Pods-xxxxxx → OHHTTPStubs → xxxxxx Cycle details: → Target 'xxxxxx' has target dependency on Target 'Pods-xxxxxx' → Target 'Pods-xxxxx' has target dependency on Target 'OHHTTPStubs' → Target 'OHHTTPStubs' has link command with output '/Users/xxxx/Library/Developer/Xcode/DerivedData/xxxxxx-avawzavsrxmsaybnizznwdzouvtf/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/OHHTTPStubs.build/Objects-normal/arm64/OHHTTPStubs' ○ Target 'OHHTTPStubs' has a command with

Cleaning the derived data makes the build success. It happens once in a while.

Panajev commented 4 years ago

Uhm... @AliSoftware getting it on Xcode 11.4 on CI (Jenkins) all builds use local derived data and project is cloned fresh for each build:

warning: Multiple targets match implicit dependency for linker flags '-framework OHHTTPStubs'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target '...' from project '...')

Build system information
error: Multiple commands produce '/.../Jenkins/workspace/tests-...-all-commits-ios-pr/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Debug/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OHHTTPStubs.framework':
1) Target 'OHHTTPStubs-b1c8d455' has create directory command with output '/.../Jenkins/workspace/tests-...-all-commits-ios-pr/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Debug/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OHHTTPStubs.framework'
2) Target 'OHHTTPStubs.default-Core-JSON-NSURLSession-OHPathHelpers' has create directory command with output '/../Jenkins/workspace/tests-...-all-commits-ios-pr/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Debug/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OHHTTPStubs.framework'

Mmmh... maybe it was a local Podfile configuration issues (defined in multiple targets Objective-C and Swift version)...