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

Unable to read the license file LICENSE.txt for the spec [framework_name] #9472

Closed
elsh opened this issue Jan 9, 2020 · 10 comments
Closed

Comments

@elsh
Copy link

elsh commented Jan 9, 2020

'pod trunk push' gives the following warning, even though the LICENSE.txt file exists (at the root https://github.com/uber/mockolo).

[!] Unable to read the license file `LICENSE.txt` for the spec `MockoloFramework (1.1.2)`

The podspec is (https://github.com/uber/mockolo/blob/master/MockoloFramework.podspec):

Pod::Spec.new do |s|
  s.name             = 'MockoloFramework'
  s.version          = '1.1.2'
  s.summary          = 'Efficient Mock Generator for Swift'
  s.description      = 'MockoloFramework provides a fast and easy way to autogenerate mock objects that can be tested in your code...'
  s.homepage         = 'https://github.com/uber/mockolo'
  s.license          = { :type => 'Apache 2.0', :file => 'LICENSE.txt' }
  s.author           = { 'name' => 'name@co.com' }
  s.osx.deployment_target = '10.14'
  s.swift_version    = '5.1'
  s.dependency 'SourceKittenFramework', '~>0.26.0'
  s.source         = { :http => "#{s.homepage}/archive/#{s.version}.zip" }
end
@paulb777
Copy link
Member

paulb777 commented Jan 9, 2020

The two s.source assignments might be the issue.

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Jan 9, 2020
@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Jan 9, 2020
@elsh
Copy link
Author

elsh commented Jan 9, 2020

The two s.source assignments might be the issue.

I removed the first one (and updated the spec posted above), but still having the same issue. It was suggested in #9471 that missing source_files might be another reason, but adding it now throws an error seen at #9479.

@amorde
Copy link
Member

amorde commented Jan 9, 2020

Can you try adding :flatten => true inside the source hash?

s.source         = { :http => "#{s.homepage}/archive/#{s.version}.zip", :flatten => true }

Or try adding the name of the zip to the front of the path:

s.license          = { :type => 'Apache 2.0', :file => "mockolo-#{s.version}/LICENSE.txt" }

zips from Github usually contain a folder of the same name as the zip itself. :flatten will remove that folder for you, or you can manually specify it. If you manually specify it, it will fail when using pod lib lint since locally the path is different.

Edit: I think this would also solve #9479

@amorde amorde added the s1:awaiting input Waiting for input from the original author label Jan 9, 2020
@elsh
Copy link
Author

elsh commented Jan 10, 2020

Thanks for your answer. I can't use :flatten as it throws an error about an imported module that's not a pod (SwiftSyntax). Here's the error I get fyi:

➜  mockolo git:(master)  pod spec lint

 -> MockoloFramework (1.1.2)
    - ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [OSX] xcodebuild:  note: Planning build
    - NOTE  | [OSX] xcodebuild:  note: Constructing build description
    - ERROR | [OSX] xcodebuild:  MockoloFramework/Sources/MockoloFramework/Operations/ProcessedTypeMapGenerator.swift:19:8: error: no such module 'SwiftSyntax'
    - ERROR | [OSX] xcodebuild:  /Users/elsh/Library/Developer/Xcode/DerivedData/App-cnjjkmwxsssxuzbnpblhayekrljn/Build/Products/Release/MockoloFramework/MockoloFramework.framework/Modules/module.modulemap:9:12: error: header 'MockoloFramework-Swift.h' not found
    - ERROR | [OSX] xcodebuild:  /var/folders/7q/6r28_8y54yzczp0hv5w8yyn80000gn/T/CocoaPods-Lint-20200109-45743-1m2qnwv-MockoloFramework/App/main.swift:1:8: error: could not build Objective-C module 'MockoloFramework'

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 4 errors.

Specifying it manually and 'pod lib lint' didn't pass as you mentioned. This still leaves the issue unresolved (also source_files = 'mockolo-#{s.version}/Sources/MockoloFramework/**/*.swift'). Here's the error:

➜  mockolo git:(master)  pod lib lint --no-clean

 -> MockoloFramework (1.1.2)
    - ERROR | [OSX] file patterns: The `source_files` pattern did not match any file.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [OSX] xcodebuild:  note: Planning build
    - NOTE  | [OSX] xcodebuild:  note: Constructing build description

Pods workspace available at `/var/folders/7q/6r28_8y54yzczp0hv5w8yyn80000gn/T/CocoaPods-Lint-20200109-48467-8rpog5-MockoloFramework/App.xcworkspace` for inspection.

[!] MockoloFramework did not pass validation, due to 1 error.

[!] A license was specified in podspec `MockoloFramework` but the file does not exist - /Users/elsh/Developer/mockolo/mockolo-#{s.version}/LICENSE.txt

[!] Unable to read the license file `mockolo-#{s.version}/LICENSE.txt` for the spec `MockoloFramework (1.1.2)`

[!] Unable to read the license file `mockolo-#{s.version}/LICENSE.txt` for the spec `MockoloFramework (1.1.2)`

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Jan 10, 2020
@amorde
Copy link
Member

amorde commented Jan 10, 2020

If there's a failed import, I don't think it's related to the use of :flatten - that option only controls how the zip of the source code is unpacked.

I'd recommend inspecting the generated workspace using --no-clean (I see you used that for pod lib lint but not pod spec lint) and see why it's not building.

I tried this myself using a fresh checkout including the :flatten option, on Xcode 11.2.1 and macOS 10.15.2, and it passed:

$ pod spec lint MockoloFramework.podspec --no-clean

 -> MockoloFramework (1.1.2)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [OSX] xcodebuild:  note: Planning build
    - NOTE  | [OSX] xcodebuild:  note: Constructing build description
    - NOTE  | [OSX] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'SWXMLHash' from project 'Pods')
    - NOTE  | [OSX] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Yams' from project 'Pods')
    - NOTE  | [OSX] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'SourceKittenFramework' from project 'Pods')
    - NOTE  | [OSX] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [OSX] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

Pods workspace available at `/var/folders/kb/x__31qgj1t1f3ywr_q010yb00000gn/T/CocoaPods-Lint-20200109-9005-lz8r4x-MockoloFramework/App.xcworkspace` for inspection.

Analyzed 1 podspec.

MockoloFramework.podspec passed validation.

@elsh
Copy link
Author

elsh commented Jan 10, 2020

If there's a failed import, I don't think it's related to the use of :flatten - that option only controls how the zip of the source code is unpacked.

I should've specified that if I :flatten and also specify source_files, it throws the build error above 'no such module SwiftSyntax'. It works if I don't specify source_files. Without source_files though, I'm still seeing an error mentioned at #9479. Is there a way to grab source files from the zip in a sample project Podfile instead?

@amorde
Copy link
Member

amorde commented Jan 10, 2020

Oh I see, sounds like you can use pod lib lint (which uses your local checkout of the source code) to test out source_files, and once you think that's working then try pod spec lint which will download a zip from Github.

I gave it a try on my machine and I realize now that you may be trying to use https://github.com/apple/swift-syntax, which is a SwiftPM package that isn't shipped with macOS. You'll need to bundle it with your pod somehow, either by compiling it and shipping the binary or wrapping it in a podspec.

Screen Shot 2020-01-09 at 6 34 44 PM

@elsh
Copy link
Author

elsh commented Jan 14, 2020

Thanks for trying it on your machine. Wouldn't wrapping it in podspec require swiftsyntax to be a pod, which should be added by apple?

@elsh
Copy link
Author

elsh commented Jan 17, 2020

Just to close the loop, I decided to split the files so SwiftSyntax is not part of the pod, which resolved the issues.

@elsh elsh closed this as completed Jan 17, 2020
@amorde
Copy link
Member

amorde commented Jan 18, 2020

Apologies for missing this but sounds like you got it 👍

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

4 participants