Giter Site home page Giter Site logo

xcodeedit's People

Contributors

alvarhansen avatar antondomashnev avatar cezheng avatar craigsoveritall avatar ky1ejs avatar liamnichols avatar lvsti avatar mac-cain13 avatar shepting avatar tomlokhorst avatar tvede-dk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcodeedit's Issues

Latest release gives (fixable, but annoying) compiler errors

Hi!

I'm talking about these errors:

/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:40:38: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    return T(id: key, dict: obj.dict as AnyObject, allObjects: self)
                            ~~~~~~~~~^~~~~~~~~~~~
                                     as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:81:64: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    self.project = PBXProject(id: rootObjectId, dict: projDict as AnyObject, allObjects: allObjects)
                                                      ~~~~~~~~~^~~~~~~~~~~~
                                                               as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:102:43: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
      return type.init(id: id, dict: dict as AnyObject, allObjects: allObjects)
                                     ~~~~~^~~~~~~~~~~~
                                          as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:107:41: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    return PBXObject(id: id, dict: dict as AnyObject, allObjects: allObjects)
                                   ~~~~~^~~~~~~~~~~~
                                        as!

In that release, those errors are fixed by changing as to as!. But I've also downloaded your develop branch and they are gone in your latest commit (I think you did the fixing at f5f8c0fd). I just want to ask, when is the next release coming? To prepare my Package.swift files accordingly :)

Crash If SourceTree contains Path with "SRCROOT"

Our project file uses SRCROOT in some paths and when the SourceTree is built up, the SourceTreeFolder is unable to recognize the SRCROOT variable and returns nil instead of .sourceRoot. enum type.

The PBXReference object has a lazy var that performs a force unwrap which with a SourceTree thats nil, crashes.

Do internal consistency check in initializer

Based on #12

The XCProjectFile initializer should do a internal consistency check after loading the project file. To prevent runtime crashes on one of the many ! used throughout the code.

I haven't tested this, but my guess is, this should work:

  1. Every 24 character alphanumeric String object reference "somewhere" in the complete object graph is an object reference, and that GUID key should exist in the objects list.
  2. Every object GUID key in the objects should be referenced somewhere in the complete object graph.

If either of these fails, an error like this can be generated:

- BuildFile (46880B8819C43A87006E1F66) references missing fileRef 3EACC98E19EE6D4300EB3C5E
- FileReference `AppDelegate.cpp` (288765A40DF7441C002DB57D) is not used in any BuildFile.

Perhaps a merge conflict?

As a second step, the initializer can take an extra parameter unsafeIgnoreInconsistency: Bool so that the current behaviour can be returned.
Perhaps with a better error message: fatalError("Can't find key '3EACC98E19EE6D4300EB3C5E' in objects, ignored in internal inconsistency check. Perhaps a merge conflict?")

Internally inconsistent warning without any further detail about error

Hi,

I use Rswift and after a project merge have been getting this warning:

warning: [R.swift] project.pbxproj is internally inconsistent.

Perhaps a merge conflict?

Obviously the detail of the inconsistency is missing, so very hard to fix. Would anyone know under what circumstances no info on error is generated?

From reading the code it looks like either deadRefs or orphanObjs must not be empty, but I can't see a code path that would generate an empty error detail.

thanks,

Daniel

[Usage question, not an issue] How to correctly compare PBXObjects? (and other questions)

I'm now beginning the transition from Xcode.swift to XcodeEdit for SourceKittenDaemon. Since between both there are API changes, there are some parts of SKD that fail to compile, and I want to ask about how should we use the new API to replace those parts.

All the problems that I get are because of internal access restrictions.

  1. Comparing PBXObjects: we have the following line in SKD:
return objects.filter { $0.buildPhase.id == phase.id }

Here we get an error: 'id' is inaccessible due to 'internal' protection level

  1. The string function is inaccessible:
let type = fileRef.string("lastKnownFileType")

Error is: 'string' is inaccessible due to 'internal' protection level

  1. Same problem with allObjects:
let relativePath = self.xcProjectFile.project.allObjects.fullFilePaths[fileRef.id]
  1. And with AllObjects's fullFilePaths. I could see this one after making allObjects public
let relativePath = self.xcProjectFile.project.allObjects.fullFilePaths[fileRef.id]

If the intent was to make these fields readable, then the first 3 can be fixed using the public keyword (because they are essentially immutable) and since the 4th one is mutable, it should be wrapped with a public getter property if I'm not mistaken.

Thanks in advance :)

Error parsing valid .xcodeproj

This appears to happen with projects cross-referencing other projects generated by CocoaPods when generate_multiple_pod_projects is enabled.

Seems like the problem is they have projectReferences with no ProductGroups, which is perfectly fine for Xcode, but not XcodeEdit.

Example:
LocalPod2.xcodeproj.zip

Xcode 15 local package

Problem

Using R.swift 7.3.2 with an Xcode 15 project where a local package dependency with its own Assets ( including localizable files ) failed to compile.

Error log shows XCodeEdit not supporting object type XCLocalSwiftPackageReference:
Unknown PBXObject subclass isa=XCLocalSwiftPackageReference
There is no issue on using Xcode 14 with locally added package.

Is this an issue somebody is working on? I can try to tackle this issue.

Adding a URL and name to XCProjectFile for use by `xcodebuild`. Significant Refactor.

I've been using Xcode.swift in a command line application we've been making. We're using it to pass project, scheme and target data to xcodebuild.

It would be really handy if XCProjectFile stored the name and URL of the Xcode project it pointed to so that it could be retrieved later (we'd pass it to xcodebuild).

I've already tried making this refactor, but I'm finding it quite complicated to do because of the way the code is architected. For example, if a url: NSURL property were to be added to the XCProjectFile class then all the initialisers would have to take an NSURL parameter. When I considered this it came to me that the initialisers in XCProjectFile class that don't take an NSURL, actually belong in the PBXProject class as they actually provide initialisation for the PBXProject class, not the XCProjectFile.

I'd like to suggest quite a significant refactor to Xcode.swift to simplify future kinds of refactors like this, and improve encapsulation. I'm very conscious that this might not be something you're interested in doing because of the amount of work it presents 😅, but I think it would greatly improve Xcode.swift, and make it easier for other contributors in the future. And of course I'd be more than happy to help! 😄

I think this is a great project, and I'd much rather contribute to your work so far rather than create a duplicate 😄. I've committed my attempt so far at adding a project name to XCProjectFile here to give an idea of the challenges. It'd be great to discuss different approaches to Xcode.swift's architecture.

Let me know what you think! :)

Privacy Manifest File Updation

Apple introduced Privacy Manifest, in which we need to declare the privacy APIs and data collected.
Resources:
https://developer.apple.com/videos/play/wwdc2023/10060/
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests
All products we are building are required to adopt this change ,and we have to collect privacy manifests from both internal and external dependencies.
Does XcodeEdit collect any types of data or use any of the privacy APIs mentioned in the links above? If yes, could you please add a privacy manifest file? If no, please let me know on this ticket. Thank you.

Version 2.7.0 throws build warnings in Xcode 11 Beta 4

CompileSwift normal x86_64 /Users/brian.batchelder/source/ios-library-dev/Pods/XcodeEdit/Sources/XcodeEdit/PBXIdentifier.swift (in target 'XcodeEdit' from project 'Pods')
warning: imported declaration 'UITableViewDiffableDataSourceCellProvider' could not be mapped to 'UITableViewDiffableDataSourceReference.CellProvider'
warning: imported declaration 'UICollectionViewDiffableDataSourceCellProvider' could not be mapped to 'UICollectionViewDiffableDataSourceReference.CellProvider'

I looked to update to 2.7.3, but it is not yet available via cocoapods.

How to add a new file reference to a project?

Hi, I'm trying to edit a Xcode project by adding a new swift file to its targets but I couldn't figure out how to do it.

How can I add a new source file and add it to the project's targets?

Thanks!

Tool to reserializer pbxproj file

Create a CLI tool that can read a .pbxproj file (in XML format) and serialize it in OpenStep format.
For use in combination with other libraries that can modify Xcode project files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.