xbase-lab / xcodeproj

XcodeProj parser and data representation
5 stars 2 forks source link

Barebone .xcodeproj having an error on vim startup #6

Closed rubenmate closed 2 years ago

rubenmate commented 2 years ago

I'm getting started in iOS development (was following this). I've created the project in Xcode and went into neovim as now .xcodeproj should be supported. Project structure is as follows:

Landmarks/
├─ Landmarks/
│  ├─ Assets.xcassets/
│  ├─ ContentView.swift
│  ├─ LandmarksApp.swift
│  ├─ Preview Content/
├─ Landmarks.xcodeproj/
│  ├─ project.pbxproj
│  ├─ project.xcworkspace/
│  ├─ xcuserdata/
├─ LandmarksTests/
│  ├─ LandmarksTests.swift
├─ LandmarksUITests/
│  ├─ LandmarksUITests.swift
│  ├─ LandmarksUITestsLaunchTests.swift

But when I go into neovim this appears on top: image

Project builds fine on Xcode. I tried debugging and trying with xcodegen but since I don't really know how an iOS project works I'm a bit lost.

kkharji commented 2 years ago

hey @rubenmate, this an issue resulting from the pbxproj file parser, could you attach the xcodeproj/project.pbxproj file here. investigating using the link to the project.

kkharji commented 2 years ago

Okay this should be closed by a26044f19a52368b148e80c5d3999b63b7d0ff56. I've added test for the landmark pbxproj and indeed there was a bug.

@rubenmate Could cd in xbase root and do cargo update -p xcodeproj and then make install.

rubenmate commented 2 years ago

Thanks for your quick fix @tami5

Seems to be solved but now the build (when neovim is opened) is not triggering. Xbase-daemon logs are the following:

 INFO xbase::store::clients: Add: 67418
 INFO xbase::store::projects: Add: "learning-ios-swift_Landmarks"
ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("LandmarksUITests")
 INFO xbase::drop: Drop(67418: learning-ios-swift_Landmarks)
ERROR xbase: [Failure]: Cause: (NotFound("project", "\"/Users/rubenmate/Developerino/learning-ios-swift/Landmarks\""))
 INFO xbase::store::clients: Add: 67563
 INFO xbase::store::projects: Add: "learning-ios-swift_Landmarks"
ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("LandmarksUITests")
 INFO xbase::drop: Drop(67563: learning-ios-swift_Landmarks)
ERROR xbase: [Failure]: Cause: (NotFound("project", "\"/Users/rubenmate/Developerino/learning-ios-swift/Landmarks\""))
 INFO xbase::store::clients: Add: 67798
 INFO xbase::store::projects: Add: "learning-ios-swift_Landmarks"
ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("Landmarks")
 INFO xbase::drop: Drop(67798: learning-ios-swift_Landmarks)
ERROR xbase: [Failure]: Cause: (NotFound("project", "\"/Users/rubenmate/Developerino/learning-ios-swift/Landmarks\""))
kkharji commented 2 years ago

ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("LandmarksUITests")

This expected kinda, because tests can't be build and run. But should be trace rather then error, behind the scene LandmarksUITests get set to Unknown

Though regarding build isn't triggering in neovim open? I'm not sure what tou are expecting here

on neovim open xbase ensure buildServer.json and .compile exists, and if so it doesn't do anything. To build the project and see logs you need to go through the picker. And if you are using a generator it should auto generate .compile on config file write

kkharji commented 2 years ago

ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("LandmarksUITests") INFO xbase::drop: Drop(67418: learning-ios-swift_Landmarks)

wait that doesn't seem right at all, so the project never registered?

kkharji commented 2 years ago

My logs are

 INFO xbase: Started
 INFO xbase::store::clients: Add: 80074
 INFO xbase::store::projects: Add: "Downloads_Landmark"
 INFO xcodeproj::pbxproj::object::build::list: no sdkroot found in build_configuration_list: "C20D77F924B665D8002E7AEA"
 INFO xbase::project::barebone: (name: "CreatingAndCombiningViews", targets: {"Landmarks": IOS})
 INFO xbase::store::watcher: Add: "Downloads_Landmark"
 INFO xbase::drop: Drop(80074: Downloads_Landmark)
 INFO xbase::store::projects: Remove: "Downloads_Landmark"
 INFO xbase::store::watcher: Remove: "Downloads_Landmark"
DEBUG xbase::store::clients: Remove: 80074

Here with clean project


 INFO xbase::store::clients: Add: 81127
 INFO xbase::store::projects: Add: "Downloads_Landmark"
 INFO xcodeproj::pbxproj::object::build::list: no sdkroot found in build_configuration_list: "C20D77F924B665D8002E7AEA"
 INFO xbase::project::barebone: (name: "CreatingAndCombiningViews", targets: {"Landmarks": IOS})
 INFO xbase::store::watcher: Add: "Downloads_Landmark"
 INFO xbase::compile: Creating "/Users/tami5/Downloads/Landmark/buildServer.json"
 INFO xbase::project::barebone: xcodebuild clean build -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" SYMROOT=/Users/tami5/Library/Caches/Xbase/Downloads_Landmark -project CreatingAndCombiningViews.xcodeproj
rubenmate commented 2 years ago

ERROR xcodeproj::pbxproj::object::target: No SDKROOT found for Some("LandmarksUITests") INFO xbase::drop: Drop(67418: learning-ios-swift_Landmarks)

wait that doesn't seem right at all, so the project never registered?

Seems like nope. If I run the build_picker binding I get this:

E5108: Error executing lua: .../nvim/site/pack/packer/start/xbase/lua/xbase/pickers.lua:57: No project info found            
stack traceback:                                                                                                             
        [C]: in function 'error'                                                                                             
        .../nvim/site/pack/packer/start/xbase/lua/xbase/pickers.lua:57: in function 'get_selections'                         
        .../nvim/site/pack/packer/start/xbase/lua/xbase/pickers.lua:169: in function <.../nvim/site/pack/packer/start/xbase/lua/xbase/pickers.lua:164> 

Am I missunderstading how this works? Maybe I should try xcodegen approach and see what happens.

kkharji commented 2 years ago

To get mine working on the same project I dowloaded https://developer.apple.com/tutorials/swiftui/creating-and-combining-views and extracted Complete dir and remained it Landmark.

my tree:

4       ./Configuration/SampleCode.xcconfig
4       ./Configuration
8       ./.DS_Store
4       ./LICENSE/LICENSE.txt
4       ./LICENSE
16      ./CreatingAndCombiningViews.xcodeproj/project.pbxproj
4       ./CreatingAndCombiningViews.xcodeproj/.xcodesamplecode.plist
4       ./CreatingAndCombiningViews.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
0       ./CreatingAndCombiningViews.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
0       ./CreatingAndCombiningViews.xcodeproj/project.xcworkspace/xcshareddata/xcschemes
4       ./CreatingAndCombiningViews.xcodeproj/project.xcworkspace/xcshareddata
4       ./CreatingAndCombiningViews.xcodeproj/project.xcworkspace
24      ./CreatingAndCombiningViews.xcodeproj
4       ./buildServer.json
4       ./README.md
4       ./Landmarks/MapView.swift
4       ./Landmarks/CircleImage.swift
4       ./Landmarks/Assets.xcassets/AppIcon.appiconset/Contents.json
4       ./Landmarks/Assets.xcassets/AppIcon.appiconset
4       ./Landmarks/Assets.xcassets/AccentColor.colorset/Contents.json
4       ./Landmarks/Assets.xcassets/AccentColor.colorset
4       ./Landmarks/Assets.xcassets/Contents.json
4       ./Landmarks/Assets.xcassets/turtlerock.imageset/Contents.json
272     ./Landmarks/Assets.xcassets/turtlerock.imageset/turtlerock@2x.jpg
276     ./Landmarks/Assets.xcassets/turtlerock.imageset
288     ./Landmarks/Assets.xcassets
4       ./Landmarks/Preview Content/Preview Assets.xcassets/Contents.json
4       ./Landmarks/Preview Content/Preview Assets.xcassets
4       ./Landmarks/Preview Content
4       ./Landmarks/ContentView.swift
4       ./Landmarks/LandmarksApp.swift
4       ./Landmarks/Info.plist
312     ./Landmarks
4       ./.compile
364     .

it should've just worked. I suspected maybe you have outdate version running, maybe, try updating to xbase last commit. then make install

rubenmate commented 2 years ago

You were right! Updated xbase and now it's working.

Thanks for your kind help and quick responses. Sorry if at some times I wasn't clear enough (as I don't really know how it is xcode and iOS projects I don't know the exact process and how things work).

Anyways, great job with the plugin.