Skip to content

Commit

Permalink
fix(make): dependency handling:dirs with timestamp
Browse files Browse the repository at this point in the history
That way, make will not regenerate unnecessarily
  • Loading branch information
Byron committed Mar 3, 2015
1 parent d8edf1d commit bb04b60
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.timestamp
.pyenv
*.pyc
**target/
Expand Down
2 changes: 1 addition & 1 deletion gen/youtube3/cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "youtube3"
version = "0.0.1"
authors = ["Sebastian Thiel <byronimo@gmail>"]
description = "A complete library to interact with YouTube (protocol v3)"
repository = "https://github.com/Byron/google-apis-rs/gen/youtube3"
repository = "https://github.com/Byron/google-apis-rs/gen/youtube3/.timestamp"
homepage = "https://developers.google.com/youtube/v3"
documentation = "http://byron.github.io/google-apis-rs"
license = "MIT"
Expand Down
19 changes: 9 additions & 10 deletions gen/youtube3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ extern crate cmn;
extern crate "rustc-serialize" as rustc_serialize;
extern crate "yup-oauth2" as oauth2;

use std::default::Default;
use std::collections::HashMap;

/// There is no detailed description.
Expand Down Expand Up @@ -292,15 +291,15 @@ pub struct ChannelSettings {
#[derive(RustcEncodable, RustcDecodable, Default, Clone)]
pub struct VideoStatistics {
/// The number of comments for the video.
pub commentCount: Option<String>,
pub commentCount: Option<i64>,
/// The number of times the video has been viewed.
pub viewCount: Option<String>,
pub viewCount: Option<i64>,
/// The number of users who currently have the video marked as a favorite video.
pub favoriteCount: Option<String>,
pub favoriteCount: Option<i64>,
/// The number of users who have indicated that they disliked the video by giving it a negative rating.
pub dislikeCount: Option<String>,
pub dislikeCount: Option<i64>,
/// The number of users who have indicated that they liked the video by giving it a positive rating.
pub likeCount: Option<String>,
pub likeCount: Option<i64>,
}

/// Brief description of the live stream cdn settings.
Expand Down Expand Up @@ -1225,15 +1224,15 @@ pub struct Channel {
#[derive(RustcEncodable, RustcDecodable, Default, Clone)]
pub struct ChannelStatistics {
/// The number of comments for the channel.
pub commentCount: Option<String>,
pub commentCount: Option<i64>,
/// The number of subscribers that the channel has.
pub subscriberCount: Option<String>,
pub subscriberCount: Option<i64>,
/// The number of videos uploaded to the channel.
pub videoCount: Option<String>,
pub videoCount: Option<i64>,
/// Whether or not the number of subscribers is shown for this user.
pub hiddenSubscriberCount: Option<bool>,
/// The number of times the channel has been viewed.
pub viewCount: Option<String>,
pub viewCount: Option<i64>,
}

/// Details about a social network post.
Expand Down
6 changes: 4 additions & 2 deletions src/mako/deps.mako
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%
import util
gen_root = directories.output + '/' + a.name + util.to_api_version(a.version)
gen_root_stamp = gen_root + '/.timestamp'
api_name = util.library_name(a.name, a.version)
api_clean = api_name + '-clean'
# source, destination of individual output files
Expand All @@ -16,10 +17,11 @@
api_json_inputs = api_json + " $(API_SHARED_INFO)"
api_info.append((api_name, api_clean, gen_root))
%>\
${gen_root}: ${' '.join(i[0] for i in sds)} ${api_json_inputs} $(MAKO_LIB_FILES) $(MAKO_RENDER)
${gen_root_stamp}: ${' '.join(i[0] for i in sds)} ${api_json_inputs} $(MAKO_LIB_FILES) $(MAKO_RENDER)
PYTHONPATH=$(MAKO_LIB_DIR) $(TPL) --template-dir '.' --var OUTPUT_DIR=$@ -io ${' '.join("%s=%s" % (s, d) for s, d in sds)} --data-files ${api_json_inputs}
@touch $@
${api_name}: ${gen_root}
${api_name}: ${gen_root_stamp}
${api_clean}:
-rm -Rf ${gen_root}
Expand Down
2 changes: 2 additions & 0 deletions src/mako/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def nested_type(nt):
elif t.type == 'object':
rust_type = "%s<String, %s>" % (rust_type, nested_type(t))
is_pod = False
elif t.type == 'string' and 'Count' in pn:
rust_type = 'i64'
elif rust_type == USE_FORMAT:
rust_type = TYPE_MAP[t.format]
if is_pod and allow_optionals:
Expand Down

0 comments on commit bb04b60

Please sign in to comment.