Skip to content

Commit

Permalink
Merge pull request #22 from hernoufM/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
rjbou authored Oct 5, 2023
2 parents 7bdaf2f + a9bdb20 commit c0d9d67
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 12 deletions.
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
;------------------------------------------------------------------------;

(name opam-wix)
(cram enable)
19 changes: 15 additions & 4 deletions src/opamWixMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type config = {
package_guid: string option;
icon_file : filename option;
dlg_bmp : filename option;
ban_bmp : filename option
ban_bmp : filename option;
keep_wxs : bool;
}

let get_data o filename =
Expand Down Expand Up @@ -101,12 +102,15 @@ module Args = struct
value & opt (some OpamArg.filename) None & info ["ban-bmp"] ~docv:"FILE" ~doc:
"BMP file that is used as background for banner for installer."

let keep_wxs =
value & flag & info ["keep-wxs"] ~doc:"Keep Wix source files."

let term =
let apply conf package path binary output_dir wix_path package_guid icon_file dlg_bmp ban_bmp =
{ conf; package; path; binary; output_dir; wix_path; package_guid; icon_file; dlg_bmp; ban_bmp }
let apply conf package path binary output_dir wix_path package_guid icon_file dlg_bmp ban_bmp keep_wxs =
{ conf; package; path; binary; output_dir; wix_path; package_guid; icon_file; dlg_bmp; ban_bmp; keep_wxs }
in
Term.(const apply $ conffile $ package $ path $ binary $ output_dir $ wix_path $ package_guid $ icon_file $
dlg_bmp $ ban_bmp)
dlg_bmp $ ban_bmp $ keep_wxs)

end

Expand Down Expand Up @@ -447,6 +451,13 @@ let create_bundle cli =
candle_defines = []
} in
System.call_unit System.Candle candle;
if conf.keep_wxs
then begin
List.iter (fun file ->
OpamFilename.copy_in (OpamFilename.of_string file)
@@ OpamFilename.cwd ())
wxs_files
end;
let main_obj = name ^ ".wixobj" in
let addwxs1_obj = Filename.chop_extension addwxs1 ^ ".wixobj" in
let addwxs2_obj = Filename.chop_extension addwxs2 ^ ".wixobj" in
Expand Down
21 changes: 13 additions & 8 deletions src/system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,19 @@ let call_list : type a. (a command * a) list -> unit =
| _ -> ()

let check_avalable_commands wix_path =
call_list [
Which, "cygcheck";
Which, "cygpath";
Which, "uuidgen";
Which, Filename.concat wix_path "candle.exe";
Which, Filename.concat wix_path "light.exe";
Which, Filename.concat wix_path "heat.exe";
]
let wix_bin_exists bin =
Sys.file_exists @@ Filename.concat wix_path bin
in
if List.for_all wix_bin_exists [ "candle.exe"; "light.exe"; "heat.exe" ]
then
call_list [
Which, "cygcheck";
Which, "cygpath";
Which, "uuidgen";
]
else
raise @@ System_error
(Format.sprintf "Wix binaries couldn't be found in %s directory." wix_path)

let cyg_win_path out path =
match call Cygpath (out,path) with
Expand Down
Loading

0 comments on commit c0d9d67

Please sign in to comment.