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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | package Torello.Java.Build;
import Torello.Java.FileRW;
import Torello.Java.StorageWriter;
import Torello.Java.StringParse;
import Torello.Java.GSUTIL;
import Torello.Java.OSResponse;
import java.io.IOException;
/**
* This is the sixth 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
* {@code '.tar'} and {@code '.jar'} 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=S06_SYNC_TAR_JAR>
*/
@Torello.JavaDoc.StaticFunctional
public class S06_SyncTarJar
{
// Completely irrelevant, and the 'private' modifier keeps it off of JavaDoc
private S06_SyncTarJar() { }
public static void sync(final BuilderRecord brec) throws IOException
{
brec.timers.startStage06();
Printing.startStep(6);
/*
final String CODE_DRIVE_BACKUP_FILE = (brec.BACKUP_TAR_FILE_GCS_DIR == null)
? null
: brec.BACKUP_TAR_FILE_GCS_DIR +
StringParse.ymDateStr('/', true) + '/' +
StringParse.dateStr('-') + '-' + brec.TAR_FILE;
*/
// final String CLOUD_JAR_DIR = brec.cli.GCS_DIR + "jar/";
// true ==> send to System.out
StorageWriter sw = new StorageWriter(true);
// Uses Shell-Contructor:
// (outputAppendable, commandStrAppendable, standardOutput, errorOutput)
//
// GSUTIL gsutil = new GSUTIL(sw, sw, null, null);
brec.cloudSync.initStage(sw, sw);
// These are three of the four ARCHIVE-FILES that have been created.
// One of them is 'too-big' for GSUTIL to handle, and must be copied over separately, or
// the whole program will freeze and hang for anywhere between 30 seconds and 10 minutes...
//
// String[] cpArr = { brec.JAVADOC_TAR_FILE, brec.JAR_FILE };
// OSResponse osr = gsutil.CP(cpArr, GCS_JAR_DIR);
OSResponse osr = brec.cloudSync.copyJDTarAndJarToCloud();
Util.HALT_ON_ERROR(osr);
sw.println();
// if (brec.RUN_MAKE_PUBLIC)
if (brec.cloudSync.shouldRunMakePublic)
{
// osr = gsutil.MP
// (GCS_JAR_DIR + brec.JAR_FILE, GCS_JAR_DIR + brec.JAVADOC_TAR_FILE);
osr = brec.cloudSync.makeJDTarAndJarPublic();
Util.HALT_ON_ERROR(osr);
sw.println();
}
// Drive backup page
// if (CODE_DRIVE_BACKUP_FILE != null)
if (brec.cloudSync.shouldSyncMainTarGzFile)
{
// osr = gsutil.CP(brec.TAR_FILE, CODE_DRIVE_BACKUP_FILE);
osr = brec.cloudSync.backupMainTarGzFile();
Util.HALT_ON_ERROR(osr);
sw.println();
}
// Move Archive files to the local BASH/UNIX - ~/jar/ directory.
if (brec.JAR_FILE_NAME != null)
{
sw.println(
"Moving File [" + brec.JAR_FILE + "] to " +
"[" + brec.JAR_FILE_NAME + "]\n"
);
FileRW.moveFile(brec.JAR_FILE, brec.JAR_FILE_NAME, false);
sw.println();
}
// Get rid of these files. These were saved into the local 'jar/' directory, now,
// just get rid of them. they are never used.
sw.println(
"Deleting File [" + brec.TAR_FILE + "]\n" +
"Deleting File [" + brec.JAVADOC_TAR_FILE + "]\n"
);
FileRW.deleteFiles(brec.TAR_FILE, brec.JAVADOC_TAR_FILE);
sw.println();
brec.logs.write_S06_LOG(sw.getString());
brec.cloudSync.endStage();
brec.timers.endStage06();
}
}
|