Skip to content

Commit

Permalink
Merge pull request #1316 from input-output-hk/fix/ddw-544-fix-daedalu…
Browse files Browse the repository at this point in the history
…s-state-directory-on-staging-and-testnet-builds

[DDW-544] Fix 'Daedalus' state directory on 'Staging' and 'Testnet'
  • Loading branch information
nikolaglumac authored Mar 6, 2019
2 parents 487cac5 + dcda92f commit 4efdf14
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Changelog

### Fixes

- Fixed "Daedalus" state directory on "Staging" and "Testnet" builds ([PR 1316](https://github.com/input-output-hk/daedalus/pull/1316))
- Fixed Dev-Tools initialization in development mode ([PR 1302](https://github.com/input-output-hk/daedalus/pull/1302))
- Fixed text selection issues (disabled drag and drop of selected text and enabled unselect option) ([PR 1289](https://github.com/input-output-hk/daedalus/pull/1289))
- Disabled the default behavior of the context menu following a right click for non-input elements ([PR 1281](https://github.com/input-output-hk/daedalus/pull/1281))
Expand Down
15 changes: 11 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ let
'';
uninstaller = if (signingKeys != null) then self.signedUninstaller else self.unsignedUninstaller;

windows-installer = pkgs.runCommand "win64-installer-${cluster}" { buildInputs = [ self.daedalus-installer self.nsis pkgs.unzip self.configMutator pkgs.jq self.yaml2json ]; } ''
windows-installer = let
mapping = {
mainnet = "Daedalus";
staging = "Daedalus Staging";
testnet = "Daedalus Testnet";
};
installDir = mapping.${cluster};
in pkgs.runCommand "win64-installer-${cluster}" { buildInputs = [ self.daedalus-installer self.nsis pkgs.unzip self.configMutator pkgs.jq self.yaml2json ]; } ''
mkdir home
export HOME=$(realpath home)
Expand All @@ -164,9 +171,9 @@ let
chmod -R +w installers
cd installers
mkdir -pv ../release/win32-x64/
${if dummyInstaller then "mkdir -pv ../release/win32-x64/Daedalus-win32-x64/resources/app/dist/main/" else "cp -r ${self.rawapp-win64} ../release/win32-x64/Daedalus-win32-x64"}
chmod -R +w ../release/win32-x64/Daedalus-win32-x64
cp -v ${self.fastlist}/bin/fastlist.exe ../release/win32-x64/Daedalus-win32-x64/resources/app/dist/main/fastlist.exe
${if dummyInstaller then ''mkdir -pv "../release/win32-x64/${installDir}-win32-x64/resources/app/dist/main/"'' else ''cp -r ${self.rawapp-win64} "../release/win32-x64/${installDir}-win32-x64"''}
chmod -R +w "../release/win32-x64/${installDir}-win32-x64"
cp -v ${self.fastlist}/bin/fastlist.exe "../release/win32-x64/${installDir}-win32-x64/resources/app/dist/main/fastlist.exe"
ln -s ${./installers/nsis_plugins} nsis_plugins
mkdir dlls
Expand Down
29 changes: 17 additions & 12 deletions installers/common/WindowsInstaller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Prelude ((!!))
import qualified System.IO as IO
import Filesystem.Path (FilePath, (</>))
import Filesystem.Path.CurrentOS (encodeString, fromText)
import Turtle (Shell, Line, ExitCode (..), echo, proc, procs, inproc, shells, testfile, stdout, input, export, sed, strict, format, printf, fp, w, s, (%), need, writeTextFile, die, cp, rm, view, ls)
import Turtle (Shell, Line, ExitCode (..), echo, proc, procs, inproc, shells, testfile, stdout, input, export, sed, strict, format, printf, fp, w, s, (%), need, writeTextFile, die, cp, rm)
import Turtle.Pattern (text, plus, noneOf, star, dot)
import AppVeyor
import qualified Codec.Archive.Zip as Zip
Expand All @@ -36,10 +36,10 @@ import Util



daedalusShortcut :: [Attrib]
daedalusShortcut =
daedalusShortcut :: Text -> [Attrib]
daedalusShortcut installDir =
[ Target "$INSTDIR\\cardano-launcher.exe"
, IconFile "$INSTDIR\\Daedalus.exe"
, IconFile $ fromString $ unpack $ "$INSTDIR\\" <> installDir <> ".exe"
, StartOptions "SW_SHOWMINIMIZED"
, IconIndex 0
]
Expand Down Expand Up @@ -188,15 +188,15 @@ writeInstallerNSIS outName (Version fullVersion') installerConfig clusterName =
file [] "*genesis*.json"
file [] "launcher-config.yaml"
file [Recursive] "dlls\\"
file [Recursive] "..\\release\\win32-x64\\Daedalus-win32-x64\\"
file [Recursive] "..\\release\\win32-x64\\$InstallDir-win32-x64\\"

mapM_ unsafeInject
[ "liteFirewall::AddRule \"$INSTDIR\\cardano-node.exe\" \"Cardano Node\""
, "Pop $0"
, "DetailPrint \"liteFirewall::AddRule: $0\""
]

createShortcut "$DESKTOP\\$InstallDir.lnk" daedalusShortcut
createShortcut "$DESKTOP\\$InstallDir.lnk" (daedalusShortcut $ installDirectory installerConfig)

-- Uninstaller
let
Expand All @@ -220,20 +220,25 @@ writeInstallerNSIS outName (Version fullVersion') installerConfig clusterName =
createDirectory "$SMPROGRAMS/$InstallDir"
createShortcut "$SMPROGRAMS/$InstallDir/Uninstall $InstallDir.lnk"
[Target "$INSTDIR/uninstall.exe", IconFile "$INSTDIR/uninstall.exe", IconIndex 0]
createShortcut "$SMPROGRAMS/$InstallDir/$InstallDir.lnk" daedalusShortcut
createShortcut "$SMPROGRAMS/$InstallDir/$InstallDir.lnk" (daedalusShortcut $ installDirectory installerConfig)
return ()

lshow :: Show a => a -> String
lshow = T.unpack . lshowText

packageFrontend :: Cluster -> InstallerConfig -> IO ()
packageFrontend cluster installerConfig = do
let icon = format ("installers/icons/"%s%"/"%s) (lshowText cluster) (lshowText cluster)
let
icon = format ("installers/icons/"%s%"/"%s) (lshowText cluster) (lshowText cluster)
installDir :: Text
installDir = installDirectory installerConfig
releaseDir :: Text
releaseDir = "../release/win32-x64/" <> (installDirectory installerConfig) <> "-win32-x64"
export "NODE_ENV" "production"
rewritePackageJson "../package.json" installDir
echo "running NPM"
shells ("npm run package -- --icon " <> icon) empty
rewritePackageJson "../release/win32-x64/Daedalus-win32-x64/resources/app/package.json" (installDirectory installerConfig)
view (ls "../release/win32-x64/Daedalus-win32-x64/resources/app/dist")
cp "../node_modules/ps-list/fastlist.exe" "../release/win32-x64/Daedalus-win32-x64/resources/app/dist/main/fastlist.exe"
cp "../node_modules/ps-list/fastlist.exe" $ fromString $ unpack $ releaseDir <> "/resources/app/dist/main/fastlist.exe"

-- | The contract of `main` is not to produce unsigned installer binaries.
main :: Options -> IO ()
Expand Down Expand Up @@ -274,7 +279,7 @@ main opts@Options{..} = do
putStr rawnsi
IO.hFlush IO.stdout

windowsRemoveDirectoryRecursive "../release/win32-x64/Daedalus-win32-x64/resources/app/installers/.stack-work"
windowsRemoveDirectoryRecursive $ unpack $ "../release/win32-x64/" <> (installDirectory installerConfig) <> "-win32-x64/resources/app/installers/.stack-work"

echo "Generating NSIS installer"
procs "C:\\Program Files (x86)\\NSIS\\makensis" ["daedalus.nsi", "-V4"] mempty
Expand Down
2 changes: 1 addition & 1 deletion installers/dhall/win64.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in
, nodeLogConfig = "\${DAEDALUS_INSTALL_DIRECTORY}\\log-config-prod.yaml"
, nodeLogPath = [] : Optional Text

, walletPath = "\${DAEDALUS_DIR}\\Daedalus.exe"
, walletPath = "\${DAEDALUS_DIR}\\${installDir}.exe"
, walletLogging = True
, frontendOnlyMode = True

Expand Down
2 changes: 1 addition & 1 deletion scripts/build-installer-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nix-build default.nix -A rawapp.deps -o node_modules.root -Q
for cluster in ${CLUSTERS}
do
echo '~~~ Building '"${cluster}"' installer'
nix-build -Q release.nix -A "${cluster}.installer" --argstr buildNum "$BUILDKITE_BUILD_NUMBER" -o csl-daedalus
nix-build -Q release.nix -A "${cluster}.installer.x86_64-linux" --argstr buildNum "$BUILDKITE_BUILD_NUMBER" -o csl-daedalus
if [ -n "${BUILDKITE_JOB_ID:-}" ]; then
upload_artifacts_public csl-daedalus/daedalus*.bin
nix-build -A daedalus.cfg --argstr cluster "${cluster}"
Expand Down

0 comments on commit 4efdf14

Please sign in to comment.