Skip to content

Commit

Permalink
refactor: include shared stops file in deployment bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Aug 3, 2023
1 parent 9613395 commit 461deef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,10 @@ public OtpRunnerManifest createAndUploadManifestAndConfigs(boolean graphAlreadyB
}
}

// upload shared stops file
String sharedStopsConfig = this.deployment.parentProject().sharedStopsConfig;
if (sharedStopsConfig != null) addStringContentsAsBaseFolderDownload(manifest, "shared_stops.csv", sharedStopsConfig);

// upload otp-runner manifest to s3
try {
ObjectMapper mapper = new ObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void validate() {
}

// Check for SS_03 (stop_id referenced doesn't exist)
// TODO: CHECK FEED ID
// TODO: CHECK FEED ID (adjust the pre-build constructor to include feed_id)
if (!stopIds.contains(stopId)) {
registerError(NewGTFSError.forFeed(NewGTFSErrorType.SHARED_STOP_GROUP_ENTITY_DOES_NOT_EXIST, stopId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,16 @@ public void dump (File output, boolean includeManifest, boolean includeOsm, bool
out.closeEntry();
}
}

// Include shared_stops.csv, if present
if (parentProject().sharedStopsConfig != null) {
byte[] sharedStopsConfigAsBytes = parentProject().sharedStopsConfig.getBytes(StandardCharsets.UTF_8);
ZipEntry sharedStopsEntry = new ZipEntry("shared_stops.csv");
out.putNextEntry(sharedStopsEntry);
out.write(sharedStopsConfigAsBytes);
out.closeEntry();
}

// Finally close the zip output stream. The dump file is now complete.
out.close();
}
Expand Down

0 comments on commit 461deef

Please sign in to comment.