Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file BaseCompat.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168(******************************************************************************)(* OASIS: architecture for building OCaml libraries and applications *)(* *)(* Copyright (C) 2011-2016, Sylvain Le Gall *)(* Copyright (C) 2008-2011, OCamlCore SARL *)(* *)(* This library is free software; you can redistribute it and/or modify it *)(* under the terms of the GNU Lesser General Public License as published by *)(* the Free Software Foundation; either version 2.1 of the License, or (at *)(* your option) any later version, with the OCaml static compilation *)(* exception. *)(* *)(* This library is distributed in the hope that it will be useful, but *)(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)(* details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this library; if not, write to the Free Software Foundation, *)(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)(******************************************************************************)(** Compatibility layer to provide a stable API inside setup.ml.
This layer allows OASIS to change in between minor versions
(e.g. 0.4.6 -> 0.4.7) but still provides a stable API inside setup.ml. This
enables to write functions that manipulate setup_t inside setup.ml. See
deps.ml for an example.
The module opened by default will depend on the version of the _oasis. E.g.
if we have "OASISFormat: 0.3", the module Compat_0_3 will be opened and
the function Compat_0_3 will be called. If setup.ml is generated with the
-nocompat, no module will be opened.
@author Sylvain Le Gall
*)moduleCompat_0_4=structletrctxt=ref!BaseContext.defaultmoduleBaseSetup=structmoduleOriginal=BaseSetupopenOASISTypestypestd_args_fun=package->stringarray->unittype('a,'b)section_args_fun=name*(package->(common_section*'a)->stringarray->'b)typet={configure:std_args_fun;build:std_args_fun;doc:((doc,unit)section_args_fun)list;test:((test,float)section_args_fun)list;install:std_args_fun;uninstall:std_args_fun;clean:std_args_funlist;clean_doc:(doc,unit)section_args_funlist;clean_test:(test,unit)section_args_funlist;distclean:std_args_funlist;distclean_doc:(doc,unit)section_args_funlist;distclean_test:(test,unit)section_args_funlist;package:package;oasis_fn:stringoption;oasis_version:string;oasis_digest:Digest.toption;oasis_exec:stringoption;oasis_setup_args:stringlist;setup_update:bool;}letsetupt=letmk_std_args_funf=fun~ctxtpkgargs->rctxt:=ctxt;fpkgargsinletmk_section_args_funl=List.map(fun(nm,f)->nm,(fun~ctxtpkgsctargs->rctxt:=ctxt;fpkgsctargs))linlett'={Original.configure=mk_std_args_funt.configure;build=mk_std_args_funt.build;doc=mk_section_args_funt.doc;test=mk_section_args_funt.test;install=mk_std_args_funt.install;uninstall=mk_std_args_funt.uninstall;clean=List.mapmk_std_args_funt.clean;clean_doc=mk_section_args_funt.clean_doc;clean_test=mk_section_args_funt.clean_test;distclean=List.mapmk_std_args_funt.distclean;distclean_doc=mk_section_args_funt.distclean_doc;distclean_test=mk_section_args_funt.distclean_test;package=t.package;oasis_fn=t.oasis_fn;oasis_version=t.oasis_version;oasis_digest=t.oasis_digest;oasis_exec=t.oasis_exec;oasis_setup_args=t.oasis_setup_args;setup_update=t.setup_update;}inOriginal.setupt'endletadapt_setup_tsetup_t=letmoduleO=BaseSetup.Originalinletmk_std_args_funf=funpkgargs->f~ctxt:!rctxtpkgargsinletmk_section_args_funl=List.map(fun(nm,f)->nm,(funpkgsctargs->f~ctxt:!rctxtpkgsctargs))lin{BaseSetup.configure=mk_std_args_funsetup_t.O.configure;build=mk_std_args_funsetup_t.O.build;doc=mk_section_args_funsetup_t.O.doc;test=mk_section_args_funsetup_t.O.test;install=mk_std_args_funsetup_t.O.install;uninstall=mk_std_args_funsetup_t.O.uninstall;clean=List.mapmk_std_args_funsetup_t.O.clean;clean_doc=mk_section_args_funsetup_t.O.clean_doc;clean_test=mk_section_args_funsetup_t.O.clean_test;distclean=List.mapmk_std_args_funsetup_t.O.distclean;distclean_doc=mk_section_args_funsetup_t.O.distclean_doc;distclean_test=mk_section_args_funsetup_t.O.distclean_test;package=setup_t.O.package;oasis_fn=setup_t.O.oasis_fn;oasis_version=setup_t.O.oasis_version;oasis_digest=setup_t.O.oasis_digest;oasis_exec=setup_t.O.oasis_exec;oasis_setup_args=setup_t.O.oasis_setup_args;setup_update=setup_t.O.setup_update;}endmoduleCompat_0_3=structincludeCompat_0_4end(* END EXPORT *)letsetup_ml_textpkg=letmodul=letbuf=Buffer.create15inBuffer.add_stringbuf"BaseCompat.Compat_";String.iter(func->Buffer.add_charbuf(ifc='.'then'_'elsec))(OASISVersion.string_of_versionpkg.OASISTypes.oasis_version);Buffer.contentsbufin[Printf.sprintf"let setup_t = %s.adapt_setup_t setup_t"modul;Printf.sprintf"open %s"modul;]