Skip to content

Commit

Permalink
feat(cli): can now be published
Browse files Browse the repository at this point in the history
This works as the API version is now explicitly specified,
allowing cargo-publish to work as usual.
  • Loading branch information
Byron committed Sep 11, 2016
1 parent c4c4901 commit 91a657b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions etc/api/shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -76,3 +83,5 @@ copyright:
years: '2015-2016'
authors:
- 'Sebastian Thiel'


1 change: 0 additions & 1 deletion etc/api/type-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions etc/api/type-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/mako/Cargo.toml.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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')
%>\
Expand All @@ -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
1 change: 0 additions & 1 deletion src/mako/deps.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 91a657b

Please sign in to comment.