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

j2objcXcode task fails (pod install command) #596

Open
zasadnyy opened this issue Feb 9, 2016 · 4 comments
Open

j2objcXcode task fails (pod install command) #596

zasadnyy opened this issue Feb 9, 2016 · 4 comments

Comments

@zasadnyy
Copy link

zasadnyy commented Feb 9, 2016

Or to be more precise pod install fails (see gradle output at the end).

The problem is in podspec file, if I'll comment out line spec.resources = 'src/main/resources/**/*' in j2objc-shared-debug.podspec j2objcXcode task finishes just fine.

The strange thing is that spec.resources is defined according to documentation.

Tested with plugin version 0.5.0-alpha and 0.6.0-alpha.

Output from gradle:

>>>  ./gradlew shared:build --rerun-tasks
No resolved dependencies found when searching for the jacoco version.
:shared:j2objcTranslatedMainLibraryExtraction UP-TO-DATE
:shared:compileJava
:shared:processResources
:shared:classes
:shared:j2objcTranslatedTestLibraryExtraction UP-TO-DATE
:shared:compileTestJava
:shared:processTestResources
:shared:testClasses
:shared:test
:shared:j2objcPreBuild
:shared:j2objcTranslate
:shared:compileDebugTestJ2objcExecutableTestJ2objcObjc
:shared:compileX86_64DebugShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createX86_64DebugShared-j2objcStaticLibrary
:shared:x86_64DebugShared-j2objcStaticLibrary
:shared:linkDebugTestJ2objcExecutable
:shared:debugTestJ2objcExecutable
:shared:compileIos_arm64DebugShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_arm64DebugShared-j2objcSharedLibrary SKIPPED
:shared:ios_arm64DebugShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_arm64DebugShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_arm64DebugShared-j2objcStaticLibrary
:shared:ios_arm64DebugShared-j2objcStaticLibrary
:shared:compileIos_arm64ReleaseShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_arm64ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:ios_arm64ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_arm64ReleaseShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_arm64ReleaseShared-j2objcStaticLibrary
:shared:ios_arm64ReleaseShared-j2objcStaticLibrary
:shared:compileIos_armv7DebugShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_armv7DebugShared-j2objcSharedLibrary SKIPPED
:shared:ios_armv7DebugShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_armv7DebugShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_armv7DebugShared-j2objcStaticLibrary
:shared:ios_armv7DebugShared-j2objcStaticLibrary
:shared:compileIos_armv7ReleaseShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_armv7ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:ios_armv7ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_armv7ReleaseShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_armv7ReleaseShared-j2objcStaticLibrary
:shared:ios_armv7ReleaseShared-j2objcStaticLibrary
:shared:compileIos_x86_64DebugShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_x86_64DebugShared-j2objcSharedLibrary SKIPPED
:shared:ios_x86_64DebugShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_x86_64DebugShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_x86_64DebugShared-j2objcStaticLibrary
:shared:ios_x86_64DebugShared-j2objcStaticLibrary
:shared:compileIos_x86_64ReleaseShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkIos_x86_64ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:ios_x86_64ReleaseShared-j2objcSharedLibrary SKIPPED
:shared:compileIos_x86_64ReleaseShared-j2objcStaticLibraryShared-j2objcObjc
:shared:createIos_x86_64ReleaseShared-j2objcStaticLibrary
:shared:ios_x86_64ReleaseShared-j2objcStaticLibrary
:shared:j2objcAssembleResources
:shared:j2objcAssembleSource
:shared:compileX86_64DebugShared-j2objcSharedLibraryShared-j2objcObjc SKIPPED
:shared:linkX86_64DebugShared-j2objcSharedLibrary SKIPPED
:shared:x86_64DebugShared-j2objcSharedLibrary SKIPPED
:shared:j2objcBuildObjcDebug
:shared:j2objcPackLibrariesDebug
:shared:j2objcPodspec
:shared:j2objcXcode FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:j2objcXcode'.
> Command Line Failed:
  pod install
  Working Dir:
  /Users/vitalik/dev/repos/android-reddit-prototype/ios
  Cause:
  org.gradle.process.internal.ExecException: Process 'command 'pod'' finished with non-zero exit value 1
  Standard Output:
  Updating local specs repositories

  CocoaPods 1.0.0.beta.3 is available.
  To update use: `sudo gem install cocoapods --pre`
  [!] This is a test version we'd love you to try.

  For more information see http://blog.cocoapods.org
  and the CHANGELOG for this version http://git.io/BaH8pQ.

  Analyzing dependencies
  Fetching podspec for `j2objc-shared-debug` from `../shared/build/j2objcOutputs`
  Fetching podspec for `j2objc-shared-release` from `../shared/build/j2objcOutputs`
  Downloading dependencies
  Installing j2objc-shared-debug 1.0 (was 1.0)
  Installing j2objc-shared-release 1.0 (was 1.0)
  Generating Pods project

  ――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

  ### Command

  ``
  /Users/vitalik/.rvm/gems/ruby-2.2.1/bin/pod install
  ``

  ### Report

  * What did you do?

  * What did you expect to happen?

  * What happened instead?


  ### Stack

  ``
     CocoaPods : 0.39.0
          Ruby : ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
      RubyGems : 2.4.6
          Host : Mac OS X 10.11.3 (15D21)
         Xcode : 7.2 (7C68)
           Git : git version 2.5.4 (Apple Git-61)
  Ruby lib dir : /Users/vitalik/.rvm/rubies/ruby-2.2.1/lib
  Repositories : master - https://github.com/CocoaPods/Specs.git @ 89d3c5af0a4843427fc3dfaebbf98d5916fa6fb6
  ``

  ### Plugins

  ``
  cocoapods-plugins : 0.4.2
  cocoapods-search  : 0.1.0
  cocoapods-stats   : 0.6.2
  cocoapods-trunk   : 0.6.4
  cocoapods-try     : 0.5.1
  ``

  ### Podfile

  ``ruby
  # Uncomment this line to define a global platform for your project
  # platform :ios, '8.0'
  # Uncomment this line if you're using Swift
  # use_frameworks!

  # J2ObjC Gradle Plugin - PodMethods - DO NOT MODIFY START - can be moved as a block
  def j2objc_shared
      pod 'j2objc-shared-debug', :configuration => ['Debug'], :path => '../shared/build/j2objcOutputs'
      pod 'j2objc-shared-release', :configuration => ['Release'], :path => '../shared/build/j2objcOutputs'
  end
  # J2ObjC Gradle Plugin - PodMethods - DO NOT MODIFY END

  target 'reddit-gs' do
      platform :ios, '8.3'
      j2objc_shared

  end

  target 'reddit-gsTests' do
      platform :ios, '8.3'
      j2objc_shared

  end

  target 'reddit-gsUITests' do

  end
  ``

  ### Error

  ``
  NoMethodError - undefined method `new_file' for <PBXFileReference path=`com` UUID=`9EF314D8F71C63FB26935652`>:Xcodeproj::Project::Object::PBXFileReference
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/project.rb:198:in `add_file_reference'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:184:in `block (2 levels) in add_file_accessors_paths_to_pods_group'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:182:in `each'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:182:in `block in add_file_accessors_paths_to_pods_group'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:178:in `each'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:178:in `add_file_accessors_paths_to_pods_group'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:105:in `block in add_resources'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:140:in `message'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:104:in `add_resources'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer/file_references_installer.rb:40:in `install!'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:602:in `install_file_references'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:155:in `block in generate_pods_project'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:153:in `generate_pods_project'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:111:in `install!'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
  /Users/vitalik/.rvm/gems/ruby-2.2.1@global/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/bin/pod:23:in `load'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/bin/pod:23:in `<main>'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
  /Users/vitalik/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
  ``

  ――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

  [!] Oh no, an error occurred.

  Search for existing GitHub issues similar to yours:
  https://github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60new_file%27+for+%3CPBXFileReference+path%3D%60com%60+UUID%3D%609EF314D8F71C63FB26935652%60%3E%3AXcodeproj%3A%3AProject%3A%3AObject%3A%3APBXFileReference&type=Issues

  If none exists, create a ticket, with the template displayed above, on:
  https://github.com/CocoaPods/CocoaPods/issues/new

  Be sure to first read the contributing guide for details on how to properly submit a ticket:
  https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

  Don't forget to anonymize any private data!


  Error Output:


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 43.896 secs

@zasadnyy
Copy link
Author

zasadnyy commented Feb 9, 2016

Temporary solution was to add postprocessing of generated podspec's to build.gradle in shared project:

j2objcPodspec.doLast {    
    println('Modifying generated podspecs to be able to run pod install')
    [getPodspecDebug(), getPodspecRelease()].asList().each {
        File podspec = it
        String text = podspec.text.replace(
                "spec.resources = 'src/main/resources/**/*'", 
                "# spec.resources = 'src/main/resources/**/*'  <-- commented due to issue with pod install")
        podspec.write(text)
    }
}

@brunobowden
Copy link
Contributor

I'm not sure what's going on here. I'm happily installing this with Cocoapods 0.39.0, the latest non-beta version (command line shown below). Are you using the same version?

I suspect that this is some kind of issue with Cocoapods, though I don't know what exactly. I would try the cd Xcode && pod install command directly on the command line and try debugging it from there. If there is a legitimate reason to modify the Podfile, then we can provide that as an option in the plugin. Indeed, some users may want to use different resources for example. I would like to build a better justification for what changes to be made before accepting that but I'm open to talking about it.

Verify that my podspec contains the resources path:

$ grep resources base/build/j2objcOutputs/j2objc-base-release.podspec 
  spec.resources = 'src/main/resources/**/*'

Show that may Podspec install works (also works through plugin):

$ (cd Xcode && pod install)
Updating local specs repositories

CocoaPods 1.0.0.beta.3 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Analyzing dependencies
Fetching podspec for `j2objc-base-debug` from `../base/build/j2objcOutputs`
Fetching podspec for `j2objc-base-release` from `../base/build/j2objcOutputs`
Downloading dependencies
Using j2objc-base-debug (1.0)
Using j2objc-base-release (1.0)
Generating Pods project
Integrating client project
Sending stats
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.

@zasadnyy
Copy link
Author

zasadnyy commented Feb 9, 2016

Are you using the same version?

Yup, 0.39.0, I've tried with older versions and result was the same.

If there is a legitimate reason to modify the Podfile, then we can provide that as an option in the plugin.

No, it's not a case, I added the comment with a temporary solution, just in case someone will face the same issue.

I'll try to dig into the problem deeper in coming days and post my findings here. In any case, thanks for the reply.

@brunobowden
Copy link
Contributor

@zasadnyy - that's a creative workaround on your part. I'm interested in what else you learn on this.

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

2 participants