Skip to content

Commit

Permalink
Updates scripting to remove unix-versioning for zml
Browse files Browse the repository at this point in the history
  • Loading branch information
colbysparks committed Nov 18, 2024
1 parent 5a4b45a commit 3967833
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 7 deletions.
37 changes: 35 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,46 @@ const exec = (command) => new Promise((resolve, reject) => {
child.stderr?.pipe(process.stderr);
});

const remove_and_rename = async (dirs, removePattern, renamePattern, renameStr) => {
dirs.forEach(async dir => {
const files = await fsp.readdir(dir);

for (const file of files) {
if (file.match(removePattern)) {
await fsp.rm(`${dir}/${file}`);
}
}

// remove version number from shared library file
const renameFile = files.find(file => file.match(renamePattern));
if (renameFile) {
await fsp.rename(`${dir}/${renameFile}`, `${dir}/${renameStr}`);
} else {
throw new Error(`Shared library matching ${renamePattern} not found in dir: ${dir}`);
}
});
}

export const update_support_package = async () => {
const localDestination = `zaberMotionSupport/ZaberMotionCppSupport-${ZML_VERSION}.zip`;
const supportPath = 'zaberMotionSupport/ZaberMotionCppSupport'
const localDestination = `${supportPath}-${ZML_VERSION}.zip`;

await fsp.rm('zaberMotionSupport/ZaberMotionCppSupport', { recursive: true }).catch(() => false);
await fsp.rm(supportPath, { recursive: true }).catch(() => false);
await exec(`aws s3 cp s3://026596715358-us-west-2-production--downloads/downloads/ZML/CPP/${ZML_VERSION}/ZaberMotionCppSupport-${ZML_VERSION}.zip ${localDestination}`);
await exec(`unzip ${localDestination} -d zaberMotionSupport`);
await fsp.rm(localDestination);

// remove unix-style versioning and symlinks for macOS and linux shared libs
if (os.platform() === 'darwin' || os.platform() === 'linux') {
const dirs = await fsp.readdir(`${supportPath}/lib`);
const linuxDirs = dirs.filter(dir => dir.match(/linux.*/)).map(dir => `${supportPath}/lib/${dir}`);
const darwinDirs = dirs.filter(dir => dir.match(/darwin.*/)).map(dir => `${supportPath}/lib/${dir}`);

await remove_and_rename(linuxDirs, /libzaber-motion\.so(\.\d+\.\d+)?$/,
/libzaber-motion\.so\.\d+\.\d+\.\d+/, 'libzaber-motion.so');
await remove_and_rename(darwinDirs, /libzaber-motion(\.\d+\.\d+)?\.dylib/,
/libzaber-motion\.\d+\.\d+\.\d+\.dylib/, 'libzaber-motion.dylib');
}
}

const update_release_for_module = async modulePath => {
Expand Down
Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

0 comments on commit 3967833

Please sign in to comment.