<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">I’m trying to write my first Portfile for the </span><a href="http://github.com/apple/swift-format" class="">swift-format tool</a><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">.</span><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">I’m referencing the <a href="https://github.com/macports/macports-ports/blob/master/devel/xcodes/Portfile" class="">xcodes port</a> as an example of a Swift port.</div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">The problem here is that the version of the tool must be synced with the local swift version.</div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">For example, release 0.50400.0 is compatible with Swift 5.4, 0.50300.0 is compatible with Swift 5.3, etc…</div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">My questions:</div><div class="" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><ol class=""><li class="">Is it right to give if conditions on the swift version to differentiate versions? Would executing different version statements on every if branch be sufficient?</li><li class="">If 1. is correct, is there a variable for me to test with?</li><li class="">If 1. is incorrect, how should I provide different versions? Would just providing the version only for the latest swift the right choice?</li></ol><div class="">Thanks.</div></div></body></html>