mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
feat(api): api generation works once again
With the new structure, it should be easy to add CLI programs with proper dependencies accordingly.
This commit is contained in:
10
Makefile
10
Makefile
@@ -13,8 +13,10 @@ MAKO_SRC = src/mako
|
||||
RUST_SRC = src/rust
|
||||
API_DEPS_TPL = $(MAKO_SRC)/deps.mako
|
||||
API_DEPS = .api.deps
|
||||
API_SHARED_INFO = etc/api/shared.yaml
|
||||
API_LIST = etc/api/
|
||||
API_DIR = etc/api
|
||||
API_SHARED_INFO = $(API_DIR)/shared.yaml
|
||||
TYPE_API_INFO = $(API_DIR)/type-api.yaml
|
||||
API_LIST = $(API_DIR)/
|
||||
ifdef TRAVIS
|
||||
API_LIST := $(API_LIST)api-list_travis.yaml
|
||||
else
|
||||
@@ -56,8 +58,8 @@ $(MAKO_RENDER): $(PYTHON)
|
||||
|
||||
# Explicitly NOT depending on $(MAKO_LIB_FILES), as it's quite stable and now takes 'too long' thanks
|
||||
# to a URL get call to the google discovery service
|
||||
$(API_DEPS): $(API_DEPS_TPL) $(API_SHARED_INFO) $(MAKO_RENDER) $(API_LIST)
|
||||
$(MAKO) -io $(API_DEPS_TPL)=$@ --data-files $(API_SHARED_INFO) $(API_LIST)
|
||||
$(API_DEPS): $(API_DEPS_TPL) $(API_SHARED_INFO) $(MAKO_RENDER) $(TYPE_API_INFO) $(API_LIST)
|
||||
$(MAKO) -io $(API_DEPS_TPL)=$@ --var TYPE=api --data-files $(API_SHARED_INFO) $(TYPE_API_INFO) $(API_LIST)
|
||||
|
||||
api-deps: $(API_DEPS)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ make:
|
||||
templates:
|
||||
# all output directories are relative to the one set for the respective API
|
||||
- source: README.md
|
||||
- source: LICENSE.md
|
||||
- source: ../LICENSE.md
|
||||
- source: ../Cargo.toml
|
||||
- source: lib.rs
|
||||
output_dir: src
|
||||
@@ -1,7 +1,9 @@
|
||||
make:
|
||||
target_suffix: cli
|
||||
target_suffix: -cli
|
||||
depends_on: api
|
||||
templates:
|
||||
- source: ../LICENSE.md
|
||||
- source: ../Cargo.toml
|
||||
- source: main.rs
|
||||
output_dir: src
|
||||
cargo:
|
||||
@@ -330,7 +330,10 @@ def merge(a, b, path=None):
|
||||
merge(a[key], b[key], path + [str(key)])
|
||||
else:
|
||||
# overwrite leafs unconditionally !
|
||||
a[key] = b[key]
|
||||
if isinstance(a[key], list) and isinstance(b[key], list):
|
||||
a[key] = a[key] + b[key]
|
||||
else:
|
||||
a[key] = b[key]
|
||||
else:
|
||||
a[key] = b[key]
|
||||
return a
|
||||
|
||||
22
gen/Cargo.toml
Normal file
22
gen/Cargo.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
# DO NOT EDIT !
|
||||
# This file was generated automatically from 'src/mako/Cargo.toml.mako'
|
||||
# DO NOT EDIT !
|
||||
[package]
|
||||
|
||||
name = "google-dfareporting2"
|
||||
version = "0.1.1+20150223"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail>"]
|
||||
description = "A complete library to interact with dfareporting (protocol v2.0)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2"
|
||||
homepage = "https://developers.google.com/doubleclick-advertisers/reporting/"
|
||||
documentation = "http://byron.github.io/google-apis-rs/google-dfareporting2"
|
||||
license = "MIT"
|
||||
keywords = ["dfareporting", "google", "protocol", "web", "api"]
|
||||
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
url = "*"
|
||||
serde = "*"
|
||||
serde_macros = "*"
|
||||
30
gen/LICENSE.md
Normal file
30
gen/LICENSE.md
Normal file
@@ -0,0 +1,30 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/LICENSE.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © `2015` `Sebastian Thiel`
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -10,7 +10,9 @@ version = "${util.crate_version()}"
|
||||
authors = [${",\n ".join('"%s"' % a for a in cargo.authors)}]
|
||||
description = "A complete library to interact with ${util.canonical_name()} (protocol ${version})"
|
||||
repository = "${util.github_source_root_url()}"
|
||||
% if documentationLink is not UNDEFINED:
|
||||
homepage = "${documentationLink}"
|
||||
% endif
|
||||
documentation = "${cargo.doc_base_url}/${util.crate_name()}"
|
||||
license = "${copyright.license_abbrev}"
|
||||
keywords = ["${name}", ${", ".join(estr(cargo.keywords))}]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
c = new_context(schemas, resources, context.get('methods'))
|
||||
%>\
|
||||
<%namespace name="lib" file="lib/lib.mako"/>\
|
||||
<%namespace name="util" file="lib/util.mako"/>\
|
||||
<%namespace name="util" file="../lib/util.mako"/>\
|
||||
<%block filter="markdown_comment">\
|
||||
<%util:gen_info source="${self.uri}" />\
|
||||
</%block>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%namespace name="lib" file="lib/lib.mako"/>\
|
||||
<%namespace name="util" file="lib/util.mako"/>\
|
||||
<%namespace name="util" file="../lib/util.mako"/>\
|
||||
<%namespace name="rbuild" file="lib/rbuild.mako"/>\
|
||||
<%namespace name="mbuild" file="lib/mbuild.mako"/>\
|
||||
<%namespace name="schema" file="lib/schema.mako"/>\
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
def pretty_name(name):
|
||||
return ' '.join(split_camelcase_s(name).split('.'))
|
||||
%>\
|
||||
<%namespace name="util" file="util.mako"/>\
|
||||
<%namespace name="util" file="../../lib/util.mako"/>\
|
||||
<%namespace name="mbuild" file="mbuild.mako"/>\
|
||||
|
||||
## If rust-doc is True, examples will be made to work for rust doc tests. Otherwise they are set
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
fn_name = 'add_' + fn_name
|
||||
return fn_name
|
||||
%>\
|
||||
<%namespace name="util" file="util.mako"/>\
|
||||
<%namespace name="util" file="../../lib/util.mako"/>\
|
||||
<%namespace name="lib" file="lib.mako"/>\
|
||||
|
||||
## Creates a method builder type
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
struct_type_bounds_s, METHODS_RESOURCE, SPACES_PER_TAB, prefix_all_but_first_with,
|
||||
METHODS_BUILDER_MARKER_TRAIT, remove_empty_lines)
|
||||
%>\
|
||||
<%namespace name="util" file="util.mako"/>\
|
||||
<%namespace name="util" file="../../lib/util.mako"/>\
|
||||
<%namespace name="lib" file="lib.mako"/>\
|
||||
|
||||
## Creates a Resource builder type
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
api_doc_index = api_doc_root + '/index.html'
|
||||
|
||||
# source, destination of individual output files
|
||||
sds = [(directories.mako_src + '/' + i.source + '.mako', gen_root + '/' + i.get('output_dir', '') + '/' + i.source)
|
||||
for i in api.templates]
|
||||
sds = [(directories.mako_src + '/' + TYPE + '/' + i.source + '.mako', gen_root + '/' + i.get('output_dir', '') + '/' + i.source)
|
||||
for i in make.templates]
|
||||
api_json = directories.api_base + '/' + an + '/' + version + '/' + an + '-api.json'
|
||||
api_meta_dir = os.path.dirname(api_json)
|
||||
api_crate_publish_file = api_meta_dir + '/crates/' + util.crate_version(cargo.build_version,
|
||||
json.load(open(api_json, 'r'))['revision'])
|
||||
api_json_overrides = api_meta_dir + '/' + an + '-api_overrides.json'
|
||||
api_json_inputs = api_json + ' $(API_SHARED_INFO)'
|
||||
api_json_inputs = api_json + ' $(API_SHARED_INFO) $(API_DIR)/type-' + TYPE + '.yaml'
|
||||
if os.path.isfile(api_json_overrides):
|
||||
api_json_inputs += ' ' + api_json_overrides
|
||||
api_info.append((api_name, api_clean, api_cargo, api_doc, api_crate_publish_file, gen_root))
|
||||
@@ -135,4 +135,4 @@ ${fake_target}:
|
||||
% endfor
|
||||
|
||||
update-json: ${' '.join(json_api_targets)}
|
||||
$(API_VERSION_GEN) etc/api $(API_LIST) $(API_LIST)
|
||||
$(API_VERSION_GEN) $(API_DIR) $(API_LIST) $(API_LIST)
|
||||
|
||||
Reference in New Issue
Block a user