Fix lib caching
parent
f2ef9335c1
commit
63088a2621
|
|
@ -655,14 +655,14 @@ class SetupRemoteRepository {
|
||||||
static libraryCaching(libraryCacheFolder) {
|
static libraryCaching(libraryCacheFolder) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
cloud_runner_logger_1.default.logCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
cloud_runner_logger_1.default.logCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
||||||
if (!fs_1.default.existsSync(libraryCacheFolder)) {
|
|
||||||
fs_1.default.mkdirSync(libraryCacheFolder);
|
|
||||||
}
|
|
||||||
cloud_runner_logger_1.default.logCli(`Library Caching`);
|
cloud_runner_logger_1.default.logCli(`Library Caching`);
|
||||||
//if the unity git project has included the library delete it and echo a warning
|
//if the unity git project has included the library delete it and echo a warning
|
||||||
if (fs_1.default.existsSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull)) {
|
if (fs_1.default.existsSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull)) {
|
||||||
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull, { recursive: true });
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull, { recursive: true });
|
||||||
cloud_runner_logger_1.default.logCli(`!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)`);
|
cloud_runner_logger_1.default.logCli(`!Warning!: The Unity library was included in the git repository`);
|
||||||
|
}
|
||||||
|
if (!fs_1.default.existsSync(libraryCacheFolder)) {
|
||||||
|
fs_1.default.mkdirSync(libraryCacheFolder);
|
||||||
}
|
}
|
||||||
//Restore library cache
|
//Restore library cache
|
||||||
const latestLibraryCacheFile = yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
const latestLibraryCacheFile = yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
||||||
|
|
@ -673,6 +673,13 @@ class SetupRemoteRepository {
|
||||||
cloud_runner_logger_1.default.logCli(`Library cache exists`);
|
cloud_runner_logger_1.default.logCli(`Library cache exists`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cloud_runner_logger_1.default.logCli(`Library cache doesn't exist`);
|
||||||
|
if (latestLibraryCacheFile !== ``) {
|
||||||
|
yield remote_client_system_1.RemoteClientSystem.Run(`tree`);
|
||||||
|
throw new Error(`Failed to get library cache, but cache hit was found (${latestLibraryCacheFile})`);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static createLFSHashFiles() {
|
static createLFSHashFiles() {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -118,16 +118,14 @@ export class SetupRemoteRepository {
|
||||||
|
|
||||||
private static async libraryCaching(libraryCacheFolder: string) {
|
private static async libraryCaching(libraryCacheFolder: string) {
|
||||||
CloudRunnerLogger.logCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
CloudRunnerLogger.logCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
||||||
if (!fs.existsSync(libraryCacheFolder)) {
|
|
||||||
fs.mkdirSync(libraryCacheFolder);
|
|
||||||
}
|
|
||||||
CloudRunnerLogger.logCli(`Library Caching`);
|
CloudRunnerLogger.logCli(`Library Caching`);
|
||||||
//if the unity git project has included the library delete it and echo a warning
|
//if the unity git project has included the library delete it and echo a warning
|
||||||
if (fs.existsSync(CloudRunnerState.libraryFolderFull)) {
|
if (fs.existsSync(CloudRunnerState.libraryFolderFull)) {
|
||||||
fs.rmdirSync(CloudRunnerState.libraryFolderFull, { recursive: true });
|
fs.rmdirSync(CloudRunnerState.libraryFolderFull, { recursive: true });
|
||||||
CloudRunnerLogger.logCli(
|
CloudRunnerLogger.logCli(`!Warning!: The Unity library was included in the git repository`);
|
||||||
`!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)`,
|
}
|
||||||
);
|
if (!fs.existsSync(libraryCacheFolder)) {
|
||||||
|
fs.mkdirSync(libraryCacheFolder);
|
||||||
}
|
}
|
||||||
//Restore library cache
|
//Restore library cache
|
||||||
const latestLibraryCacheFile = await RemoteClientSystem.Run(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
const latestLibraryCacheFile = await RemoteClientSystem.Run(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
||||||
|
|
@ -137,6 +135,12 @@ export class SetupRemoteRepository {
|
||||||
if (fs.existsSync(latestCacheFilePath)) {
|
if (fs.existsSync(latestCacheFilePath)) {
|
||||||
CloudRunnerLogger.logCli(`Library cache exists`);
|
CloudRunnerLogger.logCli(`Library cache exists`);
|
||||||
await RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
|
await RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
|
||||||
|
} else {
|
||||||
|
CloudRunnerLogger.logCli(`Library cache doesn't exist`);
|
||||||
|
if (latestLibraryCacheFile !== ``) {
|
||||||
|
await RemoteClientSystem.Run(`tree`);
|
||||||
|
throw new Error(`Failed to get library cache, but cache hit was found (${latestLibraryCacheFile})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue