Skip to content

Commit

Permalink
Further updates to Stdext
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
  • Loading branch information
jonludlam authored and euanh committed Jul 1, 2016
1 parent 28d0dc8 commit 1d1af68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions ocaml/doc/jsapi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*)

open Datamodel_types
open Xstringext

type change_t = lifecycle_change * string * string
and changes_t = change_t list
Expand All @@ -25,12 +24,12 @@ let _ =
let create_json obj =
let name = obj.name in
let s = Jsonrpc.to_string (rpc_of_obj obj) in
Unixext.write_string_to_file ("api/" ^ name ^ ".json") ("clsdoc = " ^ s);
Stdext.Unixext.write_string_to_file ("api/" ^ name ^ ".json") ("clsdoc = " ^ s);
name
in
let names = List.map create_json objs in
let class_list = String.concat ", " (List.map (fun s -> "'" ^ s ^ "'") names) in
Unixext.write_string_to_file "api/index.json" ("classes = [" ^ class_list ^ "]");
Stdext.Unixext.write_string_to_file "api/index.json" ("classes = [" ^ class_list ^ "]");

let changes_in_release rel =
let search_obj obj =
Expand Down Expand Up @@ -69,8 +68,8 @@ let _ =
"{'cls': '" ^ obj.name ^ "', 'obj_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t obj_changes) ^ ", 'field_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t field_changes) ^ ", 'msg_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t msg_changes) ^ "}"
in
let release_info = String.concat ", " (List.map search_obj objs) in
Unixext.write_string_to_file ("api/" ^ rel ^ ".json") ("release_info = [" ^ release_info ^ "]")
Stdext.Unixext.write_string_to_file ("api/" ^ rel ^ ".json") ("release_info = [" ^ release_info ^ "]")
in
List.iter changes_in_release release_order;
let release_list = String.concat ", " (List.map (fun s -> "'" ^ s ^ "'") release_order) in
Unixext.write_string_to_file "api/releases.json" ("releases = [" ^ release_list ^ "]");
Stdext.Unixext.write_string_to_file "api/releases.json" ("releases = [" ^ release_list ^ "]");
6 changes: 3 additions & 3 deletions ocaml/idl/json_backend/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ let json_of_objs objs =
JArray (List.map (fun obj ->
let fields, enums1 = fields_of_obj_with_enums obj in
let messages, enums2 = messages_of_obj_with_enums obj in
let enums = Listext.List.setify (enums1 @ enums2) in
let enums = Stdext.Listext.List.setify (enums1 @ enums2) in
JObject [
"name", JString obj.name;
"description", JString obj.description;
Expand Down Expand Up @@ -303,7 +303,7 @@ let releases objs =
JArray (List.map search_obj objs |> List.flatten |> List.sort compare_changes |> List.map jobject_of_change)
in
let release_info = JObject (List.map (fun rel -> rel, changes_in_release rel) release_order) in
Unixext.write_string_to_file ("release_info.json") (string_of_json 0 release_info)
Stdext.Unixext.write_string_to_file ("release_info.json") (string_of_json 0 release_info)

let _ =
let api = Datamodel.all_api in
Expand All @@ -315,6 +315,6 @@ let _ =
let api = filter (fun _ -> true) (fun f -> not f.internal_only) (fun m -> not m.msg_hide_from_docs) api in

let objs = objects_of_api api in
Unixext.write_string_to_file "xenapi.json" (objs |> json_of_objs |> string_of_json 0);
Stdext.Unixext.write_string_to_file "xenapi.json" (objs |> json_of_objs |> string_of_json 0);
releases objs

0 comments on commit 1d1af68

Please sign in to comment.