diff --git a/gulpfile.js b/gulpfile.js index 43ac0ae..014b790 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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 => { diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.0.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.0.dylib deleted file mode 100755 index 3894eda..0000000 Binary files a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.0.dylib and /dev/null differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.dylib deleted file mode 120000 index 1e785b0..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.7.2.dylib +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.7.2.0.dylib \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib deleted file mode 120000 index bde9114..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.7.2.dylib \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib new file mode 100755 index 0000000..3894eda Binary files /dev/null and b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_arm64/libzaber-motion.dylib differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.0.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.0.dylib deleted file mode 100755 index a09ad0c..0000000 Binary files a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.0.dylib and /dev/null differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.dylib deleted file mode 120000 index 1e785b0..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.7.2.dylib +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.7.2.0.dylib \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib deleted file mode 120000 index bde9114..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.7.2.dylib \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib new file mode 100755 index 0000000..a09ad0c Binary files /dev/null and b/zaberMotionSupport/ZaberMotionCppSupport/lib/darwin_x64/libzaber-motion.dylib differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so deleted file mode 120000 index 8a39b51..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so new file mode 100755 index 0000000..d444023 Binary files /dev/null and b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2 deleted file mode 120000 index 373bdc7..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2 +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2.0 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2.0 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2.0 deleted file mode 100755 index d444023..0000000 Binary files a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm/libzaber-motion.so.7.2.0 and /dev/null differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so deleted file mode 120000 index 8a39b51..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so new file mode 100755 index 0000000..c566621 Binary files /dev/null and b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2 deleted file mode 120000 index 373bdc7..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2 +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2.0 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2.0 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2.0 deleted file mode 100755 index c566621..0000000 Binary files a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_arm64/libzaber-motion.so.7.2.0 and /dev/null differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so deleted file mode 120000 index 8a39b51..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so new file mode 100755 index 0000000..b2e5b98 Binary files /dev/null and b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so differ diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2 deleted file mode 120000 index 373bdc7..0000000 --- a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2 +++ /dev/null @@ -1 +0,0 @@ -libzaber-motion.so.7.2.0 \ No newline at end of file diff --git a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2.0 b/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2.0 deleted file mode 100755 index b2e5b98..0000000 Binary files a/zaberMotionSupport/ZaberMotionCppSupport/lib/linux_x64/libzaber-motion.so.7.2.0 and /dev/null differ