diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 49afa732742..85f3111add1 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -59,7 +59,14 @@ directories: mako_src: src/mako # The subdirectory to contain documentation from all APIs and related programs doc_subdir: doc +# This somewhat intricate setup allows the CLI to access certain cargo-API values, +# without having us duplicate them. +cargo_api: &cargo_api + build_version: "0.1.15" cargo: + # This means that the API must not specify the shared variables from cargo_api + # anymore + <<: *cargo_api repo_base_url: https://github.com/Byron/google-apis-rs doc_base_url: http://byron.github.io/google-apis-rs authors: @@ -76,3 +83,5 @@ copyright: years: '2015-2016' authors: - 'Sebastian Thiel' + + diff --git a/etc/api/type-api.yaml b/etc/api/type-api.yaml index ab0af05398c..dcfafe9b8ea 100644 --- a/etc/api/type-api.yaml +++ b/etc/api/type-api.yaml @@ -25,7 +25,6 @@ make: - source: build.rs output_dir: src cargo: - build_version: "0.1.15" build_script: src/build.rs keywords: [protocol, web, api] dependencies: diff --git a/etc/api/type-cli.yaml b/etc/api/type-cli.yaml index d0857259846..8f09fa8dde5 100644 --- a/etc/api/type-cli.yaml +++ b/etc/api/type-cli.yaml @@ -12,6 +12,7 @@ make: target_suffix: -cli aggregated_target_suffix: -cli depends_on_suffix: '' + depends_on_id: 'api' documentation_engine: mkdocs templates: - source: ../LICENSE.md diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index 4a2716cb647..2e3f8824793 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -41,12 +41,15 @@ ${dep} <% api_name = util.library_name() crate_name_we_depend_on = None + crate_version_we_depend_on = None nightly_features = ["serde_macros", "yup-oauth2/nightly"] default_features = ["serde_codegen", "yup-oauth2/with-serde-codegen"] if make.depends_on_suffix is not None: crate_name_we_depend_on = library_to_crate_name(api_name, suffix=make.depends_on_suffix) + depends_on_key = 'cargo_' + make.depends_on_id + crate_version_we_depend_on = self.context.get(depends_on_key).get('build_version') nightly_features.append(crate_name_we_depend_on + '/nightly') default_features.append(crate_name_we_depend_on + '/with-serde-codegen') %>\ @@ -61,7 +64,7 @@ serde_codegen = { version = "^ 0.8", optional = true } [dependencies.${crate_name_we_depend_on}] path = "../${api_name}" -version = "*" +version = "${crate_version_we_depend_on}" optional = true default-features = false % endif diff --git a/src/mako/deps.mako b/src/mako/deps.mako index ced7c467c3e..38b16c647f2 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -76,7 +76,6 @@ i.get('output_dir', '') + '/' + i.source.strip('../')) for i in make.templates] api_json = directories.api_base + '/' + an + '/' + version + '/' + an + '-api.json' api_meta_dir = os.path.dirname(api_json) - print api_json api_crate_publish_file = api_meta_dir + '/crates/' + util.crate_version(cargo.build_version + make.aggregated_target_suffix, json.load(open(api_json, 'r')).get('revision', '00000000')) api_json_overrides = api_meta_dir + '/' + an + '-api_overrides.yaml'