Skip to content

Commit

Permalink
Add XCLocalSwiftPackageReference Support (#799)
Browse files Browse the repository at this point in the history
- This implements parsing of new element type named `XCLocalSwiftPackageReference` which seems to be introduced with the release of Xcode 15.
  - This can be seen when adding a local package via the Package settings editor in the Xcode UI in Xcode 15
- `localPackages` are now exposed on `PBXProject`
- To add clarify `remotePackages` was also introduced which is intended to replace the now deprecated `packages` property

Test Plan:

- Use `XcodeProj` to read and write a project with the new local package element
- Verify `XcodeProj` is able to read the project without any issues 
- Verify the project written to disk is identical to the original one that was read
  • Loading branch information
art-divin authored Oct 15, 2023
1 parent c3f69fc commit 8b5b4cf
Show file tree
Hide file tree
Showing 22 changed files with 2,038 additions and 65 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 8.15.1

### Added

- Added XCLocalSwiftPackageReference Support (#799)[https://github.com/tuist/XcodeProj/pull/799] by [@art-divin](https://github.com/art-divin).

## 8.15.0

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
31 changes: 31 additions & 0 deletions Fixtures/iOS/MyOtherLocalPackage/MyOtherLocalPackage/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MyOtherLocalPackage",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MyOtherLocalPackage",
targets: ["MyOtherLocalPackage"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "MyOtherLocalPackage",
dependencies: []
),
.testTarget(
name: "MyOtherLocalPackageTests",
dependencies: ["MyOtherLocalPackage"]
),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# MyLocalPackage

A description of this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct MyOtherLocalPackage {
var text = "Hello, World!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import MyLocalPackageTests

var tests = [XCTestCaseEntry]()
tests += MyLocalPackageTests.allTests()
XCTMain(tests)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import XCTest
@testable import MyOtherLocalPackage

final class MyLocalPackageTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(MyOtherLocalPackage().text, "Hello, World!")
}

static var allTests = [
("testExample", testExample),
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
[
testCase(MyLocalPackageTests.allTests),
]
}
#endif
Loading

0 comments on commit 8b5b4cf

Please sign in to comment.