diff --git a/Makefile b/Makefile index 3abc74f528..1a3447c78d 100644 --- a/Makefile +++ b/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) diff --git a/etc/api/api.yaml b/etc/api/type-api.yaml similarity index 96% rename from etc/api/api.yaml rename to etc/api/type-api.yaml index dd63668500..8dc2baa831 100644 --- a/etc/api/api.yaml +++ b/etc/api/type-api.yaml @@ -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 diff --git a/etc/api/cli.yaml b/etc/api/type-cli.yaml similarity index 62% rename from etc/api/cli.yaml rename to etc/api/type-cli.yaml index f5c150d027..9f3aa37282 100644 --- a/etc/api/cli.yaml +++ b/etc/api/type-cli.yaml @@ -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: diff --git a/etc/bin/mako-render b/etc/bin/mako-render index 185dc5d7a5..9d12ef0632 100644 --- a/etc/bin/mako-render +++ b/etc/bin/mako-render @@ -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 diff --git a/gen/Cargo.toml b/gen/Cargo.toml new file mode 100644 index 0000000000..094c9f7aa8 --- /dev/null +++ b/gen/Cargo.toml @@ -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 "] +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 = "*" diff --git a/gen/LICENSE.md b/gen/LICENSE.md new file mode 100644 index 0000000000..ae22e6ec52 --- /dev/null +++ b/gen/LICENSE.md @@ -0,0 +1,30 @@ + +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. diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index 6a01ad7a3f..597f29940d 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -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))}] diff --git a/src/mako/api/README.md.mako b/src/mako/api/README.md.mako index 768f8fc2a2..88b6429e0a 100644 --- a/src/mako/api/README.md.mako +++ b/src/mako/api/README.md.mako @@ -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}" />\ diff --git a/src/mako/api/lib.rs.mako b/src/mako/api/lib.rs.mako index 7015ad890b..19e5339bfc 100644 --- a/src/mako/api/lib.rs.mako +++ b/src/mako/api/lib.rs.mako @@ -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"/>\ diff --git a/src/mako/api/lib/lib.mako b/src/mako/api/lib/lib.mako index cb18b69b68..10bf7a9466 100644 --- a/src/mako/api/lib/lib.mako +++ b/src/mako/api/lib/lib.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 diff --git a/src/mako/api/lib/mbuild.mako b/src/mako/api/lib/mbuild.mako index a44e1b2f9a..947feeaeac 100644 --- a/src/mako/api/lib/mbuild.mako +++ b/src/mako/api/lib/mbuild.mako @@ -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 diff --git a/src/mako/api/lib/rbuild.mako b/src/mako/api/lib/rbuild.mako index add61f9716..8ff389ac24 100644 --- a/src/mako/api/lib/rbuild.mako +++ b/src/mako/api/lib/rbuild.mako @@ -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 diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 3179d2d5d4..2b63cdaa78 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -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)