Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Pod Spec Lint' failed validation #8125

Closed
kevinvugts opened this issue Sep 24, 2018 · 17 comments
Closed

'Pod Spec Lint' failed validation #8125

kevinvugts opened this issue Sep 24, 2018 · 17 comments

Comments

@kevinvugts
Copy link

kevinvugts commented Sep 24, 2018

Yes, I am using the latest CocoaPods release

Cocoapods version: 1.6.0.beta.1
XCode version: Version 10.0

Report

What did you do?

I created a pod spec file with 'pod spec create' and filled in the appropriate content


  s.name         = "iMessageFramework"
  s.version      = "1.0.0"
  s.summary      = "Small test to test code sharing via cocoapods."
  s.description  = "This is some superl oco framework that was made by kevin vugts."
  s.homepage     = "https://github.com/kevinvugts/"
  s.license      = "MIT"
  s.author       = { "Kevin Vugts" => "kevin-vugts@live.com" }
  s.platform     = :ios, "11.0"
  s.source       = { :git => "https://github.com/kevinvugts/iMessageFramework.git", :tag => "1.0.0" }
  s.source_files = "iMessageFramework/**/*"
  s.swift_version = '4.2'
  s.ios.deployment_target  = '11.0'
  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
end

What did you expect to happen?

After I run 'pod spec lint --verbose' I received an build error from Xcode which I am not able to reproduce. I expected it to succesfully validate the spec file but it didn't.

What happened instead?

It threw the following error:

    error: Multiple commands produce '/var/folders/yx/cl0s1g4n5d17k4vqv1f860mh0000gn/T/CocoaPods-Lint-20180924-10333-tgiujl-iMessageFramework/DerivedData/App/Build/Products/Release-iphonesimulator/iMessageFramework/iMessageFramework.framework/Info.plist':
    1) Target 'iMessageFramework' (project 'Pods') has copy command from '/var/folders/yx/cl0s1g4n5d17k4vqv1f860mh0000gn/T/CocoaPods-Lint-20180924-10333-tgiujl-iMessageFramework/Pods/iMessageFramework/iMessageFramework/iMessageFramework/Info.plist' to '/var/folders/yx/cl0s1g4n5d17k4vqv1f860mh0000gn/T/CocoaPods-Lint-20180924-10333-tgiujl-iMessageFramework/DerivedData/App/Build/Products/Release-iphonesimulator/iMessageFramework/iMessageFramework.framework/Info.plist'
    2) Target 'iMessageFramework' (project 'Pods') has process command with output '/var/folders/yx/cl0s1g4n5d17k4vqv1f860mh0000gn/T/CocoaPods-Lint-20180924-10333-tgiujl-iMessageFramework/DerivedData/App/Build/Products/Release-iphonesimulator/iMessageFramework/iMessageFramework.framework/Info.plist'
    
    ** BUILD FAILED **
    
   Testing with `xcodebuild`. 
 -> iMessageFramework (1.0.0)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.```

The full output can be found in this pasty: https://pastebin.com/Adf3fu88

## Project that demonstrates the issue

https://github.com/kevinvugts/iMessageFramework
@madsolar8582
Copy link

I was actually going to log the same issue this morning. This is due to the new build system that is now on by default in Xcode 10. The new build system is much stricter about what each step of the build is doing so that it can avoid doing duplicate work in order to speed up the build process. Unfortunately, I don't believe that Cocoapods full supports the new build system yet™.

What is happening here is that when Cocoapods creates the project for lint validation, the new build system is used even if the current project has the new build system turned off via the workspace setting (Project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>BuildSystemType</key>
	<string>Original</string>
</dict>
</plist>

What I think would resolve this is a configuration option to pass to the lint command in order to tell xcodebuild not to use the new build system (i.e. -UseNewBuildSystem=NO) or to duplicate the project's workspace settings in the generated linter project.

@kevinvugts
Copy link
Author

@madsolar8582 so the terminal command would be: pod spec lint --verbose --UseNewBuilddSystem=NO?

@madsolar8582
Copy link

@kevinvugts No. The linter would need to take in a flag that would then pass -UseNewBuildSystem=NO to xcodebuild. Said flag does not yet exist. My suggestion would be something along the lines of --use-legacy-build or something similar.

@kevinvugts
Copy link
Author

@madsolar8582 So by the time cocoapods does not support this. What should I do? I've got XCode 10 on my laptop and the newest cocoapods. And I need to be able to lint in order to continue. :D

@madsolar8582
Copy link

@kevinvugts What I've done for now is to use xcode-select to change the location of xcodebuild to my Xcode 9 installation when I need to lint. Afterwards, I change the location back to Xcode 10. Now, depending on what is being compiled, this may not be a viable solution, but it is the only workaround that I could think of.

@kevinvugts
Copy link
Author

Sorry could you explain that step by step? I have never done that.

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 24, 2018

This looks like the same issue as #8116.

See this comment specifically: #8116 (comment)

My best advise is to fix this to work with Xcode 10. Introducing a new option seems maybe OK but nothing guarantees that the consumer will use the old system either and therefore your pod will fail to build for them.

@madsolar8582
Copy link

@kevinvugts Certainly. xcode-select allows you to change the command line tool location that xcrun uses. For this to work, you must have multiple versions of Xcode installed.

xcode-select --help
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s , --switch set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path

You can also do this from Xcode itself by going to Preferences>Locations and then adjusting Command Line Tools.

@madsolar8582
Copy link

@dnkoutso Would it make sense to also add a configuration to the podspec to enforce the legacy build system?

@dnkoutso
Copy link
Contributor

@madsolar8582 If the build system can be set per target then maybe yes. If its a global setting then no. It is probably best to move forward and fixing libraries to work properly with Xcode 10 as I can imagine in the near future Apple removing the legacy build system entirely or making it even harder to enable.

@madsolar8582
Copy link

@dnkoutso The build system is global as the root project builds all of the subprojects. While I do agree that moving towards the new build system is the right approach, the new build system is not 1:1 with the (now) legacy build system, so some projects do have legitimate reasons to need to continue using the legacy build system until Apple has added those capabilities to the new build system. Those limitations (as well as breaking issues that are unresolved) can be found here.

@dnkoutso
Copy link
Contributor

Yes we are in a transition period for sure. If its global setting unfortunately I cannot see a reason to add this to the podspec DSL as it would make the entire project because of a single pod to use the old build system. Who knows, we might get in places where the old one doesn't work but the new one does in the future.

I checked the git repo for this podspec. This seem the same problem as in #8116 so it should be fairly easy to fix.

@dnkoutso
Copy link
Contributor

Confirmed this is the same as #8116.

Pod::Spec.new do |s|
  s.name         = "iMessageFramework"
  s.version      = "1.0.0"
  s.summary      = "Small test to test code sharing via cocoapods."
  s.description  = "This is some superl oco framework that was made by kevin vugts."
  s.homepage     = "https://github.com/kevinvugts/"
  s.license      = "MIT"
  s.author       = { "Kevin Vugts" => "kevin-vugts@live.com" }
  s.platform     = :ios, "11.0"
  s.source       = { :git => "https://github.com/kevinvugts/iMessageFramework.git", :tag => "1.0.0" }
  s.source_files = "iMessageFramework/**/*"
  s.exclude_files = "iMessageFramework/**/*.plist"
  s.swift_version = '4.2'
  s.ios.deployment_target  = '11.0'
end

This worked and I was able to lint successfully. Please remove Info.plist files from source glob or exclude them.

Also this line:

  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }

It is not currently used by CocoaPods so use s.swift_version instead.

@KaneCheshire
Copy link

@dnkoutso Could you explain what a "source glob" is for those of us who've never heard of the term? I can't see anywhere in my project that is including the Info.plist but I'm still getting that error.

@kevinvugts
Copy link
Author

Confirmed this is the same as #8116.

Pod::Spec.new do |s|
  s.name         = "iMessageFramework"
  s.version      = "1.0.0"
  s.summary      = "Small test to test code sharing via cocoapods."
  s.description  = "This is some superl oco framework that was made by kevin vugts."
  s.homepage     = "https://github.com/kevinvugts/"
  s.license      = "MIT"
  s.author       = { "Kevin Vugts" => "kevin-vugts@live.com" }
  s.platform     = :ios, "11.0"
  s.source       = { :git => "https://github.com/kevinvugts/iMessageFramework.git", :tag => "1.0.0" }
  s.source_files = "iMessageFramework/**/*"
  s.exclude_files = "iMessageFramework/**/*.plist"
  s.swift_version = '4.2'
  s.ios.deployment_target  = '11.0'
end

This worked and I was able to lint successfully. Please remove Info.plist files from source glob or exclude them.

Also this line:

  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }

It is not currently used by CocoaPods so use s.swift_version instead.

Thanks! That worked

@deepesh259nitk
Copy link

deepesh259nitk commented Dec 30, 2018

to change xcode select use command as sudo and change it back to what it was as before :
sudo xcode-select -s /Users/djrecker/Downloads/Xcode9.4.1.app/Contents/Developer

@Al-Said
Copy link

Al-Said commented Feb 4, 2019

Confirmed this is the same as #8116.

Pod::Spec.new do |s|
  s.name         = "iMessageFramework"
  s.version      = "1.0.0"
  s.summary      = "Small test to test code sharing via cocoapods."
  s.description  = "This is some superl oco framework that was made by kevin vugts."
  s.homepage     = "https://github.com/kevinvugts/"
  s.license      = "MIT"
  s.author       = { "Kevin Vugts" => "kevin-vugts@live.com" }
  s.platform     = :ios, "11.0"
  s.source       = { :git => "https://github.com/kevinvugts/iMessageFramework.git", :tag => "1.0.0" }
  s.source_files = "iMessageFramework/**/*"
  s.exclude_files = "iMessageFramework/**/*.plist"
  s.swift_version = '4.2'
  s.ios.deployment_target  = '11.0'
end

This worked and I was able to lint successfully. Please remove Info.plist files from source glob or exclude them.

Also this line:

  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }

It is not currently used by CocoaPods so use s.swift_version instead.

Thank you !!

kim-howard added a commit to smartjack-wp/WPModule-Network-iOS that referenced this issue Jan 30, 2020
remove info.plist and add line to podspec
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }

ref > CocoaPods/CocoaPods#8125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants