Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Config setting presets can now also be loaded from the main bundle when bundling XcodeGenKit #1135 @SofteqDG
- Added ability to generate multiple projects in one XcodeGen launch #1270 @skofgar
- Use memoization during recursive SpecFiles creation. This provides a drastic performance boost with lots of recursive includes #1275 @ma-oli
- Added `--render-markdowns` command flag to generate the `.xcodesamplecode.plist` inside the project container and let Xcode render the markdown files with `md` extension.

### Fixed

Expand Down
13 changes: 13 additions & 0 deletions Sources/XcodeGenCLI/Commands/GenerateCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class GenerateCommand: ProjectCommand {

@Flag("--only-plists", description: "Generate only plist files")
var onlyPlists: Bool

@Flag("--render-markdowns", description: "Render markdown files with `.md` extension")
var renderMarkdowns: Bool

init(version: Version) {
super.init(version: version,
Expand Down Expand Up @@ -115,6 +118,16 @@ class GenerateCommand: ProjectCommand {
} catch {
throw GenerationError.writingError(error)
}

// add markdown renderer if needed
if renderMarkdowns {
do {
try fileWriter.writeMarkdownRendererPlist()
success("Xcode markdown rendering enabled")
} catch {
throw GenerationError.writingError(error)
}
}

// write cache
if let cacheFile = cacheFile {
Expand Down
5 changes: 5 additions & 0 deletions Sources/XcodeGenKit/FileWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class FileWriter {
}
}
}

public func writeMarkdownRendererPlist() throws {
let path = project.defaultProjectPath + ".xcodesamplecode.plist"
try writePlist([:], path: path.string)
}

private func writePlist(_ plist: [String: Any], path: String) throws {
let path = project.basePath + path
Expand Down