@@ -7,7 +7,7 @@ import TecoCodeGeneratorCommons
77@main
88struct TecoPackageGenerator : ParsableCommand {
99 @Option ( name: . shortAndLong, completion: . directory, transform: URL . init ( fileURLWithPath: ) )
10- var serviceManifestDir : URL
10+ var modelDir : URL
1111
1212 @Option ( name: . shortAndLong, completion: . directory, transform: URL . init ( fileURLWithPath: ) )
1313 var packageDir : URL
@@ -21,7 +21,10 @@ struct TecoPackageGenerator: ParsableCommand {
2121 func run( ) throws {
2222 var targets : [ ( service: String , version: String ) ] = [ ]
2323
24- let serviceDirectories = try FileManager . default. contentsOfDirectory ( at: serviceManifestDir, includingPropertiesForKeys: nil )
24+ let serviceDirectories = try FileManager . default. contentsOfDirectory (
25+ at: modelDir. appendingPathComponent ( " services " ) ,
26+ includingPropertiesForKeys: nil
27+ )
2528
2629 if serviceGenerator != nil {
2730 try FileManager . default. removeItem ( at: packageDir. appendingPathComponent ( " Sources " ) )
@@ -50,9 +53,14 @@ struct TecoPackageGenerator: ParsableCommand {
5053 process. executableURL = serviceGenerator
5154 process. arguments = [
5255 " --source= \( manifestJSON. path) " ,
53- " --error-file= \( serviceManifestDir. deletingLastPathComponent ( ) . path) /error-codes.json " ,
5456 " --output-dir= \( sourceDirectory. path) " ,
5557 ]
58+
59+ let errorFilePath = modelDir. appendingPathComponent ( " error-codes.json " )
60+ if FileManager ( ) . isReadableFile ( atPath: errorFilePath. path) {
61+ process. arguments? . append ( " --error-file= \( errorFilePath. path) " )
62+ }
63+
5664 process. terminationHandler = { process in
5765 if process. terminationStatus != 0 {
5866 print ( process. arguments ?? [ ] , process. terminationReason)
0 commit comments