Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/XcodeGraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: XcodeGraph
on:
push:
branches:
- "**"
- "main"
tags-ignore:
- "**"
paths:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Test on Linux
if: matrix.os == 'ubuntu-22.04'
# These momdules rely on some Xcode utilities like xcode-select
run: swift test --skip XcodeProjMapperTests --skip XcodeMetadataTests
run: swift test --skip XcodeGraphMapperTests --skip XcodeMetadataTests
- name: Test
if: matrix.os != 'ubuntu-22.04'
run: swift test
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: jdx/mise-action@v2
with:
experimental: true
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: 6.0.3
- name: Build docs
run: mise run docs:build
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy .build/documentation --project-name=xcodegraph
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docs

on:
push:
branches:
- main
pull_request:
merge_group:

concurrency:
group: docs-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: "ubuntu-latest"
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
with:
experimental: true
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: 6.0.3
- name: Build docs
run: mise run docs:build
5 changes: 5 additions & 0 deletions .mise/tasks/docs/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# mise description="Build docs"
set -euo pipefail

swift package --package-path $MISE_PROJECT_ROOT --allow-writing-to-directory .build/documentation generate-documentation --disable-indexing --output-path .build/documentation --transform-for-static-hosting --enable-experimental-combined-documentation --target XcodeGraph --target XcodeGraphMapper
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.4.0] - 2025-02-05
### Details
#### Feat
- Introduce XcodeProjMapper to map XcodeProj to XcodeGraph by @ajkolean in [#87](https://github.com/tuist/XcodeGraph/pull/87)
- Introduce XcodeGraphMapper to map XcodeProj to XcodeGraph by @ajkolean in [#87](https://github.com/tuist/XcodeGraph/pull/87)

## New Contributors
* @ajkolean made their first contribution in [#87](https://github.com/tuist/XcodeGraph/pull/87)
Expand Down
24 changes: 21 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let targets: [Target] = [
]
),
.target(
name: "XcodeProjMapper",
name: "XcodeGraphMapper",
dependencies: [
"XcodeGraph",
"XcodeMetadata",
Expand All @@ -53,9 +53,9 @@ let targets: [Target] = [
]
),
.testTarget(
name: "XcodeProjMapperTests",
name: "XcodeGraphMapperTests",
dependencies: [
"XcodeProjMapper",
"XcodeGraphMapper",
.product(name: "FileSystem", package: "FileSystem"),
],
swiftSettings: [
Expand All @@ -72,7 +72,7 @@ let package = Package(
name: "XcodeGraph",
targets: ["XcodeGraph"]
),
.library(name: "XcodeProjMapper", targets: ["XcodeProjMapper"]),
.library(name: "XcodeGraphMapper", targets: ["XcodeGraphMapper"]),
],
dependencies: [
.package(url: "https://github.com/Flight-School/AnyCodable", .upToNextMajor(from: "0.6.7")),
Expand All @@ -83,6 +83,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-service-context", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/Kolos65/Mockable.git", .upToNextMajor(from: "0.0.11")),
.package(url: "https://github.com/p-x9/MachOKit", .upToNextMajor(from: "0.28.0")),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
],
targets: targets
)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ let package = Package(

## XcodeGraphMapper

- [Documentation](https://xcodegraph.pages.dev/documentation/XcodeGraphMapper)

XcodeGraphMapper parses `.xcworkspace` or `.xcodeproj` files using `XcodeProj` and constructs a `XcodeGraph.Graph` representing their projects, targets, and dependencies:

### Usage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ``XcodeProjMapper``
# ``XcodeGraphMapper``

@Metadata {
@DisplayName("Xcode Project Mapper")
Expand All @@ -10,9 +10,9 @@ A tool that maps Xcode projects (`.xcodeproj` and `.xcworkspace`) into a structu

## Overview

``XcodeProjMapper`` leverages ``XcodeProj`` to parse and navigate Xcode project files, then translates them into a domain-specific graph model (``XcodeGraph/Graph``). This model captures all essential components—projects, targets, packages, dependencies, build settings, schemes, and more—providing a high-level, language-agnostic structure for further processing.
``XcodeGraphMapper`` leverages ``XcodeProj`` to parse and navigate Xcode project files, then translates them into a domain-specific graph model (``XcodeGraph/Graph``). This model captures all essential components—projects, targets, packages, dependencies, build settings, schemes, and more—providing a high-level, language-agnostic structure for further processing.

By using this graph-based representation, you can easily analyze project configurations, visualize complex dependency graphs, or integrate advanced workflows into your build pipelines. For example, teams can leverage ``XcodeProjMapper`` to:
By using this graph-based representation, you can easily analyze project configurations, visualize complex dependency graphs, or integrate advanced workflows into your build pipelines. For example, teams can leverage ``XcodeGraphMapper`` to:

- Generate code based on discovered resources and targets.
- Validate project configurations and detect missing bundle identifiers or invalid references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct XcodeGraphMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct XCPackageMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXCopyFilesBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXCoreDataModelsBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXFrameworksBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXHeadersBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXResourcesBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXScriptsBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXSourcesBuildPhaseMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXProjectMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import AEXML
import Path
import Testing
import XcodeGraph

@testable import XcodeGraphMapper
@testable import XcodeProj
@testable import XcodeProjMapper

@Suite
struct XCSchemeMapperTests {
Expand Down Expand Up @@ -135,8 +136,12 @@ struct XCSchemeMapperTests {
blueprintName: "App"
)
let runnable = XCScheme.BuildableProductRunnable(buildableReference: targetRef)
let envVar = XCScheme.EnvironmentVariable(variable: "RUN_ENV", value: "run_value", enabled: true)
let launchArg = XCScheme.CommandLineArguments.CommandLineArgument(name: "run_arg", enabled: true)
let envVar = XCScheme.EnvironmentVariable(
variable: "RUN_ENV", value: "run_value", enabled: true
)
let launchArg = XCScheme.CommandLineArguments.CommandLineArgument(
name: "run_arg", enabled: true
)
let element = runnable.xmlElement()
let launchAction = XCScheme.LaunchAction(
runnable: try .init(element: element),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct BuildSettingsTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Testing
import XcodeGraph
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct ConfigurationMatcherTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct XCConfigurationMapperTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXBuildRuleMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct DependencyMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Path
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct PBXTargetMapperTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Testing
import XcodeMetadata
import XcodeProj
@testable import XcodeGraph
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct TargetDependencyExtensionsTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PathKit
import Testing
import XcodeGraph
import XcodeProj
@testable import XcodeProjMapper
@testable import XcodeGraphMapper

@Suite
struct XCWorkspaceMapperTests {
Expand Down
Loading
Loading