From 811feda056bd62271bd14d6c77ad0f044e7c2c52 Mon Sep 17 00:00:00 2001 From: Hongbo Zhang Date: Tue, 7 Feb 2017 15:52:46 -0500 Subject: [PATCH] make header static --- docs/Manual.html | 7 ++++ jscomp/bin/bsdep.ml | 54 ++++++++++++++++++++++++- jscomp/bin/bsppx.ml | 54 ++++++++++++++++++++++++- jscomp/bin/whole_compiler.ml | 60 +++++++++++++++++++++++++--- jscomp/build_version.js | 34 +++++++++++++++- jscomp/common/bs_version.ml | 27 +++++++++++++ jscomp/common/bs_version.mli | 26 ++++++++++++ jscomp/core/js_dump.ml | 6 +-- site/docsource/Compiler-options.adoc | 5 +++ site/docsource/Release.1.4.3.adoc | 5 +++ 10 files changed, 264 insertions(+), 14 deletions(-) create mode 100644 site/docsource/Release.1.4.3.adoc diff --git a/docs/Manual.html b/docs/Manual.html index 2d5ba3e0ab..dd6d96f481 100644 --- a/docs/Manual.html +++ b/docs/Manual.html @@ -605,6 +605,7 @@

BuckleScript User Ma
  • -bs-no-warn-ffi-type
  • -bs-eval
  • -bs-no-builtin-ppx-ml, -bs-no-builtin-ppx-mli
  • +
  • -bs-no-version-header
  • Semantics difference from other backends @@ -3544,6 +3545,12 @@

    +

    -bs-no-version-header

    +
    +

    Don’t print version header

    +
    +
    diff --git a/jscomp/bin/bsdep.ml b/jscomp/bin/bsdep.ml index 1ab6e09ec1..0bb6cf5ddd 100644 --- a/jscomp/bin/bsdep.ml +++ b/jscomp/bin/bsdep.ml @@ -1,12 +1,64 @@ module Config = Config_bsdep module Bs_version : sig #1 "bs_version.mli" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + val version : string +val header : string + end = struct #1 "bs_version.ml" -let version = "1.4.3" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +let version = "1.4.3" +let header = + "// Generated by BUCKLESCRIPT VERSION 1.4.3, PLEASE EDIT WITH CARE" + end module Terminfo : sig #1 "terminfo.mli" diff --git a/jscomp/bin/bsppx.ml b/jscomp/bin/bsppx.ml index 2be76ce3ed..243efd7b81 100644 --- a/jscomp/bin/bsppx.ml +++ b/jscomp/bin/bsppx.ml @@ -9178,12 +9178,64 @@ let make_obj ~loc xs = end module Bs_version : sig #1 "bs_version.mli" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + val version : string +val header : string + end = struct #1 "bs_version.ml" -let version = "1.4.3" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +let version = "1.4.3" +let header = + "// Generated by BUCKLESCRIPT VERSION 1.4.3, PLEASE EDIT WITH CARE" + end module Ast_ffi_types : sig #1 "ast_ffi_types.mli" diff --git a/jscomp/bin/whole_compiler.ml b/jscomp/bin/whole_compiler.ml index ce3e8f2e66..d01e6bc769 100644 --- a/jscomp/bin/whole_compiler.ml +++ b/jscomp/bin/whole_compiler.ml @@ -1,12 +1,64 @@ module Config = Config_whole_compiler module Bs_version : sig #1 "bs_version.mli" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + val version : string +val header : string + end = struct #1 "bs_version.ml" -let version = "1.4.3" +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +let version = "1.4.3" +let header = + "// Generated by BUCKLESCRIPT VERSION 1.4.3, PLEASE EDIT WITH CARE" + end module Terminfo : sig #1 "terminfo.mli" @@ -82647,10 +82699,6 @@ let es6_program ~output_prefix f ( x : J.deps_program) = Linguist::FileBlob.new('jscomp/test/test_u.js').generated? ]} *) -let bs_header = - "// Generated by BUCKLESCRIPT VERSION " ^ - Bs_version.version ^ - " , PLEASE EDIT WITH CARE" let pp_deps_program ~output_prefix @@ -82659,7 +82707,7 @@ let pp_deps_program begin if not !Js_config.no_version_header then begin - P.string f bs_header; + P.string f Bs_version.header; P.newline f end ; P.string f L.strict_directive; diff --git a/jscomp/build_version.js b/jscomp/build_version.js index df01332cf5..6af8e34a8e 100644 --- a/jscomp/build_version.js +++ b/jscomp/build_version.js @@ -1,7 +1,39 @@ + +/** + * This file is used only in dev time, feel free to use es6 + */ var fs = require('fs') var path = require('path') var version = JSON.parse(fs.readFileSync('../package.json','utf8')).version fs.writeFileSync( path.join(__dirname,'common', 'bs_version.ml'), - "let version = \"" + version + "\"\n",'utf8') \ No newline at end of file + ` +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +let version = "${version}" +let header = + "// Generated by BUCKLESCRIPT VERSION ${version}, PLEASE EDIT WITH CARE" + ` + ,'utf8') \ No newline at end of file diff --git a/jscomp/common/bs_version.ml b/jscomp/common/bs_version.ml index b1eccb1fd0..7911d1695f 100644 --- a/jscomp/common/bs_version.ml +++ b/jscomp/common/bs_version.ml @@ -1 +1,28 @@ + +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) let version = "1.4.3" +let header = + "// Generated by BUCKLESCRIPT VERSION 1.4.3, PLEASE EDIT WITH CARE" + \ No newline at end of file diff --git a/jscomp/common/bs_version.mli b/jscomp/common/bs_version.mli index 8579193c22..c7b0a5d10c 100644 --- a/jscomp/common/bs_version.mli +++ b/jscomp/common/bs_version.mli @@ -1 +1,27 @@ +(* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program 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 + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + val version : string + +val header : string diff --git a/jscomp/core/js_dump.ml b/jscomp/core/js_dump.ml index dc173e932c..356f33af1e 100644 --- a/jscomp/core/js_dump.ml +++ b/jscomp/core/js_dump.ml @@ -1830,10 +1830,6 @@ let es6_program ~output_prefix f ( x : J.deps_program) = Linguist::FileBlob.new('jscomp/test/test_u.js').generated? ]} *) -let bs_header = - "// Generated by BUCKLESCRIPT VERSION " ^ - Bs_version.version ^ - " , PLEASE EDIT WITH CARE" let pp_deps_program ~output_prefix @@ -1842,7 +1838,7 @@ let pp_deps_program begin if not !Js_config.no_version_header then begin - P.string f bs_header; + P.string f Bs_version.header; P.newline f end ; P.string f L.strict_directive; diff --git a/site/docsource/Compiler-options.adoc b/site/docsource/Compiler-options.adoc index 15fd77e2d5..46cdc2a59d 100644 --- a/site/docsource/Compiler-options.adoc +++ b/site/docsource/Compiler-options.adoc @@ -138,3 +138,8 @@ Another use case is that users can use `-ppx` explicitly as below: -------------- bsc.exe -c -ppx bsppx.exe -bs-no-builtin-ppx-ml c.ml -------------- + + +### -bs-no-version-header + +Don't print version header \ No newline at end of file diff --git a/site/docsource/Release.1.4.3.adoc b/site/docsource/Release.1.4.3.adoc new file mode 100644 index 0000000000..015eda6294 --- /dev/null +++ b/site/docsource/Release.1.4.3.adoc @@ -0,0 +1,5 @@ + +WIP + +# ES6 module support +