File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,11 @@ The tool creates a `generated-sources.json` and a `setup-offline.sh` file in the
3838
3939See the quickstart project for a complete example.
4040
41+ ### Suffix
42+
43+ Optionally, add a third argument with a suffix for the file names. This can be helpful if multiple Swift packages are present.
44+ ```
45+ swift flatpak-spm-generator.swift ./quickstart ./quickstart quickstart
46+ ```
47+
48+ The tool then creates a ` generated-sources-<suffix>.json ` and a ` setup-offline-<suffix>.sh ` file in the directory of the Flatpak manifest.
Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ let arguments = CommandLine.arguments
66let path = arguments. count > 1 ? arguments [ 1 ] : " . "
77// The path to the directory containing the Flatpak manifest.
88let pathToManifest = arguments. count > 2 ? arguments [ 2 ] : " . "
9+ /// An optional suffix.
10+ var suffix = arguments. count > 3 ? arguments [ 3 ] : " "
11+
12+ if !suffix. isEmpty {
13+ suffix = " - " + suffix
14+ }
915
1016// Build the Swift package to get a complete list of dependencies under "{path}/.build/workspace-state.json".
1117let task = Process ( )
@@ -60,17 +66,17 @@ content.append("""
6066
6167 {
6268 " type " : " file " ,
63- " path " : " setup-offline.sh "
69+ " path " : " setup-offline \( suffix ) .sh "
6470 }
6571""" )
6672content. append ( " \n ] " )
6773
6874// Save the files.
69- let pathToSetup = " \( pathToManifest) /setup-offline.sh "
75+ let pathToSetup = " \( pathToManifest) /setup-offline \( suffix ) .sh "
7076
7177let contentData = content. data ( using: . utf8)
7278let shellContentData = shellContent. data ( using: . utf8)
73- try contentData? . write ( to: . init( fileURLWithPath: " \( pathToManifest) /generated-sources.json " ) )
79+ try contentData? . write ( to: . init( fileURLWithPath: " \( pathToManifest) /generated-sources \( suffix ) .json " ) )
7480try shellContentData? . write ( to: . init( fileURLWithPath: pathToSetup) )
7581
7682let executable = Process ( )
You can’t perform that action at this time.
0 commit comments