tomlokhorst / xcodeedit Goto Github PK
View Code? Open in Web Editor NEWSwift library for reading and writing Xcode project files in OpenStep format
License: MIT License
Swift library for reading and writing Xcode project files in OpenStep format
License: MIT License
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 :)
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.
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:
objects
list.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?")
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
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.
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
string
function is inaccessible:let type = fileRef.string("lastKnownFileType")
Error is: 'string' is inaccessible due to 'internal' protection level
allObjects
:let relativePath = self.xcProjectFile.project.allObjects.fullFilePaths[fileRef.id]
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 :)
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 ProductGroup
s, which is perfectly fine for Xcode, but not XcodeEdit.
Example:
LocalPod2.xcodeproj.zip
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.
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! :)
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.
XcodeEdit generates invalid URLs for project files. PR #35 fixes it.
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.
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!
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.
Parse and generate these as well, so we can discover project files.
XcKit is already taken on CocoaPods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.