Skip to content

Commit

Permalink
Merge pull request #56 from FelixHerrmann/fix/plugin-derived-data-path
Browse files Browse the repository at this point in the history
Fix Plugin Derived Data Path
  • Loading branch information
FelixHerrmann authored Jun 7, 2023
2 parents 83f7644 + d6255d0 commit 1b1a3fe
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,35 @@ extension SwiftPackageListJSONPlugin: XcodeBuildToolPlugin {
let executable = try context.tool(named: "swift-package-list").path
let outputPath = context.pluginWorkDirectory
let fileType = "json"
let derivedDataPath = context.derivedDataDirectory
return [
.buildCommand(
displayName: "SwiftPackageListPlugin",
executable: executable,
arguments: ["generate", projectPath, "--output-path", outputPath, "--file-type", fileType, "--requires-license"],
arguments: [
"generate",
projectPath,
"--derived-data-path", derivedDataPath,
"--output-path", outputPath,
"--file-type", fileType,
"--requires-license"
],
outputFiles: [outputPath.appending("package-list.json")]
)
]
}
}

extension XcodePluginContext {
var derivedDataDirectory: Path {
var path = pluginWorkDirectory
while path.lastComponent != "DerivedData" {
guard path.string != "/" else {
return Path("\(NSHomeDirectory())/Library/Developer/Xcode/DerivedData")
}
path = path.removingLastComponent()
}
return path
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,35 @@ extension SwiftPackageListPDFPlugin: XcodeBuildToolPlugin {
let executable = try context.tool(named: "swift-package-list").path
let outputPath = context.pluginWorkDirectory
let fileType = "pdf"
let derivedDataPath = context.derivedDataDirectory
return [
.buildCommand(
displayName: "SwiftPackageListPlugin",
executable: executable,
arguments: ["generate", projectPath, "--output-path", outputPath, "--file-type", fileType, "--requires-license"],
arguments: [
"generate",
projectPath,
"--derived-data-path", derivedDataPath,
"--output-path", outputPath,
"--file-type", fileType,
"--requires-license"
],
outputFiles: [outputPath.appending("Acknowledgements.pdf")]
)
]
}
}

extension XcodePluginContext {
var derivedDataDirectory: Path {
var path = pluginWorkDirectory
while path.lastComponent != "DerivedData" {
guard path.string != "/" else {
return Path("\(NSHomeDirectory())/Library/Developer/Xcode/DerivedData")
}
path = path.removingLastComponent()
}
return path
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,35 @@ extension SwiftPackageListPropertyListPlugin: XcodeBuildToolPlugin {
let executable = try context.tool(named: "swift-package-list").path
let outputPath = context.pluginWorkDirectory
let fileType = "plist"
let derivedDataPath = context.derivedDataDirectory
return [
.buildCommand(
displayName: "SwiftPackageListPlugin",
executable: executable,
arguments: ["generate", projectPath, "--output-path", outputPath, "--file-type", fileType, "--requires-license"],
arguments: [
"generate",
projectPath,
"--derived-data-path", derivedDataPath,
"--output-path", outputPath,
"--file-type", fileType,
"--requires-license"
],
outputFiles: [outputPath.appending("package-list.plist")]
)
]
}
}

extension XcodePluginContext {
var derivedDataDirectory: Path {
var path = pluginWorkDirectory
while path.lastComponent != "DerivedData" {
guard path.string != "/" else {
return Path("\(NSHomeDirectory())/Library/Developer/Xcode/DerivedData")
}
path = path.removingLastComponent()
}
return path
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,35 @@ extension SwiftPackageListSettingsBundlePlugin: XcodeBuildToolPlugin {
let executable = try context.tool(named: "swift-package-list").path
let outputPath = context.pluginWorkDirectory
let fileType = "settings-bundle"
let derivedDataPath = context.derivedDataDirectory
return [
.buildCommand(
displayName: "SwiftPackageListPlugin",
executable: executable,
arguments: ["generate", projectPath, "--output-path", outputPath, "--file-type", fileType, "--requires-license"],
arguments: [
"generate",
projectPath,
"--derived-data-path", derivedDataPath,
"--output-path", outputPath,
"--file-type", fileType,
"--requires-license"
],
outputFiles: [outputPath.appending("Settings.bundle")]
)
]
}
}

extension XcodePluginContext {
var derivedDataDirectory: Path {
var path = pluginWorkDirectory
while path.lastComponent != "DerivedData" {
guard path.string != "/" else {
return Path("\(NSHomeDirectory())/Library/Developer/Xcode/DerivedData")
}
path = path.removingLastComponent()
}
return path
}
}
#endif

0 comments on commit 1b1a3fe

Please sign in to comment.