From 1e6856955b9ee8cd05ac7705a7865ff14798136f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 30 Nov 2015 13:58:53 +0200 Subject: Add cli-generated source files to distribution The idea is to not require end-users to install cli. --- bpkg/buildfile | 158 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 89 insertions(+), 69 deletions(-) (limited to 'bpkg/buildfile') diff --git a/bpkg/buildfile b/bpkg/buildfile index 4282876..d35cc22 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -2,92 +2,112 @@ # copyright : Copyright (c) 2014-2015 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -using cli - import libs = libbpkg%lib{bpkg} import libs += libbutl%lib{butl} import libs += libodb%lib{odb} import libs += libodb-sqlite%lib{odb-sqlite} -exe{bpkg}: \ -{ hxx }{ bpkg-version } \ -{ cxx }{ bpkg } cli.cxx{ bpkg-options } \ -{ hxx cxx }{ build } cli.cxx{ build-options } \ -{ hxx cxx }{ cfg-create } cli.cxx{ cfg-create-options } \ - cli.cxx{ common-options } \ - cli.cxx{ configuration-options } \ -{ hxx cxx }{ database } \ -{ hxx cxx }{ diagnostics } \ -{ hxx cxx }{ drop } cli.cxx{ drop-options } \ -{ hxx cxx }{ fetch } \ -{ hxx }{ forward } \ -{ hxx cxx }{ help } cli.cxx{ help-options } \ -{ hxx cxx }{ manifest-utility } \ -{ hxx ixx cxx }{ package } \ -{ hxx ixx cxx }{ package-odb } file{package.xml} \ -{ hxx }{ pkg-clean } cli.cxx{ pkg-clean-options } \ -{ hxx cxx }{ pkg-command } \ -{ hxx cxx }{ pkg-configure } cli.cxx{ pkg-configure-options } \ -{ hxx cxx }{ pkg-disfigure } cli.cxx{ pkg-disfigure-options } \ -{ hxx cxx }{ pkg-fetch } cli.cxx{ pkg-fetch-options } \ -{ hxx cxx }{ pkg-purge } cli.cxx{ pkg-purge-options } \ -{ hxx cxx }{ pkg-status } cli.cxx{ pkg-status-options } \ -{ hxx cxx }{ pkg-unpack } cli.cxx{ pkg-unpack-options } \ -{ hxx }{ pkg-update } cli.cxx{ pkg-update-options } \ -{ hxx cxx }{ pkg-verify } cli.cxx{ pkg-verify-options } \ -{ hxx cxx }{ rep-add } cli.cxx{ rep-add-options } \ -{ hxx cxx }{ rep-create } cli.cxx{ rep-create-options } \ -{ hxx cxx }{ rep-fetch } cli.cxx{ rep-fetch-options } \ -{ hxx cxx }{ rep-info } cli.cxx{ rep-info-options } \ -{ hxx cxx }{ satisfaction } \ -{ hxx }{ types } \ -{ hxx cxx }{ types-parsers } \ -{ hxx cxx }{ utility } \ -{ hxx }{ wrapper-traits } \ +exe{bpkg}: \ +{hxx }{ bpkg-version } \ +{ cxx}{ bpkg } {hxx ixx cxx}{ bpkg-options } \ +{hxx cxx}{ build } {hxx ixx cxx}{ build-options } \ +{hxx cxx}{ cfg-create } {hxx ixx cxx}{ cfg-create-options } \ + {hxx ixx cxx}{ common-options } \ + {hxx ixx cxx}{ configuration-options } \ +{hxx cxx}{ database } \ +{hxx cxx}{ diagnostics } \ +{hxx cxx}{ drop } {hxx ixx cxx}{ drop-options } \ +{hxx cxx}{ fetch } \ +{hxx }{ forward } \ +{hxx cxx}{ help } {hxx ixx cxx}{ help-options } \ +{hxx cxx}{ manifest-utility } \ +{hxx ixx cxx}{ package } \ +{hxx ixx cxx}{ package-odb } file{ package.xml } \ +{hxx }{ pkg-clean } {hxx ixx cxx}{ pkg-clean-options } \ +{hxx cxx}{ pkg-command } \ +{hxx cxx}{ pkg-configure } {hxx ixx cxx}{ pkg-configure-options } \ +{hxx cxx}{ pkg-disfigure } {hxx ixx cxx}{ pkg-disfigure-options } \ +{hxx cxx}{ pkg-fetch } {hxx ixx cxx}{ pkg-fetch-options } \ +{hxx cxx}{ pkg-purge } {hxx ixx cxx}{ pkg-purge-options } \ +{hxx cxx}{ pkg-status } {hxx ixx cxx}{ pkg-status-options } \ +{hxx cxx}{ pkg-unpack } {hxx ixx cxx}{ pkg-unpack-options } \ +{hxx }{ pkg-update } {hxx ixx cxx}{ pkg-update-options } \ +{hxx cxx}{ pkg-verify } {hxx ixx cxx}{ pkg-verify-options } \ +{hxx cxx}{ rep-add } {hxx ixx cxx}{ rep-add-options } \ +{hxx cxx}{ rep-create } {hxx ixx cxx}{ rep-create-options } \ +{hxx cxx}{ rep-fetch } {hxx ixx cxx}{ rep-fetch-options } \ +{hxx cxx}{ rep-info } {hxx ixx cxx}{ rep-info-options } \ +{hxx cxx}{ satisfaction } \ +{hxx }{ types } \ +{hxx cxx}{ types-parsers } \ +{hxx cxx}{ utility } \ +{hxx }{ wrapper-traits } \ $libs -# Option length must be the same to get commands/topics/options aligned. +# Load the cli module but only if it's available. This way a distribution +# that includes pre-generated files can be built without installing cli. +# This is also the reason why above we explicitly spelled out individual +# source files instead of using the cli.cxx{} group (it won't be there +# unless the module is loaded). # -cli.options += -I $src_root --include-with-brackets --include-prefix bpkg \ ---guard-prefix BPKG --cxx-prologue "#include " \ ---cli-namespace bpkg::cli --generate-file-scanner --generate-specifier \ ---generate-parse --ansi-color --page-usage 'bpkg::print_$name$_' \ ---include-base-last --long-usage --option-length 20 - -cli.cxx{common-options}: cli{common-options} -cli.cxx{common-options}: cli.options += --short-usage +# @@ TODO: make it optional. +# @@ The cli{} target won't be available while it would be nice to +# detect that .cli file is newer than the generated files. Hack: +# use ctt= cli.used ? cli : file, then $ctt{common-options}. Uh. +# +using cli -cli.cxx{configuration-options}: cli{configuration-options} +{hxx ixx cxx}{common-options}: cli{common-options} +{hxx ixx cxx}{configuration-options}: cli{configuration-options} +{hxx ixx cxx}{bpkg-options}: cli{bpkg-options} -cli.cxx{bpkg-options}: cli{bpkg-options} -cli.cxx{bpkg-options}: cli.options += --suppress-undocumented +# High-level commands. +# +{hxx ixx cxx}{help-options}: cli{help-options} +{hxx ixx cxx}{build-options}: cli{build-options} +{hxx ixx cxx}{drop-options}: cli{drop-options} -cli.cxx{help-options}: cli{help-options} +# pkg-* command. +# +{hxx ixx cxx}{pkg-status-options}: cli{pkg-status-options} +{hxx ixx cxx}{pkg-fetch-options}: cli{pkg-fetch-options} +{hxx ixx cxx}{pkg-unpack-options}: cli{pkg-unpack-options} +{hxx ixx cxx}{pkg-purge-options}: cli{pkg-purge-options} +{hxx ixx cxx}{pkg-configure-options}: cli{pkg-configure-options} +{hxx ixx cxx}{pkg-disfigure-options}: cli{pkg-disfigure-options} +{hxx ixx cxx}{pkg-update-options}: cli{pkg-update-options} +{hxx ixx cxx}{pkg-clean-options}: cli{pkg-clean-options} +{hxx ixx cxx}{pkg-verify-options}: cli{pkg-verify-options} +# cfg-* command. # +{hxx ixx cxx}{cfg-create-options}: cli{cfg-create-options} + +# rep-* command. # -cli.cxx{build-options}: cli{build-options} -cli.cxx{drop-options}: cli{drop-options} +{hxx ixx cxx}{rep-add-options}: cli{rep-add-options} +{hxx ixx cxx}{rep-fetch-options}: cli{rep-fetch-options} +{hxx ixx cxx}{rep-info-options}: cli{rep-info-options} +{hxx ixx cxx}{rep-create-options}: cli{rep-create-options} -# pkg-* +# if $cli.used +# { +# +# Option length must be the same to get commands/topics/options aligned. # -cli.cxx{pkg-status-options}: cli{pkg-status-options} -cli.cxx{pkg-fetch-options}: cli{pkg-fetch-options} -cli.cxx{pkg-unpack-options}: cli{pkg-unpack-options} -cli.cxx{pkg-purge-options}: cli{pkg-purge-options} -cli.cxx{pkg-configure-options}: cli{pkg-configure-options} -cli.cxx{pkg-disfigure-options}: cli{pkg-disfigure-options} -cli.cxx{pkg-update-options}: cli{pkg-update-options} -cli.cxx{pkg-clean-options}: cli{pkg-clean-options} -cli.cxx{pkg-verify-options}: cli{pkg-verify-options} +cli.options += -I $src_root --include-with-brackets --include-prefix bpkg \ +--guard-prefix BPKG --cxx-prologue "#include " \ +--cli-namespace bpkg::cli --generate-file-scanner --generate-specifier \ +--generate-parse --ansi-color --page-usage 'bpkg::print_$name$_' \ +--include-base-last --long-usage --option-length 20 -# cfg-* +cli.cxx{common-options}: cli.options += --short-usage # Both short and long. +cli.cxx{bpkg-options}: cli.options += --suppress-undocumented # --help, etc. # -cli.cxx{cfg-create-options}: cli{cfg-create-options} +# } -# rep-* +# Include generated cli files into the distribution. # -cli.cxx{rep-add-options}: cli{rep-add-options} -cli.cxx{rep-fetch-options}: cli{rep-fetch-options} -cli.cxx{rep-info-options}: cli{rep-info-options} -cli.cxx{rep-create-options}: cli{rep-create-options} +hxx{*-options}: dist = true +ixx{*-options}: dist = true +cxx{*-options}: dist = true -- cgit v1.1