File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,8 @@ enum TemplateCLI {
2626 try output. write (
2727 content: """
2828 ---
29- You can add custom templates in \( Path . appSupportTemplates) .
30- You can also specify templates by path using `templatePath` instead of `templateName`.
31- For more information, see the documentation on GitHub.
29+ You can also specify custom templates by path, using `templatePath` instead of `templateName`.
30+ For more information, see the documentation on GitHub or use `swiftgen template doc`.
3231 """
3332 )
3433 }
@@ -86,8 +85,8 @@ private extension TemplateCLI {
8685 templates ( in: path + parser. templateFolder) . map { " - \( $0. lastComponentWithoutExtension) " }
8786 }
8887 var lines = [ " \( parser. name) : " ]
89- lines. append ( " custom: " )
90- lines. append ( contentsOf: parserTemplates ( in: Path . appSupportTemplates ) )
88+ lines. append ( " custom (deprecated) : " )
89+ lines. append ( contentsOf: parserTemplates ( in: Path . deprecatedAppSupportTemplates ) )
9190 lines. append ( " bundled: " )
9291 lines. append ( contentsOf: parserTemplates ( in: Path . bundledTemplates) )
9392 return lines. joined ( separator: " \n " )
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ extension Path {
2020 return binaryPath
2121 } ( )
2222
23- static let applicationSupport : Path = {
23+ // Deprecated: Remove this in SwiftGen 7.0
24+ static let deprecatedApplicationSupport : Path = {
2425 let paths = NSSearchPathForDirectoriesInDomains (
2526 . applicationSupportDirectory,
2627 . userDomainMask,
@@ -32,7 +33,8 @@ extension Path {
3233 return Path ( path)
3334 } ( )
3435
35- static let appSupportTemplates = Path . applicationSupport + " SwiftGen/templates "
36+ // Deprecated: Remove this in SwiftGen 7.0
37+ static let deprecatedAppSupportTemplates = Path . deprecatedApplicationSupport + " SwiftGen/templates "
3638 static let bundledTemplates = binary. parent ( ) + templatesRelativePath
3739
3840 // MARK: Private
Original file line number Diff line number Diff line change @@ -45,8 +45,18 @@ enum TemplateRef: Equatable {
4545 func resolvePath( forParser parser: ParserCLI ) throws -> Path {
4646 switch self {
4747 case . name( let templateShortName) :
48- var path = Path . appSupportTemplates + parser. templateFolder + " \( templateShortName) .stencil "
49- if !path. isFile {
48+ var path = Path . deprecatedAppSupportTemplates + parser. templateFolder + " \( templateShortName) .stencil "
49+ if path. isFile {
50+ logMessage (
51+ . warning,
52+ """
53+ Refering templates in Application Support by name will be deprecated in SwiftGen 7.0.
54+ For custom templates, please use `templatePath` instead of `templateName` to point to them.
55+ We also recommend you move your custom templates from \( Path . deprecatedAppSupportTemplates)
56+ to your project's folder so that your project is able to run independently on all machines.
57+ """
58+ )
59+ } else {
5060 path = Path . bundledTemplates + parser. templateFolder + " \( templateShortName) .stencil "
5161 }
5262 guard path. isFile else {
You can’t perform that action at this time.
0 commit comments