Skip to content

Commit 91a657b

Browse files
committed
feat(cli): can now be published
This works as the API version is now explicitly specified, allowing cargo-publish to work as usual.
1 parent c4c4901 commit 91a657b

5 files changed

Lines changed: 14 additions & 3 deletions

File tree

etc/api/shared.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ directories:
5959
mako_src: src/mako
6060
# The subdirectory to contain documentation from all APIs and related programs
6161
doc_subdir: doc
62+
# This somewhat intricate setup allows the CLI to access certain cargo-API values,
63+
# without having us duplicate them.
64+
cargo_api: &cargo_api
65+
build_version: "0.1.15"
6266
cargo:
67+
# This means that the API must not specify the shared variables from cargo_api
68+
# anymore
69+
<<: *cargo_api
6370
repo_base_url: https://github.com/Byron/google-apis-rs
6471
doc_base_url: http://byron.github.io/google-apis-rs
6572
authors:
@@ -76,3 +83,5 @@ copyright:
7683
years: '2015-2016'
7784
authors:
7885
- 'Sebastian Thiel'
86+
87+

etc/api/type-api.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ make:
2525
- source: build.rs
2626
output_dir: src
2727
cargo:
28-
build_version: "0.1.15"
2928
build_script: src/build.rs
3029
keywords: [protocol, web, api]
3130
dependencies:

etc/api/type-cli.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ make:
1212
target_suffix: -cli
1313
aggregated_target_suffix: -cli
1414
depends_on_suffix: ''
15+
depends_on_id: 'api'
1516
documentation_engine: mkdocs
1617
templates:
1718
- source: ../LICENSE.md

src/mako/Cargo.toml.mako

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ ${dep}
4141
<%
4242
api_name = util.library_name()
4343
crate_name_we_depend_on = None
44+
crate_version_we_depend_on = None
4445
4546
nightly_features = ["serde_macros", "yup-oauth2/nightly"]
4647
default_features = ["serde_codegen", "yup-oauth2/with-serde-codegen"]
4748
4849
if make.depends_on_suffix is not None:
4950
crate_name_we_depend_on = library_to_crate_name(api_name, suffix=make.depends_on_suffix)
51+
depends_on_key = 'cargo_' + make.depends_on_id
52+
crate_version_we_depend_on = self.context.get(depends_on_key).get('build_version')
5053
nightly_features.append(crate_name_we_depend_on + '/nightly')
5154
default_features.append(crate_name_we_depend_on + '/with-serde-codegen')
5255
%>\
@@ -61,7 +64,7 @@ serde_codegen = { version = "^ 0.8", optional = true }
6164

6265
[dependencies.${crate_name_we_depend_on}]
6366
path = "../${api_name}"
64-
version = "*"
67+
version = "${crate_version_we_depend_on}"
6568
optional = true
6669
default-features = false
6770
% endif

src/mako/deps.mako

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
i.get('output_dir', '') + '/' + i.source.strip('../')) for i in make.templates]
7777
api_json = directories.api_base + '/' + an + '/' + version + '/' + an + '-api.json'
7878
api_meta_dir = os.path.dirname(api_json)
79-
print api_json
8079
api_crate_publish_file = api_meta_dir + '/crates/' + util.crate_version(cargo.build_version +
8180
make.aggregated_target_suffix, json.load(open(api_json, 'r')).get('revision', '00000000'))
8281
api_json_overrides = api_meta_dir + '/' + an + '-api_overrides.yaml'

0 commit comments

Comments
 (0)