1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | package Torello.Java.Build; import Torello.Java.GSUTIL; import Torello.Java.Shell; import Torello.Java.OSResponse; import Torello.Java.UnreachableError; import Torello.JDUInternal.Parse.Java.JSCF.JavaSourceCodeFile; import java.io.IOException; import java.io.File; /** * This is the seventh Build-Stage, and it is part of the synchronization of a project with Google * Cloud Platform Stroage Buckets. This class relies heavily on the GCP Shell-Command * {@code 'gsutil'} and it's Java implementation - {@link GSUTIL Torello.Java.GSUTIL}. * * <BR /><BR />This class' synchronization-efforts entail copying the local / File-System * Log-Files onto the (User-Specified) Google Cloud Server Storage-Bucket. * * <EMBED CLASS=external-html DATA-FILE-ID=STAGE_PRIVATE_NOTE> * <EMBED CLASS='external-html' DATA-FILE-ID=S07_SYNC_LOGS> */ @Torello.JavaDoc.StaticFunctional public class S07_SyncLogs { // Completely irrelevant, and the 'private' modifier keeps it off of JavaDoc private S07_SyncLogs() { } // ******************************************************************************************** // ******************************************************************************************** // Copies The Log Files to GCS // ******************************************************************************************** // ******************************************************************************************** public static void sync(final BuilderRecord brec) throws IOException { brec.timers.startStage07(); Printing.startStep(7); // final String CLOUD_LOG_DIR = brec.cli.GCS_DIR + "logs/"; // // Uses Shell-Contructor: // (outputAppendable, commandStrAppendable, standardOutput, errorOutput) // GSUTIL gsutil = new GSUTIL(System.out, System.out, null, null); brec.cloudSync.initStageLogSync(); // OSResponse osr = gsutil.CP(brec.logs.LOG_DIR + '*', GCS_LOG_DIR); OSResponse osr = brec.cloudSync.copyLogDirToCloud(); Util.HALT_ON_ERROR(osr); System.out.println(); // osr = gsutil.CONTENT_TYPE(GCS_LOG_DIR + "*.html", GSUTIL.SCT_HTML_UTF8); osr = brec.cloudSync.setCloudLogsContentType(); Util.HALT_ON_ERROR(osr); System.out.println(); // JavaHTML.torello.directory has bucket-level public access // if (brec.RUN_MAKE_PUBLIC) if (brec.cloudSync.shouldRunMakePublic) { // osr = gsutil.MP(CLOUD_LOG_DIR + "*"); osr = brec.cloudSync.makeLogsPublic(); Util.HALT_ON_ERROR(osr); System.out.println(); } brec.cloudSync.endStage(); brec.timers.endStage07(); } } |