Skip to content

Commit

Permalink
Fix #510 - Part 4 - Fix up Onivim2.App/Contents/MacOS directory (#543)
Browse files Browse the repository at this point in the history
* Fix up macos directory layout, use symlinks

* Use symlinks for resource files

* Add healthcheck to verify font is present

* Fix healthcheck

* Fix HealthCheck

* Fix formatting, add additional logging for health checks

* Fix bug with hanging setup.json symlink
  • Loading branch information
bryphe authored Aug 1, 2019
1 parent 4987bd7 commit dd0eae0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions scripts/osx/validate-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ ONI2_DEBUG=1 ./_unpacked/Onivim2.App/Contents/MacOS/Oni2 -f --checkhealth
echo "** Validating DMG **"
rm -rf _unpacked
mkdir _unpacked
echo " - Attaching dmg...."
sudo hdiutil attach $SYSTEM_ARTIFACTSDIRECTORY/Release_Darwin/Onivim2-$SHORT_COMMIT_ID.dmg
echo " - DMG attached! Copying..."
cp -rf "/Volumes/Onivim 2"/*.App _unpacked
echo " - Copy completed. Detaching DMG..."
sudo hdiutil detach "/Volumes/Onivim 2"
echo "DMG detached - running health check"
ONI2_DEBUG=1 ./_unpacked/Onivim2.App/Contents/MacOS/Oni2 -f --checkhealth
25 changes: 24 additions & 1 deletion scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ if (process.platform == "linux") {
const executables = [
"Oni2",
"Oni2_editor",
"rg",
"node"
];

const appDirectory = path.join(releaseDirectory, "Onivim2.App");
Expand Down Expand Up @@ -99,11 +101,33 @@ if (process.platform == "linux") {

// Copy bins over
copy(curBin, binaryDirectory);

copy(extensionsSourceDirectory, resourcesDirectory);
copy(textmateServiceSourceDirectory, resourcesDirectory);
copy(camomilePath, resourcesDirectory);
copy(getRipgrepPath(), path.join(binaryDirectory, "rg"));
copy(getNodePath(), path.join(binaryDirectory, "node"));

// Remove setup.json prior to remapping bundled files,
// so it doesn't get symlinked.
fs.removeSync(path.join(binaryDirectory, "setup.json"));

// We need to remap the binary files - we end up with font files, images, and configuration files in the bin folder
// These should be in 'Resources' instead. Move everything that is _not_ a binary out, and symlink back in.
const filesToBeMoved = fs.readdirSync(binaryDirectory).filter((f) => {
console.log("- Checking executable: " + f);
return executables.indexOf(f) == -1;
});

filesToBeMoved.forEach((file) => {
const fileSrc = path.join(binaryDirectory, file);
const fileDest = path.join(resourcesDirectory, file);
console.log(`Moving file from ${fileSrc} to ${fileDest}.`);
fs.moveSync(fileSrc, fileDest);
const symlinkDest = path.join("../Resources", file);
console.log(`Symlinking ${symlinkDest} -> ${fileSrc}`);
fs.ensureSymlink(symlinkDest, fileSrc);
});

fs.copySync(eulaFile, path.join(resourcesDirectory, "EULA.md"));
fs.copySync(thirdPartyFile, path.join(resourcesDirectory, "ThirdPartyLicenses.txt"));
Expand Down Expand Up @@ -151,7 +175,6 @@ if (process.platform == "linux") {
]
};
fs.writeFileSync(dmgJsonPath, JSON.stringify(dmgJson));
fs.removeSync(path.join(binaryDirectory, "setup.json"));
} else {
const platformReleaseDirectory = path.join(releaseDirectory, process.platform);
const extensionsDestDirectory = path.join(platformReleaseDirectory, "extensions");
Expand Down
5 changes: 5 additions & 0 deletions src/editor/Core/HealthCheck.re
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ let checks = [
"Verify bundled extensions exists",
(setup: Setup.t) => Sys.is_directory(setup.bundledExtensionsPath),
),
(
"Verify bundled font exists",
_ =>
Sys.file_exists(Utility.executingDirectory ++ "FiraCode-Regular.ttf"),
),
];

let run = () => {
Expand Down

0 comments on commit dd0eae0

Please sign in to comment.