From c6f92057582c576129db6f8ca27ee824df201c5d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 May 2016 08:37:46 +0200 Subject: [PATCH] chore(update): `make regen-apis` Fixes #151 --- gen/adexchangebuyer1d3-cli/Cargo.toml | 28 +++++--- gen/adexchangebuyer1d3-cli/src/cmn.rs | 22 +++--- gen/adexchangebuyer1d3-cli/src/main.rs | 4 +- gen/adexchangebuyer1d3/Cargo.toml | 22 +++--- gen/adexchangebuyer1d3/src/build.rs | 38 ++++++---- gen/adexchangebuyer1d3/src/lib.rs | 6 ++ gen/adexchangebuyer1d4-cli/Cargo.toml | 28 +++++--- gen/adexchangebuyer1d4-cli/src/cmn.rs | 22 +++--- gen/adexchangebuyer1d4-cli/src/main.rs | 4 +- gen/adexchangebuyer1d4/Cargo.toml | 22 +++--- gen/adexchangebuyer1d4/src/build.rs | 38 ++++++---- gen/adexchangebuyer1d4/src/lib.rs | 6 ++ gen/adexchangeseller2-cli/Cargo.toml | 28 +++++--- gen/adexchangeseller2-cli/src/cmn.rs | 22 +++--- gen/adexchangeseller2-cli/src/main.rs | 4 +- gen/adexchangeseller2/Cargo.toml | 22 +++--- gen/adexchangeseller2/src/build.rs | 38 ++++++---- gen/adexchangeseller2/src/lib.rs | 6 ++ gen/admin1_directory-cli/Cargo.toml | 28 +++++--- gen/admin1_directory-cli/src/cmn.rs | 22 +++--- gen/admin1_directory-cli/src/main.rs | 4 +- gen/admin1_directory/Cargo.toml | 22 +++--- gen/admin1_directory/src/build.rs | 38 ++++++---- gen/admin1_directory/src/lib.rs | 6 ++ gen/admin1_reports-cli/Cargo.toml | 28 +++++--- gen/admin1_reports-cli/src/cmn.rs | 22 +++--- gen/admin1_reports-cli/src/main.rs | 4 +- gen/admin1_reports/Cargo.toml | 22 +++--- gen/admin1_reports/src/build.rs | 38 ++++++---- gen/admin1_reports/src/lib.rs | 6 ++ gen/adsense1d4-cli/Cargo.toml | 28 +++++--- gen/adsense1d4-cli/src/cmn.rs | 22 +++--- gen/adsense1d4-cli/src/main.rs | 4 +- gen/adsense1d4/Cargo.toml | 22 +++--- gen/adsense1d4/src/build.rs | 38 ++++++---- gen/adsense1d4/src/lib.rs | 6 ++ gen/adsensehost4d1-cli/Cargo.toml | 28 +++++--- gen/adsensehost4d1-cli/src/cmn.rs | 22 +++--- gen/adsensehost4d1-cli/src/main.rs | 4 +- gen/adsensehost4d1/Cargo.toml | 22 +++--- gen/adsensehost4d1/src/build.rs | 38 ++++++---- gen/adsensehost4d1/src/lib.rs | 6 ++ gen/analytics3-cli/Cargo.toml | 28 +++++--- gen/analytics3-cli/src/cmn.rs | 22 +++--- gen/analytics3-cli/src/main.rs | 4 +- gen/analytics3/Cargo.toml | 22 +++--- gen/analytics3/src/build.rs | 38 ++++++---- gen/analytics3/src/lib.rs | 6 ++ gen/androidenterprise1-cli/Cargo.toml | 28 +++++--- gen/androidenterprise1-cli/src/cmn.rs | 22 +++--- gen/androidenterprise1-cli/src/main.rs | 4 +- gen/androidenterprise1/Cargo.toml | 22 +++--- gen/androidenterprise1/src/build.rs | 38 ++++++---- gen/androidenterprise1/src/lib.rs | 6 ++ gen/androidpublisher2-cli/Cargo.toml | 28 +++++--- gen/androidpublisher2-cli/src/cmn.rs | 22 +++--- gen/androidpublisher2-cli/src/main.rs | 4 +- gen/androidpublisher2/Cargo.toml | 22 +++--- gen/androidpublisher2/src/build.rs | 38 ++++++---- gen/androidpublisher2/src/lib.rs | 6 ++ gen/appengine1_beta4-cli/Cargo.toml | 28 +++++--- gen/appengine1_beta4-cli/src/cmn.rs | 22 +++--- gen/appengine1_beta4-cli/src/main.rs | 4 +- gen/appengine1_beta4/Cargo.toml | 22 +++--- gen/appengine1_beta4/src/build.rs | 38 ++++++---- gen/appengine1_beta4/src/lib.rs | 6 ++ gen/appengine1_beta5-cli/Cargo.toml | 28 +++++--- gen/appengine1_beta5-cli/src/cmn.rs | 22 +++--- gen/appengine1_beta5-cli/src/main.rs | 4 +- gen/appengine1_beta5/Cargo.toml | 22 +++--- gen/appengine1_beta5/src/build.rs | 38 ++++++---- gen/appengine1_beta5/src/lib.rs | 6 ++ gen/appsactivity1-cli/Cargo.toml | 28 +++++--- gen/appsactivity1-cli/src/cmn.rs | 22 +++--- gen/appsactivity1-cli/src/main.rs | 4 +- gen/appsactivity1/Cargo.toml | 22 +++--- gen/appsactivity1/src/build.rs | 38 ++++++---- gen/appsactivity1/src/lib.rs | 6 ++ gen/appstate1-cli/Cargo.toml | 28 +++++--- gen/appstate1-cli/src/cmn.rs | 22 +++--- gen/appstate1-cli/src/main.rs | 4 +- gen/appstate1/Cargo.toml | 22 +++--- gen/appstate1/src/build.rs | 38 ++++++---- gen/appstate1/src/lib.rs | 6 ++ gen/autoscaler1_beta2-cli/Cargo.toml | 28 +++++--- gen/autoscaler1_beta2-cli/src/cmn.rs | 22 +++--- gen/autoscaler1_beta2-cli/src/main.rs | 4 +- gen/autoscaler1_beta2/Cargo.toml | 22 +++--- gen/autoscaler1_beta2/src/build.rs | 38 ++++++---- gen/autoscaler1_beta2/src/lib.rs | 6 ++ gen/bigquery2-cli/Cargo.toml | 28 +++++--- gen/bigquery2-cli/src/cmn.rs | 22 +++--- gen/bigquery2-cli/src/main.rs | 4 +- gen/bigquery2/Cargo.toml | 22 +++--- gen/bigquery2/src/build.rs | 38 ++++++---- gen/bigquery2/src/lib.rs | 6 ++ gen/blogger3-cli/Cargo.toml | 28 +++++--- gen/blogger3-cli/src/cmn.rs | 22 +++--- gen/blogger3-cli/src/main.rs | 4 +- gen/blogger3/Cargo.toml | 22 +++--- gen/blogger3/src/build.rs | 38 ++++++---- gen/blogger3/src/lib.rs | 6 ++ gen/books1-cli/Cargo.toml | 28 +++++--- gen/books1-cli/src/cmn.rs | 22 +++--- gen/books1-cli/src/main.rs | 4 +- gen/books1/Cargo.toml | 22 +++--- gen/books1/src/build.rs | 38 ++++++---- gen/books1/src/lib.rs | 6 ++ gen/calendar3-cli/Cargo.toml | 28 +++++--- gen/calendar3-cli/src/cmn.rs | 22 +++--- gen/calendar3-cli/src/main.rs | 4 +- gen/calendar3/Cargo.toml | 22 +++--- gen/calendar3/src/build.rs | 38 ++++++---- gen/calendar3/src/lib.rs | 6 ++ gen/civicinfo2-cli/Cargo.toml | 28 +++++--- gen/civicinfo2-cli/src/cmn.rs | 22 +++--- gen/civicinfo2-cli/src/main.rs | 4 +- gen/civicinfo2/Cargo.toml | 22 +++--- gen/civicinfo2/src/build.rs | 38 ++++++---- gen/civicinfo2/src/lib.rs | 6 ++ gen/classroom1-cli/Cargo.toml | 28 +++++--- gen/classroom1-cli/src/cmn.rs | 22 +++--- gen/classroom1-cli/src/main.rs | 4 +- gen/classroom1/Cargo.toml | 22 +++--- gen/classroom1/src/build.rs | 38 ++++++---- gen/classroom1/src/lib.rs | 6 ++ gen/cloudbilling1-cli/Cargo.toml | 28 +++++--- gen/cloudbilling1-cli/src/cmn.rs | 22 +++--- gen/cloudbilling1-cli/src/main.rs | 4 +- gen/cloudbilling1/Cargo.toml | 22 +++--- gen/cloudbilling1/src/build.rs | 38 ++++++---- gen/cloudbilling1/src/lib.rs | 6 ++ gen/clouddebugger2-cli/Cargo.toml | 28 +++++--- gen/clouddebugger2-cli/src/cmn.rs | 22 +++--- gen/clouddebugger2-cli/src/main.rs | 4 +- gen/clouddebugger2/Cargo.toml | 22 +++--- gen/clouddebugger2/src/build.rs | 38 ++++++---- gen/clouddebugger2/src/lib.rs | 6 ++ gen/cloudlatencytest2-cli/Cargo.toml | 28 +++++--- gen/cloudlatencytest2-cli/src/cmn.rs | 22 +++--- gen/cloudlatencytest2-cli/src/main.rs | 4 +- gen/cloudlatencytest2/Cargo.toml | 22 +++--- gen/cloudlatencytest2/src/build.rs | 38 ++++++---- gen/cloudlatencytest2/src/lib.rs | 6 ++ gen/cloudmonitoring2_beta2-cli/Cargo.toml | 28 +++++--- gen/cloudmonitoring2_beta2-cli/src/cmn.rs | 22 +++--- gen/cloudmonitoring2_beta2-cli/src/main.rs | 4 +- gen/cloudmonitoring2_beta2/Cargo.toml | 22 +++--- gen/cloudmonitoring2_beta2/src/build.rs | 38 ++++++---- gen/cloudmonitoring2_beta2/src/lib.rs | 6 ++ gen/cloudresourcemanager1-cli/Cargo.toml | 28 +++++--- gen/cloudresourcemanager1-cli/src/cmn.rs | 22 +++--- gen/cloudresourcemanager1-cli/src/main.rs | 4 +- gen/cloudresourcemanager1/Cargo.toml | 22 +++--- gen/cloudresourcemanager1/src/build.rs | 38 ++++++---- gen/cloudresourcemanager1/src/lib.rs | 6 ++ .../Cargo.toml | 28 +++++--- .../src/cmn.rs | 22 +++--- .../src/main.rs | 4 +- gen/cloudresourcemanager1_beta1/Cargo.toml | 22 +++--- gen/cloudresourcemanager1_beta1/src/build.rs | 38 ++++++---- gen/cloudresourcemanager1_beta1/src/lib.rs | 6 ++ gen/cloudtrace1-cli/Cargo.toml | 28 +++++--- gen/cloudtrace1-cli/src/cmn.rs | 22 +++--- gen/cloudtrace1-cli/src/main.rs | 4 +- gen/cloudtrace1/Cargo.toml | 22 +++--- gen/cloudtrace1/src/build.rs | 38 ++++++---- gen/cloudtrace1/src/lib.rs | 6 ++ gen/clouduseraccountsvm_beta-cli/Cargo.toml | 28 +++++--- gen/clouduseraccountsvm_beta-cli/src/cmn.rs | 22 +++--- gen/clouduseraccountsvm_beta-cli/src/main.rs | 4 +- gen/clouduseraccountsvm_beta/Cargo.toml | 22 +++--- gen/clouduseraccountsvm_beta/src/build.rs | 38 ++++++---- gen/clouduseraccountsvm_beta/src/lib.rs | 6 ++ gen/compute1-cli/Cargo.toml | 28 +++++--- gen/compute1-cli/src/cmn.rs | 22 +++--- gen/compute1-cli/src/main.rs | 4 +- gen/compute1/Cargo.toml | 22 +++--- gen/compute1/src/build.rs | 38 ++++++---- gen/compute1/src/lib.rs | 6 ++ gen/consumersurveys2-cli/Cargo.toml | 28 +++++--- gen/consumersurveys2-cli/src/cmn.rs | 22 +++--- gen/consumersurveys2-cli/src/main.rs | 4 +- gen/consumersurveys2/Cargo.toml | 22 +++--- gen/consumersurveys2/src/build.rs | 38 ++++++---- gen/consumersurveys2/src/lib.rs | 6 ++ gen/container1-cli/Cargo.toml | 28 +++++--- gen/container1-cli/src/cmn.rs | 22 +++--- gen/container1-cli/src/main.rs | 4 +- gen/container1/Cargo.toml | 22 +++--- gen/container1/src/build.rs | 38 ++++++---- gen/container1/src/lib.rs | 6 ++ gen/content2-cli/Cargo.toml | 28 +++++--- gen/content2-cli/src/cmn.rs | 22 +++--- gen/content2-cli/src/main.rs | 4 +- gen/content2/Cargo.toml | 22 +++--- gen/content2/src/build.rs | 38 ++++++---- gen/content2/src/lib.rs | 6 ++ gen/content2_sandbox-cli/Cargo.toml | 28 +++++--- gen/content2_sandbox-cli/src/cmn.rs | 22 +++--- gen/content2_sandbox-cli/src/main.rs | 4 +- gen/content2_sandbox/Cargo.toml | 22 +++--- gen/content2_sandbox/src/build.rs | 38 ++++++---- gen/content2_sandbox/src/lib.rs | 6 ++ gen/coordinate1-cli/Cargo.toml | 28 +++++--- gen/coordinate1-cli/src/cmn.rs | 22 +++--- gen/coordinate1-cli/src/main.rs | 4 +- gen/coordinate1/Cargo.toml | 22 +++--- gen/coordinate1/src/build.rs | 38 ++++++---- gen/coordinate1/src/lib.rs | 6 ++ gen/customsearch1-cli/Cargo.toml | 28 +++++--- gen/customsearch1-cli/src/cmn.rs | 22 +++--- gen/customsearch1-cli/src/main.rs | 4 +- gen/customsearch1/Cargo.toml | 22 +++--- gen/customsearch1/src/build.rs | 38 ++++++---- gen/customsearch1/src/lib.rs | 6 ++ gen/dataproc1-cli/Cargo.toml | 28 +++++--- gen/dataproc1-cli/src/cmn.rs | 22 +++--- gen/dataproc1-cli/src/main.rs | 4 +- gen/dataproc1/Cargo.toml | 22 +++--- gen/dataproc1/src/build.rs | 38 ++++++---- gen/dataproc1/src/lib.rs | 6 ++ gen/datastore1_beta2-cli/Cargo.toml | 28 +++++--- gen/datastore1_beta2-cli/src/cmn.rs | 22 +++--- gen/datastore1_beta2-cli/src/main.rs | 4 +- gen/datastore1_beta2/Cargo.toml | 22 +++--- gen/datastore1_beta2/src/build.rs | 38 ++++++---- gen/datastore1_beta2/src/lib.rs | 6 ++ gen/deploymentmanager2-cli/Cargo.toml | 28 +++++--- gen/deploymentmanager2-cli/src/cmn.rs | 22 +++--- gen/deploymentmanager2-cli/src/main.rs | 4 +- gen/deploymentmanager2/Cargo.toml | 22 +++--- gen/deploymentmanager2/src/build.rs | 38 ++++++---- gen/deploymentmanager2/src/lib.rs | 6 ++ gen/deploymentmanager2_beta2-cli/Cargo.toml | 28 +++++--- gen/deploymentmanager2_beta2-cli/src/cmn.rs | 22 +++--- gen/deploymentmanager2_beta2-cli/src/main.rs | 4 +- gen/deploymentmanager2_beta2/Cargo.toml | 24 ++++--- gen/deploymentmanager2_beta2/README.md | 2 +- gen/deploymentmanager2_beta2/src/build.rs | 38 ++++++---- gen/deploymentmanager2_beta2/src/lib.rs | 8 ++- gen/deploymentmanager2_beta2/src/lib.rs.in | 69 ++++++++----------- gen/dfareporting2d1-cli/Cargo.toml | 28 +++++--- gen/dfareporting2d1-cli/src/cmn.rs | 22 +++--- gen/dfareporting2d1-cli/src/main.rs | 4 +- gen/dfareporting2d1/Cargo.toml | 22 +++--- gen/dfareporting2d1/src/build.rs | 38 ++++++---- gen/dfareporting2d1/src/lib.rs | 6 ++ gen/dfareporting2d2-cli/Cargo.toml | 28 +++++--- gen/dfareporting2d2-cli/src/cmn.rs | 22 +++--- gen/dfareporting2d2-cli/src/main.rs | 4 +- gen/dfareporting2d2/Cargo.toml | 22 +++--- gen/dfareporting2d2/src/build.rs | 38 ++++++---- gen/dfareporting2d2/src/lib.rs | 6 ++ gen/dfareporting2d3-cli/Cargo.toml | 28 +++++--- gen/dfareporting2d3-cli/src/cmn.rs | 22 +++--- gen/dfareporting2d3-cli/src/main.rs | 4 +- gen/dfareporting2d3/Cargo.toml | 22 +++--- gen/dfareporting2d3/src/build.rs | 38 ++++++---- gen/dfareporting2d3/src/lib.rs | 6 ++ gen/dfareporting2d4-cli/Cargo.toml | 28 +++++--- gen/dfareporting2d4-cli/src/cmn.rs | 22 +++--- gen/dfareporting2d4-cli/src/main.rs | 4 +- gen/dfareporting2d4/Cargo.toml | 22 +++--- gen/dfareporting2d4/src/build.rs | 38 ++++++---- gen/dfareporting2d4/src/lib.rs | 6 ++ gen/discovery1-cli/Cargo.toml | 28 +++++--- gen/discovery1-cli/src/cmn.rs | 22 +++--- gen/discovery1-cli/src/main.rs | 4 +- gen/discovery1/Cargo.toml | 22 +++--- gen/discovery1/src/build.rs | 38 ++++++---- gen/discovery1/src/lib.rs | 6 ++ gen/dns1-cli/Cargo.toml | 28 +++++--- gen/dns1-cli/src/cmn.rs | 22 +++--- gen/dns1-cli/src/main.rs | 4 +- gen/dns1/Cargo.toml | 22 +++--- gen/dns1/src/build.rs | 38 ++++++---- gen/dns1/src/lib.rs | 6 ++ gen/doubleclickbidmanager1-cli/Cargo.toml | 28 +++++--- gen/doubleclickbidmanager1-cli/src/cmn.rs | 22 +++--- gen/doubleclickbidmanager1-cli/src/main.rs | 4 +- gen/doubleclickbidmanager1/Cargo.toml | 22 +++--- gen/doubleclickbidmanager1/src/build.rs | 38 ++++++---- gen/doubleclickbidmanager1/src/lib.rs | 6 ++ gen/doubleclicksearch2-cli/Cargo.toml | 28 +++++--- gen/doubleclicksearch2-cli/src/cmn.rs | 22 +++--- gen/doubleclicksearch2-cli/src/main.rs | 4 +- gen/doubleclicksearch2/Cargo.toml | 22 +++--- gen/doubleclicksearch2/src/build.rs | 38 ++++++---- gen/doubleclicksearch2/src/lib.rs | 6 ++ gen/drive2-cli/Cargo.toml | 28 +++++--- gen/drive2-cli/src/cmn.rs | 22 +++--- gen/drive2-cli/src/main.rs | 4 +- gen/drive2/Cargo.toml | 22 +++--- gen/drive2/src/build.rs | 38 ++++++---- gen/drive2/src/lib.rs | 6 ++ gen/drive3-cli/Cargo.toml | 28 +++++--- gen/drive3-cli/src/cmn.rs | 22 +++--- gen/drive3-cli/src/main.rs | 4 +- gen/drive3/Cargo.toml | 22 +++--- gen/drive3/src/build.rs | 38 ++++++---- gen/drive3/src/lib.rs | 6 ++ gen/fitness1-cli/Cargo.toml | 28 +++++--- gen/fitness1-cli/src/cmn.rs | 22 +++--- gen/fitness1-cli/src/main.rs | 4 +- gen/fitness1/Cargo.toml | 22 +++--- gen/fitness1/src/build.rs | 38 ++++++---- gen/fitness1/src/lib.rs | 6 ++ gen/freebase1-cli/Cargo.toml | 28 +++++--- gen/freebase1-cli/src/cmn.rs | 22 +++--- gen/freebase1-cli/src/main.rs | 4 +- gen/freebase1/Cargo.toml | 22 +++--- gen/freebase1/src/build.rs | 38 ++++++---- gen/freebase1/src/lib.rs | 6 ++ gen/fusiontables2-cli/Cargo.toml | 28 +++++--- gen/fusiontables2-cli/src/cmn.rs | 22 +++--- gen/fusiontables2-cli/src/main.rs | 4 +- gen/fusiontables2/Cargo.toml | 22 +++--- gen/fusiontables2/src/build.rs | 38 ++++++---- gen/fusiontables2/src/lib.rs | 6 ++ gen/games1-cli/Cargo.toml | 28 +++++--- gen/games1-cli/src/cmn.rs | 22 +++--- gen/games1-cli/src/main.rs | 4 +- gen/games1/Cargo.toml | 22 +++--- gen/games1/src/build.rs | 38 ++++++---- gen/games1/src/lib.rs | 6 ++ .../Cargo.toml | 28 +++++--- .../src/cmn.rs | 22 +++--- .../src/main.rs | 4 +- .../Cargo.toml | 22 +++--- .../src/build.rs | 38 ++++++---- .../src/lib.rs | 6 ++ .../Cargo.toml | 28 +++++--- .../src/cmn.rs | 22 +++--- .../src/main.rs | 4 +- gen/gamesmanagement1_management/Cargo.toml | 22 +++--- gen/gamesmanagement1_management/src/build.rs | 38 ++++++---- gen/gamesmanagement1_management/src/lib.rs | 6 ++ gen/gan1_beta1-cli/Cargo.toml | 28 +++++--- gen/gan1_beta1-cli/src/cmn.rs | 22 +++--- gen/gan1_beta1-cli/src/main.rs | 4 +- gen/gan1_beta1/Cargo.toml | 22 +++--- gen/gan1_beta1/src/build.rs | 38 ++++++---- gen/gan1_beta1/src/lib.rs | 6 ++ gen/genomics1-cli/Cargo.toml | 28 +++++--- gen/genomics1-cli/src/cmn.rs | 22 +++--- gen/genomics1-cli/src/main.rs | 4 +- gen/genomics1/Cargo.toml | 22 +++--- gen/genomics1/src/build.rs | 38 ++++++---- gen/genomics1/src/lib.rs | 6 ++ gen/gmail1-cli/Cargo.toml | 28 +++++--- gen/gmail1-cli/src/cmn.rs | 22 +++--- gen/gmail1-cli/src/main.rs | 4 +- gen/gmail1/Cargo.toml | 22 +++--- gen/gmail1/src/build.rs | 38 ++++++---- gen/gmail1/src/lib.rs | 6 ++ gen/groupsmigration1-cli/Cargo.toml | 28 +++++--- gen/groupsmigration1-cli/src/cmn.rs | 22 +++--- gen/groupsmigration1-cli/src/main.rs | 4 +- gen/groupsmigration1/Cargo.toml | 22 +++--- gen/groupsmigration1/src/build.rs | 38 ++++++---- gen/groupsmigration1/src/lib.rs | 6 ++ gen/groupssettings1-cli/Cargo.toml | 28 +++++--- gen/groupssettings1-cli/src/cmn.rs | 22 +++--- gen/groupssettings1-cli/src/main.rs | 4 +- gen/groupssettings1/Cargo.toml | 22 +++--- gen/groupssettings1/src/build.rs | 38 ++++++---- gen/groupssettings1/src/lib.rs | 6 ++ gen/iam1-cli/Cargo.toml | 28 +++++--- gen/iam1-cli/src/cmn.rs | 22 +++--- gen/iam1-cli/src/main.rs | 4 +- gen/iam1/Cargo.toml | 22 +++--- gen/iam1/src/build.rs | 38 ++++++---- gen/iam1/src/lib.rs | 6 ++ gen/identitytoolkit3-cli/Cargo.toml | 28 +++++--- gen/identitytoolkit3-cli/src/cmn.rs | 22 +++--- gen/identitytoolkit3-cli/src/main.rs | 4 +- gen/identitytoolkit3/Cargo.toml | 22 +++--- gen/identitytoolkit3/src/build.rs | 38 ++++++---- gen/identitytoolkit3/src/lib.rs | 6 ++ gen/kgsearch1-cli/Cargo.toml | 28 +++++--- gen/kgsearch1-cli/src/cmn.rs | 22 +++--- gen/kgsearch1-cli/src/main.rs | 4 +- gen/kgsearch1/Cargo.toml | 22 +++--- gen/kgsearch1/src/build.rs | 38 ++++++---- gen/kgsearch1/src/lib.rs | 6 ++ gen/licensing1-cli/Cargo.toml | 28 +++++--- gen/licensing1-cli/src/cmn.rs | 22 +++--- gen/licensing1-cli/src/main.rs | 4 +- gen/licensing1/Cargo.toml | 22 +++--- gen/licensing1/src/build.rs | 38 ++++++---- gen/licensing1/src/lib.rs | 6 ++ gen/logging2_beta1-cli/Cargo.toml | 28 +++++--- gen/logging2_beta1-cli/src/cmn.rs | 22 +++--- gen/logging2_beta1-cli/src/main.rs | 4 +- gen/logging2_beta1/Cargo.toml | 22 +++--- gen/logging2_beta1/src/build.rs | 38 ++++++---- gen/logging2_beta1/src/lib.rs | 6 ++ gen/manager1_beta2-cli/Cargo.toml | 28 +++++--- gen/manager1_beta2-cli/src/cmn.rs | 22 +++--- gen/manager1_beta2-cli/src/main.rs | 4 +- gen/manager1_beta2/Cargo.toml | 22 +++--- gen/manager1_beta2/src/build.rs | 38 ++++++---- gen/manager1_beta2/src/lib.rs | 6 ++ gen/mirror1-cli/Cargo.toml | 28 +++++--- gen/mirror1-cli/src/cmn.rs | 22 +++--- gen/mirror1-cli/src/main.rs | 4 +- gen/mirror1/Cargo.toml | 22 +++--- gen/mirror1/src/build.rs | 38 ++++++---- gen/mirror1/src/lib.rs | 6 ++ gen/monitoring3-cli/Cargo.toml | 28 +++++--- gen/monitoring3-cli/src/cmn.rs | 22 +++--- gen/monitoring3-cli/src/main.rs | 4 +- gen/monitoring3/Cargo.toml | 22 +++--- gen/monitoring3/src/build.rs | 38 ++++++---- gen/monitoring3/src/lib.rs | 6 ++ gen/oauth2_v2-cli/Cargo.toml | 28 +++++--- gen/oauth2_v2-cli/src/cmn.rs | 22 +++--- gen/oauth2_v2-cli/src/main.rs | 4 +- gen/oauth2_v2/Cargo.toml | 22 +++--- gen/oauth2_v2/src/build.rs | 38 ++++++---- gen/oauth2_v2/src/lib.rs | 6 ++ gen/pagespeedonline2-cli/Cargo.toml | 28 +++++--- gen/pagespeedonline2-cli/src/cmn.rs | 22 +++--- gen/pagespeedonline2-cli/src/main.rs | 4 +- gen/pagespeedonline2/Cargo.toml | 22 +++--- gen/pagespeedonline2/src/build.rs | 38 ++++++---- gen/pagespeedonline2/src/lib.rs | 6 ++ gen/partners2-cli/Cargo.toml | 28 +++++--- gen/partners2-cli/src/cmn.rs | 22 +++--- gen/partners2-cli/src/main.rs | 4 +- gen/partners2/Cargo.toml | 22 +++--- gen/partners2/src/build.rs | 38 ++++++---- gen/partners2/src/lib.rs | 6 ++ gen/people1-cli/Cargo.toml | 28 +++++--- gen/people1-cli/src/cmn.rs | 22 +++--- gen/people1-cli/src/main.rs | 4 +- gen/people1/Cargo.toml | 22 +++--- gen/people1/src/build.rs | 38 ++++++---- gen/people1/src/lib.rs | 6 ++ gen/playmoviespartner1-cli/Cargo.toml | 28 +++++--- gen/playmoviespartner1-cli/src/cmn.rs | 22 +++--- gen/playmoviespartner1-cli/src/main.rs | 4 +- gen/playmoviespartner1/Cargo.toml | 22 +++--- gen/playmoviespartner1/src/build.rs | 38 ++++++---- gen/playmoviespartner1/src/lib.rs | 6 ++ gen/plus1-cli/Cargo.toml | 28 +++++--- gen/plus1-cli/src/cmn.rs | 22 +++--- gen/plus1-cli/src/main.rs | 4 +- gen/plus1/Cargo.toml | 22 +++--- gen/plus1/src/build.rs | 38 ++++++---- gen/plus1/src/lib.rs | 6 ++ gen/plusdomains1-cli/Cargo.toml | 28 +++++--- gen/plusdomains1-cli/src/cmn.rs | 22 +++--- gen/plusdomains1-cli/src/main.rs | 4 +- gen/plusdomains1/Cargo.toml | 22 +++--- gen/plusdomains1/src/build.rs | 38 ++++++---- gen/plusdomains1/src/lib.rs | 6 ++ gen/prediction1d6-cli/Cargo.toml | 28 +++++--- gen/prediction1d6-cli/src/cmn.rs | 22 +++--- gen/prediction1d6-cli/src/main.rs | 4 +- gen/prediction1d6/Cargo.toml | 22 +++--- gen/prediction1d6/src/build.rs | 38 ++++++---- gen/prediction1d6/src/lib.rs | 6 ++ gen/proximitybeacon1_beta1-cli/Cargo.toml | 28 +++++--- gen/proximitybeacon1_beta1-cli/src/cmn.rs | 22 +++--- gen/proximitybeacon1_beta1-cli/src/main.rs | 4 +- gen/proximitybeacon1_beta1/Cargo.toml | 22 +++--- gen/proximitybeacon1_beta1/src/build.rs | 38 ++++++---- gen/proximitybeacon1_beta1/src/lib.rs | 6 ++ gen/pubsub1-cli/Cargo.toml | 28 +++++--- gen/pubsub1-cli/src/cmn.rs | 22 +++--- gen/pubsub1-cli/src/main.rs | 4 +- gen/pubsub1/Cargo.toml | 22 +++--- gen/pubsub1/src/build.rs | 38 ++++++---- gen/pubsub1/src/lib.rs | 6 ++ gen/pubsub1_beta2-cli/Cargo.toml | 28 +++++--- gen/pubsub1_beta2-cli/src/cmn.rs | 22 +++--- gen/pubsub1_beta2-cli/src/main.rs | 4 +- gen/pubsub1_beta2/Cargo.toml | 22 +++--- gen/pubsub1_beta2/src/build.rs | 38 ++++++---- gen/pubsub1_beta2/src/lib.rs | 6 ++ gen/qpxexpress1-cli/Cargo.toml | 28 +++++--- gen/qpxexpress1-cli/src/cmn.rs | 22 +++--- gen/qpxexpress1-cli/src/main.rs | 4 +- gen/qpxexpress1/Cargo.toml | 22 +++--- gen/qpxexpress1/src/build.rs | 38 ++++++---- gen/qpxexpress1/src/lib.rs | 6 ++ gen/replicapool1_beta2-cli/Cargo.toml | 28 +++++--- gen/replicapool1_beta2-cli/src/cmn.rs | 22 +++--- gen/replicapool1_beta2-cli/src/main.rs | 4 +- gen/replicapool1_beta2/Cargo.toml | 22 +++--- gen/replicapool1_beta2/src/build.rs | 38 ++++++---- gen/replicapool1_beta2/src/lib.rs | 6 ++ gen/replicapoolupdater1_beta1-cli/Cargo.toml | 28 +++++--- gen/replicapoolupdater1_beta1-cli/src/cmn.rs | 22 +++--- gen/replicapoolupdater1_beta1-cli/src/main.rs | 4 +- gen/replicapoolupdater1_beta1/Cargo.toml | 22 +++--- gen/replicapoolupdater1_beta1/src/build.rs | 38 ++++++---- gen/replicapoolupdater1_beta1/src/lib.rs | 6 ++ gen/reseller1_sandbox-cli/Cargo.toml | 28 +++++--- gen/reseller1_sandbox-cli/src/cmn.rs | 22 +++--- gen/reseller1_sandbox-cli/src/main.rs | 4 +- gen/reseller1_sandbox/Cargo.toml | 22 +++--- gen/reseller1_sandbox/src/build.rs | 38 ++++++---- gen/reseller1_sandbox/src/lib.rs | 6 ++ gen/resourceviews1_beta2-cli/Cargo.toml | 28 +++++--- gen/resourceviews1_beta2-cli/src/cmn.rs | 22 +++--- gen/resourceviews1_beta2-cli/src/main.rs | 4 +- gen/resourceviews1_beta2/Cargo.toml | 22 +++--- gen/resourceviews1_beta2/src/build.rs | 38 ++++++---- gen/resourceviews1_beta2/src/lib.rs | 6 ++ gen/script1-cli/Cargo.toml | 28 +++++--- gen/script1-cli/src/cmn.rs | 22 +++--- gen/script1-cli/src/main.rs | 4 +- gen/script1/Cargo.toml | 22 +++--- gen/script1/src/build.rs | 38 ++++++---- gen/script1/src/lib.rs | 6 ++ gen/serviceregistryalpha-cli/Cargo.toml | 28 +++++--- gen/serviceregistryalpha-cli/src/cmn.rs | 22 +++--- gen/serviceregistryalpha-cli/src/main.rs | 4 +- gen/serviceregistryalpha/Cargo.toml | 22 +++--- gen/serviceregistryalpha/src/build.rs | 38 ++++++---- gen/serviceregistryalpha/src/lib.rs | 6 ++ gen/siteverification1-cli/Cargo.toml | 28 +++++--- gen/siteverification1-cli/src/cmn.rs | 22 +++--- gen/siteverification1-cli/src/main.rs | 4 +- gen/siteverification1/Cargo.toml | 22 +++--- gen/siteverification1/src/build.rs | 38 ++++++---- gen/siteverification1/src/lib.rs | 6 ++ gen/spectrum1_explorer-cli/Cargo.toml | 28 +++++--- gen/spectrum1_explorer-cli/src/cmn.rs | 22 +++--- gen/spectrum1_explorer-cli/src/main.rs | 4 +- gen/spectrum1_explorer/Cargo.toml | 22 +++--- gen/spectrum1_explorer/src/build.rs | 38 ++++++---- gen/spectrum1_explorer/src/lib.rs | 6 ++ gen/sqladmin1_beta4-cli/Cargo.toml | 28 +++++--- gen/sqladmin1_beta4-cli/src/cmn.rs | 22 +++--- gen/sqladmin1_beta4-cli/src/main.rs | 4 +- gen/sqladmin1_beta4/Cargo.toml | 22 +++--- gen/sqladmin1_beta4/src/build.rs | 38 ++++++---- gen/sqladmin1_beta4/src/lib.rs | 6 ++ gen/storage1-cli/Cargo.toml | 28 +++++--- gen/storage1-cli/src/cmn.rs | 22 +++--- gen/storage1-cli/src/main.rs | 4 +- gen/storage1/Cargo.toml | 22 +++--- gen/storage1/src/build.rs | 38 ++++++---- gen/storage1/src/lib.rs | 6 ++ gen/storagetransfer1-cli/Cargo.toml | 28 +++++--- gen/storagetransfer1-cli/src/cmn.rs | 22 +++--- gen/storagetransfer1-cli/src/main.rs | 4 +- gen/storagetransfer1/Cargo.toml | 22 +++--- gen/storagetransfer1/src/build.rs | 38 ++++++---- gen/storagetransfer1/src/lib.rs | 6 ++ gen/tagmanager1-cli/Cargo.toml | 28 +++++--- gen/tagmanager1-cli/src/cmn.rs | 22 +++--- gen/tagmanager1-cli/src/main.rs | 4 +- gen/tagmanager1/Cargo.toml | 22 +++--- gen/tagmanager1/src/build.rs | 38 ++++++---- gen/tagmanager1/src/lib.rs | 6 ++ gen/taskqueue1_beta2-cli/Cargo.toml | 28 +++++--- gen/taskqueue1_beta2-cli/src/cmn.rs | 22 +++--- gen/taskqueue1_beta2-cli/src/main.rs | 4 +- gen/taskqueue1_beta2/Cargo.toml | 22 +++--- gen/taskqueue1_beta2/src/build.rs | 38 ++++++---- gen/taskqueue1_beta2/src/lib.rs | 6 ++ gen/tasks1-cli/Cargo.toml | 28 +++++--- gen/tasks1-cli/src/cmn.rs | 22 +++--- gen/tasks1-cli/src/main.rs | 4 +- gen/tasks1/Cargo.toml | 22 +++--- gen/tasks1/src/build.rs | 38 ++++++---- gen/tasks1/src/lib.rs | 6 ++ gen/toolresults1_beta3-cli/Cargo.toml | 28 +++++--- gen/toolresults1_beta3-cli/src/cmn.rs | 22 +++--- gen/toolresults1_beta3-cli/src/main.rs | 4 +- gen/toolresults1_beta3/Cargo.toml | 22 +++--- gen/toolresults1_beta3/src/build.rs | 38 ++++++---- gen/toolresults1_beta3/src/lib.rs | 6 ++ gen/translate2-cli/Cargo.toml | 28 +++++--- gen/translate2-cli/src/cmn.rs | 22 +++--- gen/translate2-cli/src/main.rs | 4 +- gen/translate2/Cargo.toml | 22 +++--- gen/translate2/src/build.rs | 38 ++++++---- gen/translate2/src/lib.rs | 6 ++ gen/urlshortener1-cli/Cargo.toml | 28 +++++--- gen/urlshortener1-cli/src/cmn.rs | 22 +++--- gen/urlshortener1-cli/src/main.rs | 4 +- gen/urlshortener1/Cargo.toml | 22 +++--- gen/urlshortener1/src/build.rs | 38 ++++++---- gen/urlshortener1/src/lib.rs | 6 ++ gen/webfonts1-cli/Cargo.toml | 28 +++++--- gen/webfonts1-cli/src/cmn.rs | 22 +++--- gen/webfonts1-cli/src/main.rs | 4 +- gen/webfonts1/Cargo.toml | 22 +++--- gen/webfonts1/src/build.rs | 38 ++++++---- gen/webfonts1/src/lib.rs | 6 ++ gen/webmasters3-cli/Cargo.toml | 28 +++++--- gen/webmasters3-cli/src/cmn.rs | 22 +++--- gen/webmasters3-cli/src/main.rs | 4 +- gen/webmasters3/Cargo.toml | 22 +++--- gen/webmasters3/src/build.rs | 38 ++++++---- gen/webmasters3/src/lib.rs | 6 ++ gen/youtube3-cli/Cargo.toml | 28 +++++--- gen/youtube3-cli/src/cmn.rs | 22 +++--- gen/youtube3-cli/src/main.rs | 4 +- gen/youtube3/cargo.toml | 22 +++--- gen/youtube3/src/build.rs | 38 ++++++---- gen/youtube3/src/lib.rs | 6 ++ gen/youtubeanalytics1-cli/Cargo.toml | 28 +++++--- gen/youtubeanalytics1-cli/src/cmn.rs | 22 +++--- gen/youtubeanalytics1-cli/src/main.rs | 4 +- gen/youtubeanalytics1/Cargo.toml | 22 +++--- gen/youtubeanalytics1/src/build.rs | 38 ++++++---- gen/youtubeanalytics1/src/lib.rs | 6 ++ gen/youtubereporting1-cli/Cargo.toml | 28 +++++--- gen/youtubereporting1-cli/src/cmn.rs | 22 +++--- gen/youtubereporting1-cli/src/main.rs | 4 +- gen/youtubereporting1/Cargo.toml | 22 +++--- gen/youtubereporting1/src/build.rs | 38 ++++++---- gen/youtubereporting1/src/lib.rs | 6 ++ 620 files changed, 7859 insertions(+), 4576 deletions(-) diff --git a/gen/adexchangebuyer1d3-cli/Cargo.toml b/gen/adexchangebuyer1d3-cli/Cargo.toml index d1ae7b3db7..bef8081b02 100644 --- a/gen/adexchangebuyer1d3-cli/Cargo.toml +++ b/gen/adexchangebuyer1d3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["adexchangebuyer", "google", "cli"] name = "adexchangebuyer1d3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-adexchangebuyer1d3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-adexchangebuyer1d3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-adexchangebuyer1d3] path = "../adexchangebuyer1d3" +optional = true +default-features = false diff --git a/gen/adexchangebuyer1d3-cli/src/cmn.rs b/gen/adexchangebuyer1d3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/adexchangebuyer1d3-cli/src/cmn.rs +++ b/gen/adexchangebuyer1d3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/adexchangebuyer1d3-cli/src/main.rs b/gen/adexchangebuyer1d3-cli/src/main.rs index 9ad0d081c9..3d7c4a67e7 100644 --- a/gen/adexchangebuyer1d3-cli/src/main.rs +++ b/gen/adexchangebuyer1d3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1704,7 +1704,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "adexchangebuyer1d3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/adexchangebuyer1d3/Cargo.toml b/gen/adexchangebuyer1d3/Cargo.toml index 8d9ecb19e2..284dd36699 100644 --- a/gen/adexchangebuyer1d3/Cargo.toml +++ b/gen/adexchangebuyer1d3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/adexchangebuyer1d3/src/build.rs b/gen/adexchangebuyer1d3/src/build.rs index c978de7c6b..2744fd6456 100644 --- a/gen/adexchangebuyer1d3/src/build.rs +++ b/gen/adexchangebuyer1d3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-adexchangebuyer1d3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-adexchangebuyer1d3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/adexchangebuyer1d3/src/lib.rs b/gen/adexchangebuyer1d3/src/lib.rs index 958e415296..ebf8aca5a1 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs +++ b/gen/adexchangebuyer1d3/src/lib.rs @@ -193,6 +193,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/adexchangebuyer1d4-cli/Cargo.toml b/gen/adexchangebuyer1d4-cli/Cargo.toml index 0357408185..929cb77da8 100644 --- a/gen/adexchangebuyer1d4-cli/Cargo.toml +++ b/gen/adexchangebuyer1d4-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["adexchangebuyer", "google", "cli"] name = "adexchangebuyer1d4" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-adexchangebuyer1d4/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-adexchangebuyer1d4/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-adexchangebuyer1d4] path = "../adexchangebuyer1d4" +optional = true +default-features = false diff --git a/gen/adexchangebuyer1d4-cli/src/cmn.rs b/gen/adexchangebuyer1d4-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/adexchangebuyer1d4-cli/src/cmn.rs +++ b/gen/adexchangebuyer1d4-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/adexchangebuyer1d4-cli/src/main.rs b/gen/adexchangebuyer1d4-cli/src/main.rs index 1404cbe3f1..25ec967f31 100644 --- a/gen/adexchangebuyer1d4-cli/src/main.rs +++ b/gen/adexchangebuyer1d4-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2948,7 +2948,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "adexchangebuyer1d4", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/adexchangebuyer1d4/Cargo.toml b/gen/adexchangebuyer1d4/Cargo.toml index 965d6929df..ead4a4783d 100644 --- a/gen/adexchangebuyer1d4/Cargo.toml +++ b/gen/adexchangebuyer1d4/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/adexchangebuyer1d4/src/build.rs b/gen/adexchangebuyer1d4/src/build.rs index fa7bd38c87..52d3083370 100644 --- a/gen/adexchangebuyer1d4/src/build.rs +++ b/gen/adexchangebuyer1d4/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-adexchangebuyer1d4", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-adexchangebuyer1d4", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/adexchangebuyer1d4/src/lib.rs b/gen/adexchangebuyer1d4/src/lib.rs index 542f2435f4..9eada1013a 100644 --- a/gen/adexchangebuyer1d4/src/lib.rs +++ b/gen/adexchangebuyer1d4/src/lib.rs @@ -205,6 +205,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/adexchangeseller2-cli/Cargo.toml b/gen/adexchangeseller2-cli/Cargo.toml index 33c52ad3f1..f008d9565a 100644 --- a/gen/adexchangeseller2-cli/Cargo.toml +++ b/gen/adexchangeseller2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["adexchangeseller", "google", "cli"] name = "adexchangeseller2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-adexchangeseller2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-adexchangeseller2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-adexchangeseller2] path = "../adexchangeseller2" +optional = true +default-features = false diff --git a/gen/adexchangeseller2-cli/src/cmn.rs b/gen/adexchangeseller2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/adexchangeseller2-cli/src/cmn.rs +++ b/gen/adexchangeseller2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/adexchangeseller2-cli/src/main.rs b/gen/adexchangeseller2-cli/src/main.rs index fc2f65aa9e..0526d8e497 100644 --- a/gen/adexchangeseller2-cli/src/main.rs +++ b/gen/adexchangeseller2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -950,7 +950,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "adexchangeseller2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/adexchangeseller2/Cargo.toml b/gen/adexchangeseller2/Cargo.toml index 5d582f74cf..7fe6dfcb48 100644 --- a/gen/adexchangeseller2/Cargo.toml +++ b/gen/adexchangeseller2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/adexchangeseller2/src/build.rs b/gen/adexchangeseller2/src/build.rs index 01d9dc38eb..60c054aa90 100644 --- a/gen/adexchangeseller2/src/build.rs +++ b/gen/adexchangeseller2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-adexchangeseller2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-adexchangeseller2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/adexchangeseller2/src/lib.rs b/gen/adexchangeseller2/src/lib.rs index 13aba638b8..9301a0dca4 100644 --- a/gen/adexchangeseller2/src/lib.rs +++ b/gen/adexchangeseller2/src/lib.rs @@ -196,6 +196,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/admin1_directory-cli/Cargo.toml b/gen/admin1_directory-cli/Cargo.toml index 27334ab0cd..233fd9ab1d 100644 --- a/gen/admin1_directory-cli/Cargo.toml +++ b/gen/admin1_directory-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["admin", "google", "cli"] name = "admin1-directory" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-admin1_directory/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-admin1_directory/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-admin1_directory] path = "../admin1_directory" +optional = true +default-features = false diff --git a/gen/admin1_directory-cli/src/cmn.rs b/gen/admin1_directory-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/admin1_directory-cli/src/cmn.rs +++ b/gen/admin1_directory-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/admin1_directory-cli/src/main.rs b/gen/admin1_directory-cli/src/main.rs index beaf9e3568..f406067147 100644 --- a/gen/admin1_directory-cli/src/main.rs +++ b/gen/admin1_directory-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -7171,7 +7171,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "admin1-directory", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/admin1_directory/Cargo.toml b/gen/admin1_directory/Cargo.toml index 9eac92452d..ae4274021b 100644 --- a/gen/admin1_directory/Cargo.toml +++ b/gen/admin1_directory/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/admin1_directory/src/build.rs b/gen/admin1_directory/src/build.rs index bcb6f9f03d..9f4a4d6712 100644 --- a/gen/admin1_directory/src/build.rs +++ b/gen/admin1_directory/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-admin1_directory", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-admin1_directory", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/admin1_directory/src/lib.rs b/gen/admin1_directory/src/lib.rs index 416d919052..60941a6cde 100644 --- a/gen/admin1_directory/src/lib.rs +++ b/gen/admin1_directory/src/lib.rs @@ -250,6 +250,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/admin1_reports-cli/Cargo.toml b/gen/admin1_reports-cli/Cargo.toml index 4eadcef84e..ab33a25716 100644 --- a/gen/admin1_reports-cli/Cargo.toml +++ b/gen/admin1_reports-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["admin", "google", "cli"] name = "admin1-reports" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-admin1_reports/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-admin1_reports/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-admin1_reports] path = "../admin1_reports" +optional = true +default-features = false diff --git a/gen/admin1_reports-cli/src/cmn.rs b/gen/admin1_reports-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/admin1_reports-cli/src/cmn.rs +++ b/gen/admin1_reports-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/admin1_reports-cli/src/main.rs b/gen/admin1_reports-cli/src/main.rs index 7920e4f37f..bd4151461f 100644 --- a/gen/admin1_reports-cli/src/main.rs +++ b/gen/admin1_reports-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -551,7 +551,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "admin1-reports", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/admin1_reports/Cargo.toml b/gen/admin1_reports/Cargo.toml index 3c9bd4439e..e6083d4f8b 100644 --- a/gen/admin1_reports/Cargo.toml +++ b/gen/admin1_reports/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/admin1_reports/src/build.rs b/gen/admin1_reports/src/build.rs index 3995bd33cf..23294517fe 100644 --- a/gen/admin1_reports/src/build.rs +++ b/gen/admin1_reports/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-admin1_reports", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-admin1_reports", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/admin1_reports/src/lib.rs b/gen/admin1_reports/src/lib.rs index bb23c888b5..0f9d31b5bf 100644 --- a/gen/admin1_reports/src/lib.rs +++ b/gen/admin1_reports/src/lib.rs @@ -198,6 +198,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/adsense1d4-cli/Cargo.toml b/gen/adsense1d4-cli/Cargo.toml index a4c9aacce5..d1976f2a09 100644 --- a/gen/adsense1d4-cli/Cargo.toml +++ b/gen/adsense1d4-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["adsense", "google", "cli"] name = "adsense1d4" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-adsense1d4/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-adsense1d4/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-adsense1d4] path = "../adsense1d4" +optional = true +default-features = false diff --git a/gen/adsense1d4-cli/src/cmn.rs b/gen/adsense1d4-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/adsense1d4-cli/src/cmn.rs +++ b/gen/adsense1d4-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/adsense1d4-cli/src/main.rs b/gen/adsense1d4-cli/src/main.rs index 915b90a1ae..ae636d7287 100644 --- a/gen/adsense1d4-cli/src/main.rs +++ b/gen/adsense1d4-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2486,7 +2486,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "adsense1d4", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/adsense1d4/Cargo.toml b/gen/adsense1d4/Cargo.toml index edf84a5e07..568b077c06 100644 --- a/gen/adsense1d4/Cargo.toml +++ b/gen/adsense1d4/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/adsense1d4/src/build.rs b/gen/adsense1d4/src/build.rs index eba18143bb..c1b03ec0a3 100644 --- a/gen/adsense1d4/src/build.rs +++ b/gen/adsense1d4/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-adsense1d4", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-adsense1d4", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/adsense1d4/src/lib.rs b/gen/adsense1d4/src/lib.rs index 09b16873ff..fb80c67238 100644 --- a/gen/adsense1d4/src/lib.rs +++ b/gen/adsense1d4/src/lib.rs @@ -222,6 +222,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/adsensehost4d1-cli/Cargo.toml b/gen/adsensehost4d1-cli/Cargo.toml index 2aca700e32..89fc466ce8 100644 --- a/gen/adsensehost4d1-cli/Cargo.toml +++ b/gen/adsensehost4d1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["adsensehost", "google", "cli"] name = "adsensehost4d1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-adsensehost4d1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-adsensehost4d1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-adsensehost4d1] path = "../adsensehost4d1" +optional = true +default-features = false diff --git a/gen/adsensehost4d1-cli/src/cmn.rs b/gen/adsensehost4d1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/adsensehost4d1-cli/src/cmn.rs +++ b/gen/adsensehost4d1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/adsensehost4d1-cli/src/main.rs b/gen/adsensehost4d1-cli/src/main.rs index 8fa15a566a..054bc3fed7 100644 --- a/gen/adsensehost4d1-cli/src/main.rs +++ b/gen/adsensehost4d1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1971,7 +1971,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "adsensehost4d1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/adsensehost4d1/Cargo.toml b/gen/adsensehost4d1/Cargo.toml index edef3dfceb..ba64ff989b 100644 --- a/gen/adsensehost4d1/Cargo.toml +++ b/gen/adsensehost4d1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/adsensehost4d1/src/build.rs b/gen/adsensehost4d1/src/build.rs index 03e1182787..23b27bbd59 100644 --- a/gen/adsensehost4d1/src/build.rs +++ b/gen/adsensehost4d1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-adsensehost4d1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-adsensehost4d1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/adsensehost4d1/src/lib.rs b/gen/adsensehost4d1/src/lib.rs index 210d6dd6e1..eb51c00d23 100644 --- a/gen/adsensehost4d1/src/lib.rs +++ b/gen/adsensehost4d1/src/lib.rs @@ -200,6 +200,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/analytics3-cli/Cargo.toml b/gen/analytics3-cli/Cargo.toml index afc31a5001..e0c8b7b83e 100644 --- a/gen/analytics3-cli/Cargo.toml +++ b/gen/analytics3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["analytics", "google", "cli"] name = "analytics3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-analytics3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-analytics3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-analytics3] path = "../analytics3" +optional = true +default-features = false diff --git a/gen/analytics3-cli/src/cmn.rs b/gen/analytics3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/analytics3-cli/src/cmn.rs +++ b/gen/analytics3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/analytics3-cli/src/main.rs b/gen/analytics3-cli/src/main.rs index 1087d95256..f10d1e668a 100644 --- a/gen/analytics3-cli/src/main.rs +++ b/gen/analytics3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -6583,7 +6583,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "analytics3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/analytics3/Cargo.toml b/gen/analytics3/Cargo.toml index 01f479bb8d..84df943b55 100644 --- a/gen/analytics3/Cargo.toml +++ b/gen/analytics3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/analytics3/src/build.rs b/gen/analytics3/src/build.rs index 6e41462a72..2f874ff2de 100644 --- a/gen/analytics3/src/build.rs +++ b/gen/analytics3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-analytics3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-analytics3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/analytics3/src/lib.rs b/gen/analytics3/src/lib.rs index 9c8ae99794..2f347baae7 100644 --- a/gen/analytics3/src/lib.rs +++ b/gen/analytics3/src/lib.rs @@ -193,6 +193,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/androidenterprise1-cli/Cargo.toml b/gen/androidenterprise1-cli/Cargo.toml index 0b117ade02..807df9a043 100644 --- a/gen/androidenterprise1-cli/Cargo.toml +++ b/gen/androidenterprise1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["androidenterprise", "google", "cli"] name = "androidenterprise1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-androidenterprise1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-androidenterprise1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-androidenterprise1] path = "../androidenterprise1" +optional = true +default-features = false diff --git a/gen/androidenterprise1-cli/src/cmn.rs b/gen/androidenterprise1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/androidenterprise1-cli/src/cmn.rs +++ b/gen/androidenterprise1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/androidenterprise1-cli/src/main.rs b/gen/androidenterprise1-cli/src/main.rs index b559f6a1b6..1fd28e5b7d 100644 --- a/gen/androidenterprise1-cli/src/main.rs +++ b/gen/androidenterprise1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -4417,7 +4417,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "androidenterprise1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/androidenterprise1/Cargo.toml b/gen/androidenterprise1/Cargo.toml index 13cbf4d087..6b0c2fddcd 100644 --- a/gen/androidenterprise1/Cargo.toml +++ b/gen/androidenterprise1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/androidenterprise1/src/build.rs b/gen/androidenterprise1/src/build.rs index a99354f393..639de08b2a 100644 --- a/gen/androidenterprise1/src/build.rs +++ b/gen/androidenterprise1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-androidenterprise1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-androidenterprise1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/androidenterprise1/src/lib.rs b/gen/androidenterprise1/src/lib.rs index 6fe43c4eb7..3421bed9e1 100644 --- a/gen/androidenterprise1/src/lib.rs +++ b/gen/androidenterprise1/src/lib.rs @@ -211,6 +211,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/androidpublisher2-cli/Cargo.toml b/gen/androidpublisher2-cli/Cargo.toml index e7f2f45c57..88c8f2ed5f 100644 --- a/gen/androidpublisher2-cli/Cargo.toml +++ b/gen/androidpublisher2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["androidpublisher", "google", "cli"] name = "androidpublisher2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-androidpublisher2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-androidpublisher2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-androidpublisher2] path = "../androidpublisher2" +optional = true +default-features = false diff --git a/gen/androidpublisher2-cli/src/cmn.rs b/gen/androidpublisher2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/androidpublisher2-cli/src/cmn.rs +++ b/gen/androidpublisher2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/androidpublisher2-cli/src/main.rs b/gen/androidpublisher2-cli/src/main.rs index 465722a4d5..b03cff65fd 100644 --- a/gen/androidpublisher2-cli/src/main.rs +++ b/gen/androidpublisher2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3659,7 +3659,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "androidpublisher2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/androidpublisher2/Cargo.toml b/gen/androidpublisher2/Cargo.toml index 356c5d266e..359cc90949 100644 --- a/gen/androidpublisher2/Cargo.toml +++ b/gen/androidpublisher2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/androidpublisher2/src/build.rs b/gen/androidpublisher2/src/build.rs index 9e77914cb8..aa73418c23 100644 --- a/gen/androidpublisher2/src/build.rs +++ b/gen/androidpublisher2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-androidpublisher2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-androidpublisher2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/androidpublisher2/src/lib.rs b/gen/androidpublisher2/src/lib.rs index 20ea1469e2..85b3c15a29 100644 --- a/gen/androidpublisher2/src/lib.rs +++ b/gen/androidpublisher2/src/lib.rs @@ -194,6 +194,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/appengine1_beta4-cli/Cargo.toml b/gen/appengine1_beta4-cli/Cargo.toml index 048aa6d3b5..e9d20ab3d4 100644 --- a/gen/appengine1_beta4-cli/Cargo.toml +++ b/gen/appengine1_beta4-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["appengine", "google", "cli"] name = "appengine1-beta4" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-appengine1_beta4/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-appengine1_beta4/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-appengine1_beta4] path = "../appengine1_beta4" +optional = true +default-features = false diff --git a/gen/appengine1_beta4-cli/src/cmn.rs b/gen/appengine1_beta4-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/appengine1_beta4-cli/src/cmn.rs +++ b/gen/appengine1_beta4-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/appengine1_beta4-cli/src/main.rs b/gen/appengine1_beta4-cli/src/main.rs index f776b1366c..9c58d1d4bf 100644 --- a/gen/appengine1_beta4-cli/src/main.rs +++ b/gen/appengine1_beta4-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1020,7 +1020,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "appengine1-beta4", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/appengine1_beta4/Cargo.toml b/gen/appengine1_beta4/Cargo.toml index 1b5145839e..fc62c57bca 100644 --- a/gen/appengine1_beta4/Cargo.toml +++ b/gen/appengine1_beta4/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/appengine1_beta4/src/build.rs b/gen/appengine1_beta4/src/build.rs index ad4b330068..a15bace314 100644 --- a/gen/appengine1_beta4/src/build.rs +++ b/gen/appengine1_beta4/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-appengine1_beta4", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-appengine1_beta4", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/appengine1_beta4/src/lib.rs b/gen/appengine1_beta4/src/lib.rs index 42851fcf69..4008f54e91 100644 --- a/gen/appengine1_beta4/src/lib.rs +++ b/gen/appengine1_beta4/src/lib.rs @@ -185,6 +185,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/appengine1_beta5-cli/Cargo.toml b/gen/appengine1_beta5-cli/Cargo.toml index e7c564b3fb..5986b35368 100644 --- a/gen/appengine1_beta5-cli/Cargo.toml +++ b/gen/appengine1_beta5-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["appengine", "google", "cli"] name = "appengine1-beta5" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-appengine1_beta5/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-appengine1_beta5/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-appengine1_beta5] path = "../appengine1_beta5" +optional = true +default-features = false diff --git a/gen/appengine1_beta5-cli/src/cmn.rs b/gen/appengine1_beta5-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/appengine1_beta5-cli/src/cmn.rs +++ b/gen/appengine1_beta5-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/appengine1_beta5-cli/src/main.rs b/gen/appengine1_beta5-cli/src/main.rs index 928b32bda7..a526344987 100644 --- a/gen/appengine1_beta5-cli/src/main.rs +++ b/gen/appengine1_beta5-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1022,7 +1022,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "appengine1-beta5", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/appengine1_beta5/Cargo.toml b/gen/appengine1_beta5/Cargo.toml index 6dc7066263..fc16ee255b 100644 --- a/gen/appengine1_beta5/Cargo.toml +++ b/gen/appengine1_beta5/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/appengine1_beta5/src/build.rs b/gen/appengine1_beta5/src/build.rs index b318830100..4292c169d5 100644 --- a/gen/appengine1_beta5/src/build.rs +++ b/gen/appengine1_beta5/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-appengine1_beta5", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-appengine1_beta5", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/appengine1_beta5/src/lib.rs b/gen/appengine1_beta5/src/lib.rs index e8d5c7e342..7048753a2b 100644 --- a/gen/appengine1_beta5/src/lib.rs +++ b/gen/appengine1_beta5/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/appsactivity1-cli/Cargo.toml b/gen/appsactivity1-cli/Cargo.toml index 9852a3dbf4..88c165c397 100644 --- a/gen/appsactivity1-cli/Cargo.toml +++ b/gen/appsactivity1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["appsactivity", "google", "cli"] name = "appsactivity1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-appsactivity1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-appsactivity1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-appsactivity1] path = "../appsactivity1" +optional = true +default-features = false diff --git a/gen/appsactivity1-cli/src/cmn.rs b/gen/appsactivity1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/appsactivity1-cli/src/cmn.rs +++ b/gen/appsactivity1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/appsactivity1-cli/src/main.rs b/gen/appsactivity1-cli/src/main.rs index e7b3ae61c6..c872efbd51 100644 --- a/gen/appsactivity1-cli/src/main.rs +++ b/gen/appsactivity1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -177,7 +177,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "appsactivity1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/appsactivity1/Cargo.toml b/gen/appsactivity1/Cargo.toml index 845af53aaf..b2c3b825c2 100644 --- a/gen/appsactivity1/Cargo.toml +++ b/gen/appsactivity1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/appsactivity1/src/build.rs b/gen/appsactivity1/src/build.rs index 42751ea9c1..5e402c40b4 100644 --- a/gen/appsactivity1/src/build.rs +++ b/gen/appsactivity1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-appsactivity1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-appsactivity1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/appsactivity1/src/lib.rs b/gen/appsactivity1/src/lib.rs index 90fe3a063c..0d560655aa 100644 --- a/gen/appsactivity1/src/lib.rs +++ b/gen/appsactivity1/src/lib.rs @@ -179,6 +179,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/appstate1-cli/Cargo.toml b/gen/appstate1-cli/Cargo.toml index 0f6b7744a4..0d0ebb510d 100644 --- a/gen/appstate1-cli/Cargo.toml +++ b/gen/appstate1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["appstate", "google", "cli"] name = "appstate1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-appstate1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-appstate1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-appstate1] path = "../appstate1" +optional = true +default-features = false diff --git a/gen/appstate1-cli/src/cmn.rs b/gen/appstate1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/appstate1-cli/src/cmn.rs +++ b/gen/appstate1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/appstate1-cli/src/main.rs b/gen/appstate1-cli/src/main.rs index 17b4352355..b621b4597a 100644 --- a/gen/appstate1-cli/src/main.rs +++ b/gen/appstate1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -417,7 +417,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "appstate1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/appstate1/Cargo.toml b/gen/appstate1/Cargo.toml index 1129844e11..e8922fed0f 100644 --- a/gen/appstate1/Cargo.toml +++ b/gen/appstate1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/appstate1/src/build.rs b/gen/appstate1/src/build.rs index 6fec98e6f6..7d6d4a435a 100644 --- a/gen/appstate1/src/build.rs +++ b/gen/appstate1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-appstate1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-appstate1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/appstate1/src/lib.rs b/gen/appstate1/src/lib.rs index 40645b8472..d840811c12 100644 --- a/gen/appstate1/src/lib.rs +++ b/gen/appstate1/src/lib.rs @@ -180,6 +180,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/autoscaler1_beta2-cli/Cargo.toml b/gen/autoscaler1_beta2-cli/Cargo.toml index 5ae4bf5140..451ad0893f 100644 --- a/gen/autoscaler1_beta2-cli/Cargo.toml +++ b/gen/autoscaler1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["autoscaler", "google", "cli"] name = "autoscaler1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-autoscaler1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-autoscaler1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-autoscaler1_beta2] path = "../autoscaler1_beta2" +optional = true +default-features = false diff --git a/gen/autoscaler1_beta2-cli/src/cmn.rs b/gen/autoscaler1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/autoscaler1_beta2-cli/src/cmn.rs +++ b/gen/autoscaler1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/autoscaler1_beta2-cli/src/main.rs b/gen/autoscaler1_beta2-cli/src/main.rs index 53c3200426..09e8340457 100644 --- a/gen/autoscaler1_beta2-cli/src/main.rs +++ b/gen/autoscaler1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -820,7 +820,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "autoscaler1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/autoscaler1_beta2/Cargo.toml b/gen/autoscaler1_beta2/Cargo.toml index 86b455abff..7d369cfefc 100644 --- a/gen/autoscaler1_beta2/Cargo.toml +++ b/gen/autoscaler1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/autoscaler1_beta2/src/build.rs b/gen/autoscaler1_beta2/src/build.rs index 6ca514e97c..1ea45ab141 100644 --- a/gen/autoscaler1_beta2/src/build.rs +++ b/gen/autoscaler1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-autoscaler1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-autoscaler1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/autoscaler1_beta2/src/lib.rs b/gen/autoscaler1_beta2/src/lib.rs index fbb4bd67f4..876b8cf4f3 100644 --- a/gen/autoscaler1_beta2/src/lib.rs +++ b/gen/autoscaler1_beta2/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/bigquery2-cli/Cargo.toml b/gen/bigquery2-cli/Cargo.toml index 6d624c6fcf..d0bcd45362 100644 --- a/gen/bigquery2-cli/Cargo.toml +++ b/gen/bigquery2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["bigquery", "google", "cli"] name = "bigquery2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-bigquery2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-bigquery2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-bigquery2] path = "../bigquery2" +optional = true +default-features = false diff --git a/gen/bigquery2-cli/src/cmn.rs b/gen/bigquery2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/bigquery2-cli/src/cmn.rs +++ b/gen/bigquery2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/bigquery2-cli/src/main.rs b/gen/bigquery2-cli/src/main.rs index 429229f560..a9dd703664 100644 --- a/gen/bigquery2-cli/src/main.rs +++ b/gen/bigquery2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1855,7 +1855,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "bigquery2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/bigquery2/Cargo.toml b/gen/bigquery2/Cargo.toml index 3f2851dbcc..8afd1f7576 100644 --- a/gen/bigquery2/Cargo.toml +++ b/gen/bigquery2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/bigquery2/src/build.rs b/gen/bigquery2/src/build.rs index 234f74f00d..238cd9123e 100644 --- a/gen/bigquery2/src/build.rs +++ b/gen/bigquery2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-bigquery2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-bigquery2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/bigquery2/src/lib.rs b/gen/bigquery2/src/lib.rs index 721c624ecb..5845a1cd35 100644 --- a/gen/bigquery2/src/lib.rs +++ b/gen/bigquery2/src/lib.rs @@ -195,6 +195,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/blogger3-cli/Cargo.toml b/gen/blogger3-cli/Cargo.toml index d2bebb3e7c..fba168407b 100644 --- a/gen/blogger3-cli/Cargo.toml +++ b/gen/blogger3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["blogger", "google", "cli"] name = "blogger3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-blogger3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-blogger3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-blogger3] path = "../blogger3" +optional = true +default-features = false diff --git a/gen/blogger3-cli/src/cmn.rs b/gen/blogger3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/blogger3-cli/src/cmn.rs +++ b/gen/blogger3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/blogger3-cli/src/main.rs b/gen/blogger3-cli/src/main.rs index a1569802bb..a0692829f0 100644 --- a/gen/blogger3-cli/src/main.rs +++ b/gen/blogger3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2510,7 +2510,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "blogger3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/blogger3/Cargo.toml b/gen/blogger3/Cargo.toml index 88268a298c..26cd697c91 100644 --- a/gen/blogger3/Cargo.toml +++ b/gen/blogger3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/blogger3/src/build.rs b/gen/blogger3/src/build.rs index 06c7393fc6..0ba7285ebc 100644 --- a/gen/blogger3/src/build.rs +++ b/gen/blogger3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-blogger3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-blogger3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/blogger3/src/lib.rs b/gen/blogger3/src/lib.rs index 8bbe121d42..e51aca2d2d 100644 --- a/gen/blogger3/src/lib.rs +++ b/gen/blogger3/src/lib.rs @@ -205,6 +205,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/books1-cli/Cargo.toml b/gen/books1-cli/Cargo.toml index d56b5644d1..d2cda16a38 100644 --- a/gen/books1-cli/Cargo.toml +++ b/gen/books1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["books", "google", "cli"] name = "books1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-books1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-books1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-books1] path = "../books1" +optional = true +default-features = false diff --git a/gen/books1-cli/src/cmn.rs b/gen/books1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/books1-cli/src/cmn.rs +++ b/gen/books1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/books1-cli/src/main.rs b/gen/books1-cli/src/main.rs index 54eef0fb0f..2a0f2a608c 100644 --- a/gen/books1-cli/src/main.rs +++ b/gen/books1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3531,7 +3531,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "books1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/books1/Cargo.toml b/gen/books1/Cargo.toml index f768018fcc..0f598f24cf 100644 --- a/gen/books1/Cargo.toml +++ b/gen/books1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/books1/src/build.rs b/gen/books1/src/build.rs index 75e0342177..bbe1bb61f7 100644 --- a/gen/books1/src/build.rs +++ b/gen/books1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-books1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-books1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/books1/src/lib.rs b/gen/books1/src/lib.rs index a284809259..a3c9be3c48 100644 --- a/gen/books1/src/lib.rs +++ b/gen/books1/src/lib.rs @@ -213,6 +213,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/calendar3-cli/Cargo.toml b/gen/calendar3-cli/Cargo.toml index e41eaf9513..7463718e0a 100644 --- a/gen/calendar3-cli/Cargo.toml +++ b/gen/calendar3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["calendar", "google", "cli"] name = "calendar3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-calendar3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-calendar3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-calendar3] path = "../calendar3" +optional = true +default-features = false diff --git a/gen/calendar3-cli/src/cmn.rs b/gen/calendar3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/calendar3-cli/src/cmn.rs +++ b/gen/calendar3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/calendar3-cli/src/main.rs b/gen/calendar3-cli/src/main.rs index fa0192058e..90c7ee3926 100644 --- a/gen/calendar3-cli/src/main.rs +++ b/gen/calendar3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3407,7 +3407,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "calendar3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/calendar3/Cargo.toml b/gen/calendar3/Cargo.toml index 87df473724..c18891a64e 100644 --- a/gen/calendar3/Cargo.toml +++ b/gen/calendar3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/calendar3/src/build.rs b/gen/calendar3/src/build.rs index d84b715144..0d909e65ee 100644 --- a/gen/calendar3/src/build.rs +++ b/gen/calendar3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-calendar3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-calendar3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/calendar3/src/lib.rs b/gen/calendar3/src/lib.rs index 95922830a9..baeecf5293 100644 --- a/gen/calendar3/src/lib.rs +++ b/gen/calendar3/src/lib.rs @@ -231,6 +231,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/civicinfo2-cli/Cargo.toml b/gen/civicinfo2-cli/Cargo.toml index 0a8085398a..6362130d50 100644 --- a/gen/civicinfo2-cli/Cargo.toml +++ b/gen/civicinfo2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["civicinfo", "google", "cli"] name = "civicinfo2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-civicinfo2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-civicinfo2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-civicinfo2] path = "../civicinfo2" +optional = true +default-features = false diff --git a/gen/civicinfo2-cli/src/cmn.rs b/gen/civicinfo2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/civicinfo2-cli/src/cmn.rs +++ b/gen/civicinfo2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/civicinfo2-cli/src/main.rs b/gen/civicinfo2-cli/src/main.rs index f8c91fc22c..be166905a5 100644 --- a/gen/civicinfo2-cli/src/main.rs +++ b/gen/civicinfo2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -410,7 +410,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "civicinfo2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/civicinfo2/Cargo.toml b/gen/civicinfo2/Cargo.toml index 0d3baf765f..6440968d8e 100644 --- a/gen/civicinfo2/Cargo.toml +++ b/gen/civicinfo2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/civicinfo2/src/build.rs b/gen/civicinfo2/src/build.rs index 59f765eef8..a7d1711353 100644 --- a/gen/civicinfo2/src/build.rs +++ b/gen/civicinfo2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-civicinfo2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-civicinfo2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/civicinfo2/src/lib.rs b/gen/civicinfo2/src/lib.rs index 4022d93a1d..db477477a2 100644 --- a/gen/civicinfo2/src/lib.rs +++ b/gen/civicinfo2/src/lib.rs @@ -179,6 +179,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/classroom1-cli/Cargo.toml b/gen/classroom1-cli/Cargo.toml index bca9b33d5a..a14b9f7f64 100644 --- a/gen/classroom1-cli/Cargo.toml +++ b/gen/classroom1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["classroom", "google", "cli"] name = "classroom1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-classroom1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-classroom1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-classroom1] path = "../classroom1" +optional = true +default-features = false diff --git a/gen/classroom1-cli/src/cmn.rs b/gen/classroom1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/classroom1-cli/src/cmn.rs +++ b/gen/classroom1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/classroom1-cli/src/main.rs b/gen/classroom1-cli/src/main.rs index 6942c15b3f..c4a7770ad6 100644 --- a/gen/classroom1-cli/src/main.rs +++ b/gen/classroom1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1717,7 +1717,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "classroom1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/classroom1/Cargo.toml b/gen/classroom1/Cargo.toml index 70bfd5d99f..a20c38b783 100644 --- a/gen/classroom1/Cargo.toml +++ b/gen/classroom1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/classroom1/src/build.rs b/gen/classroom1/src/build.rs index dd7a4b945c..262c06d9e5 100644 --- a/gen/classroom1/src/build.rs +++ b/gen/classroom1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-classroom1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-classroom1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/classroom1/src/lib.rs b/gen/classroom1/src/lib.rs index c202507ef4..fb226a252e 100644 --- a/gen/classroom1/src/lib.rs +++ b/gen/classroom1/src/lib.rs @@ -196,6 +196,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudbilling1-cli/Cargo.toml b/gen/cloudbilling1-cli/Cargo.toml index 70041b3498..c0f3334991 100644 --- a/gen/cloudbilling1-cli/Cargo.toml +++ b/gen/cloudbilling1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["cloudbilling", "google", "cli"] name = "cloudbilling1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudbilling1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudbilling1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudbilling1] path = "../cloudbilling1" +optional = true +default-features = false diff --git a/gen/cloudbilling1-cli/src/cmn.rs b/gen/cloudbilling1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudbilling1-cli/src/cmn.rs +++ b/gen/cloudbilling1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudbilling1-cli/src/main.rs b/gen/cloudbilling1-cli/src/main.rs index e7f9bce7e7..c99dc269d5 100644 --- a/gen/cloudbilling1-cli/src/main.rs +++ b/gen/cloudbilling1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -433,7 +433,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudbilling1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudbilling1/Cargo.toml b/gen/cloudbilling1/Cargo.toml index dfa546f561..758e35826e 100644 --- a/gen/cloudbilling1/Cargo.toml +++ b/gen/cloudbilling1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudbilling1/src/build.rs b/gen/cloudbilling1/src/build.rs index 54927a0d94..fd1af204d1 100644 --- a/gen/cloudbilling1/src/build.rs +++ b/gen/cloudbilling1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudbilling1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudbilling1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudbilling1/src/lib.rs b/gen/cloudbilling1/src/lib.rs index 70828f5b2d..2ce7c37d39 100644 --- a/gen/cloudbilling1/src/lib.rs +++ b/gen/cloudbilling1/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/clouddebugger2-cli/Cargo.toml b/gen/clouddebugger2-cli/Cargo.toml index 3abbf36e6c..4891681d03 100644 --- a/gen/clouddebugger2-cli/Cargo.toml +++ b/gen/clouddebugger2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["clouddebugger", "google", "cli"] name = "clouddebugger2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-clouddebugger2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-clouddebugger2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-clouddebugger2] path = "../clouddebugger2" +optional = true +default-features = false diff --git a/gen/clouddebugger2-cli/src/cmn.rs b/gen/clouddebugger2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/clouddebugger2-cli/src/cmn.rs +++ b/gen/clouddebugger2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/clouddebugger2-cli/src/main.rs b/gen/clouddebugger2-cli/src/main.rs index 26cc3a1103..877349d535 100644 --- a/gen/clouddebugger2-cli/src/main.rs +++ b/gen/clouddebugger2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -738,7 +738,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "clouddebugger2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/clouddebugger2/Cargo.toml b/gen/clouddebugger2/Cargo.toml index 05c6a241f0..42eeb165b6 100644 --- a/gen/clouddebugger2/Cargo.toml +++ b/gen/clouddebugger2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/clouddebugger2/src/build.rs b/gen/clouddebugger2/src/build.rs index e5a115bd40..873d3a432d 100644 --- a/gen/clouddebugger2/src/build.rs +++ b/gen/clouddebugger2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-clouddebugger2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-clouddebugger2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/clouddebugger2/src/lib.rs b/gen/clouddebugger2/src/lib.rs index 5205dd1a49..ecf067c0ac 100644 --- a/gen/clouddebugger2/src/lib.rs +++ b/gen/clouddebugger2/src/lib.rs @@ -181,6 +181,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudlatencytest2-cli/Cargo.toml b/gen/cloudlatencytest2-cli/Cargo.toml index 001f20e8e4..9846f5e51d 100644 --- a/gen/cloudlatencytest2-cli/Cargo.toml +++ b/gen/cloudlatencytest2-cli/Cargo.toml @@ -16,19 +16,27 @@ keywords = ["cloudlatencytest", "google", "cli"] name = "cloudlatencytest2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudlatencytest2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudlatencytest2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudlatencytest2] path = "../cloudlatencytest2" +optional = true +default-features = false diff --git a/gen/cloudlatencytest2-cli/src/cmn.rs b/gen/cloudlatencytest2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudlatencytest2-cli/src/cmn.rs +++ b/gen/cloudlatencytest2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudlatencytest2-cli/src/main.rs b/gen/cloudlatencytest2-cli/src/main.rs index 828eb3293c..aaf7045fe5 100644 --- a/gen/cloudlatencytest2-cli/src/main.rs +++ b/gen/cloudlatencytest2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -275,7 +275,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudlatencytest2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudlatencytest2/Cargo.toml b/gen/cloudlatencytest2/Cargo.toml index 48915f8b20..4ba359b030 100644 --- a/gen/cloudlatencytest2/Cargo.toml +++ b/gen/cloudlatencytest2/Cargo.toml @@ -15,14 +15,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudlatencytest2/src/build.rs b/gen/cloudlatencytest2/src/build.rs index e7610f1647..8a1e51d84e 100644 --- a/gen/cloudlatencytest2/src/build.rs +++ b/gen/cloudlatencytest2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudlatencytest2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudlatencytest2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudlatencytest2/src/lib.rs b/gen/cloudlatencytest2/src/lib.rs index d38aa0541b..bfbaa3b1f8 100644 --- a/gen/cloudlatencytest2/src/lib.rs +++ b/gen/cloudlatencytest2/src/lib.rs @@ -175,6 +175,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudmonitoring2_beta2-cli/Cargo.toml b/gen/cloudmonitoring2_beta2-cli/Cargo.toml index 43e9ef0acd..f1b68200ad 100644 --- a/gen/cloudmonitoring2_beta2-cli/Cargo.toml +++ b/gen/cloudmonitoring2_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["cloudmonitoring", "google", "cli"] name = "cloudmonitoring2-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudmonitoring2_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudmonitoring2_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudmonitoring2_beta2] path = "../cloudmonitoring2_beta2" +optional = true +default-features = false diff --git a/gen/cloudmonitoring2_beta2-cli/src/cmn.rs b/gen/cloudmonitoring2_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/cmn.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudmonitoring2_beta2-cli/src/main.rs b/gen/cloudmonitoring2_beta2-cli/src/main.rs index ecf211ae05..cceb0fbd91 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/main.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -669,7 +669,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudmonitoring2-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudmonitoring2_beta2/Cargo.toml b/gen/cloudmonitoring2_beta2/Cargo.toml index fdb0d7a980..f449a5f913 100644 --- a/gen/cloudmonitoring2_beta2/Cargo.toml +++ b/gen/cloudmonitoring2_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudmonitoring2_beta2/src/build.rs b/gen/cloudmonitoring2_beta2/src/build.rs index e350ab0fe0..1dfa60a14d 100644 --- a/gen/cloudmonitoring2_beta2/src/build.rs +++ b/gen/cloudmonitoring2_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudmonitoring2_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudmonitoring2_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudmonitoring2_beta2/src/lib.rs b/gen/cloudmonitoring2_beta2/src/lib.rs index f23ab78620..b67833dc8a 100644 --- a/gen/cloudmonitoring2_beta2/src/lib.rs +++ b/gen/cloudmonitoring2_beta2/src/lib.rs @@ -187,6 +187,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudresourcemanager1-cli/Cargo.toml b/gen/cloudresourcemanager1-cli/Cargo.toml index e5d5de1222..f8a7099291 100644 --- a/gen/cloudresourcemanager1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["cloudresourcemanager", "google", "cli"] name = "cloudresourcemanager1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudresourcemanager1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudresourcemanager1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudresourcemanager1] path = "../cloudresourcemanager1" +optional = true +default-features = false diff --git a/gen/cloudresourcemanager1-cli/src/cmn.rs b/gen/cloudresourcemanager1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudresourcemanager1-cli/src/cmn.rs +++ b/gen/cloudresourcemanager1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudresourcemanager1-cli/src/main.rs b/gen/cloudresourcemanager1-cli/src/main.rs index a8935f728a..000571f76f 100644 --- a/gen/cloudresourcemanager1-cli/src/main.rs +++ b/gen/cloudresourcemanager1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -721,7 +721,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudresourcemanager1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudresourcemanager1/Cargo.toml b/gen/cloudresourcemanager1/Cargo.toml index 26d7611fe1..fe71dc9d21 100644 --- a/gen/cloudresourcemanager1/Cargo.toml +++ b/gen/cloudresourcemanager1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudresourcemanager1/src/build.rs b/gen/cloudresourcemanager1/src/build.rs index ac4056636b..77027d0598 100644 --- a/gen/cloudresourcemanager1/src/build.rs +++ b/gen/cloudresourcemanager1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudresourcemanager1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudresourcemanager1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudresourcemanager1/src/lib.rs b/gen/cloudresourcemanager1/src/lib.rs index 232870ea65..ab0f38e995 100644 --- a/gen/cloudresourcemanager1/src/lib.rs +++ b/gen/cloudresourcemanager1/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml index 2e94ad7af1..4abbe64bef 100644 --- a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["cloudresourcemanager", "google", "cli"] name = "cloudresourcemanager1-beta1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudresourcemanager1_beta1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudresourcemanager1_beta1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudresourcemanager1_beta1] path = "../cloudresourcemanager1_beta1" +optional = true +default-features = false diff --git a/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs b/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudresourcemanager1_beta1-cli/src/main.rs b/gen/cloudresourcemanager1_beta1-cli/src/main.rs index 9feed86863..11272e0088 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/main.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1299,7 +1299,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudresourcemanager1-beta1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudresourcemanager1_beta1/Cargo.toml b/gen/cloudresourcemanager1_beta1/Cargo.toml index 8197ffe188..4a433cc4f8 100644 --- a/gen/cloudresourcemanager1_beta1/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudresourcemanager1_beta1/src/build.rs b/gen/cloudresourcemanager1_beta1/src/build.rs index be55a3b141..ec9bdbdc0a 100644 --- a/gen/cloudresourcemanager1_beta1/src/build.rs +++ b/gen/cloudresourcemanager1_beta1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudresourcemanager1_beta1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudresourcemanager1_beta1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs b/gen/cloudresourcemanager1_beta1/src/lib.rs index f44a1573aa..4a1d85eb8d 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs @@ -185,6 +185,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/cloudtrace1-cli/Cargo.toml b/gen/cloudtrace1-cli/Cargo.toml index 2af75fa42c..9817e59b1f 100644 --- a/gen/cloudtrace1-cli/Cargo.toml +++ b/gen/cloudtrace1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["cloudtrace", "google", "cli"] name = "cloudtrace1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-cloudtrace1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-cloudtrace1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-cloudtrace1] path = "../cloudtrace1" +optional = true +default-features = false diff --git a/gen/cloudtrace1-cli/src/cmn.rs b/gen/cloudtrace1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/cloudtrace1-cli/src/cmn.rs +++ b/gen/cloudtrace1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/cloudtrace1-cli/src/main.rs b/gen/cloudtrace1-cli/src/main.rs index ba5eb3c2df..8578e3c3ab 100644 --- a/gen/cloudtrace1-cli/src/main.rs +++ b/gen/cloudtrace1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -319,7 +319,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "cloudtrace1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/cloudtrace1/Cargo.toml b/gen/cloudtrace1/Cargo.toml index eaa3b98b1f..daf373092e 100644 --- a/gen/cloudtrace1/Cargo.toml +++ b/gen/cloudtrace1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/cloudtrace1/src/build.rs b/gen/cloudtrace1/src/build.rs index bcbc2128bb..b985cb5816 100644 --- a/gen/cloudtrace1/src/build.rs +++ b/gen/cloudtrace1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-cloudtrace1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-cloudtrace1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/cloudtrace1/src/lib.rs b/gen/cloudtrace1/src/lib.rs index ffaea39e2a..b5c564ea59 100644 --- a/gen/cloudtrace1/src/lib.rs +++ b/gen/cloudtrace1/src/lib.rs @@ -172,6 +172,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/clouduseraccountsvm_beta-cli/Cargo.toml b/gen/clouduseraccountsvm_beta-cli/Cargo.toml index 171a6e3f8f..7f89876cb4 100644 --- a/gen/clouduseraccountsvm_beta-cli/Cargo.toml +++ b/gen/clouduseraccountsvm_beta-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["clouduseraccounts", "google", "cli"] name = "clouduseraccountsvm-beta" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-clouduseraccountsvm_beta/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-clouduseraccountsvm_beta/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-clouduseraccountsvm_beta] path = "../clouduseraccountsvm_beta" +optional = true +default-features = false diff --git a/gen/clouduseraccountsvm_beta-cli/src/cmn.rs b/gen/clouduseraccountsvm_beta-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/clouduseraccountsvm_beta-cli/src/cmn.rs +++ b/gen/clouduseraccountsvm_beta-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/clouduseraccountsvm_beta-cli/src/main.rs b/gen/clouduseraccountsvm_beta-cli/src/main.rs index e38277ceda..0706b56792 100644 --- a/gen/clouduseraccountsvm_beta-cli/src/main.rs +++ b/gen/clouduseraccountsvm_beta-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1289,7 +1289,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "clouduseraccountsvm-beta", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/clouduseraccountsvm_beta/Cargo.toml b/gen/clouduseraccountsvm_beta/Cargo.toml index 38c80a9e70..101953820c 100644 --- a/gen/clouduseraccountsvm_beta/Cargo.toml +++ b/gen/clouduseraccountsvm_beta/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/clouduseraccountsvm_beta/src/build.rs b/gen/clouduseraccountsvm_beta/src/build.rs index da9223d224..1fdd51a6f5 100644 --- a/gen/clouduseraccountsvm_beta/src/build.rs +++ b/gen/clouduseraccountsvm_beta/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-clouduseraccountsvm_beta", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-clouduseraccountsvm_beta", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/clouduseraccountsvm_beta/src/lib.rs b/gen/clouduseraccountsvm_beta/src/lib.rs index 41352b4e6f..53e1a566d0 100644 --- a/gen/clouduseraccountsvm_beta/src/lib.rs +++ b/gen/clouduseraccountsvm_beta/src/lib.rs @@ -192,6 +192,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/compute1-cli/Cargo.toml b/gen/compute1-cli/Cargo.toml index 80d0626e76..9e276f8a2c 100644 --- a/gen/compute1-cli/Cargo.toml +++ b/gen/compute1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["compute", "google", "cli"] name = "compute1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-compute1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-compute1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-compute1] path = "../compute1" +optional = true +default-features = false diff --git a/gen/compute1-cli/src/cmn.rs b/gen/compute1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/compute1-cli/src/cmn.rs +++ b/gen/compute1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/compute1-cli/src/main.rs b/gen/compute1-cli/src/main.rs index cb56db0b9a..58f1a86be8 100644 --- a/gen/compute1-cli/src/main.rs +++ b/gen/compute1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -14585,7 +14585,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "compute1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/compute1/Cargo.toml b/gen/compute1/Cargo.toml index dc81facf1e..c8cd1742fe 100644 --- a/gen/compute1/Cargo.toml +++ b/gen/compute1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/compute1/src/build.rs b/gen/compute1/src/build.rs index bbab5b355d..f6ab0ff225 100644 --- a/gen/compute1/src/build.rs +++ b/gen/compute1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-compute1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-compute1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/compute1/src/lib.rs b/gen/compute1/src/lib.rs index 425306a543..5e3c73d874 100644 --- a/gen/compute1/src/lib.rs +++ b/gen/compute1/src/lib.rs @@ -347,6 +347,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/consumersurveys2-cli/Cargo.toml b/gen/consumersurveys2-cli/Cargo.toml index 04fa6964a8..15ad542165 100644 --- a/gen/consumersurveys2-cli/Cargo.toml +++ b/gen/consumersurveys2-cli/Cargo.toml @@ -16,19 +16,27 @@ keywords = ["consumersurveys", "google", "cli"] name = "consumersurveys2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-consumersurveys2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-consumersurveys2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-consumersurveys2] path = "../consumersurveys2" +optional = true +default-features = false diff --git a/gen/consumersurveys2-cli/src/cmn.rs b/gen/consumersurveys2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/consumersurveys2-cli/src/cmn.rs +++ b/gen/consumersurveys2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/consumersurveys2-cli/src/main.rs b/gen/consumersurveys2-cli/src/main.rs index d353e25f51..dc3fd55834 100644 --- a/gen/consumersurveys2-cli/src/main.rs +++ b/gen/consumersurveys2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -639,7 +639,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "consumersurveys2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/consumersurveys2/Cargo.toml b/gen/consumersurveys2/Cargo.toml index ec5fcecf25..cb2bd64d8a 100644 --- a/gen/consumersurveys2/Cargo.toml +++ b/gen/consumersurveys2/Cargo.toml @@ -15,14 +15,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/consumersurveys2/src/build.rs b/gen/consumersurveys2/src/build.rs index 0d1cf974ca..dd2f0de51c 100644 --- a/gen/consumersurveys2/src/build.rs +++ b/gen/consumersurveys2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-consumersurveys2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-consumersurveys2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/consumersurveys2/src/lib.rs b/gen/consumersurveys2/src/lib.rs index 8f315410d3..8aaaf69c3c 100644 --- a/gen/consumersurveys2/src/lib.rs +++ b/gen/consumersurveys2/src/lib.rs @@ -183,6 +183,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/container1-cli/Cargo.toml b/gen/container1-cli/Cargo.toml index d508a5277c..4a89d07374 100644 --- a/gen/container1-cli/Cargo.toml +++ b/gen/container1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["container", "google", "cli"] name = "container1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-container1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-container1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-container1] path = "../container1" +optional = true +default-features = false diff --git a/gen/container1-cli/src/cmn.rs b/gen/container1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/container1-cli/src/cmn.rs +++ b/gen/container1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/container1-cli/src/main.rs b/gen/container1-cli/src/main.rs index 0559a173ca..5989b2c950 100644 --- a/gen/container1-cli/src/main.rs +++ b/gen/container1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -641,7 +641,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "container1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/container1/Cargo.toml b/gen/container1/Cargo.toml index 7c74ad11b6..c25425ff37 100644 --- a/gen/container1/Cargo.toml +++ b/gen/container1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/container1/src/build.rs b/gen/container1/src/build.rs index 7265b49462..d38393c2e3 100644 --- a/gen/container1/src/build.rs +++ b/gen/container1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-container1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-container1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/container1/src/lib.rs b/gen/container1/src/lib.rs index 3a11ee67cf..052bf02324 100644 --- a/gen/container1/src/lib.rs +++ b/gen/container1/src/lib.rs @@ -181,6 +181,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/content2-cli/Cargo.toml b/gen/content2-cli/Cargo.toml index f64aace2e4..ffd8954f9f 100644 --- a/gen/content2-cli/Cargo.toml +++ b/gen/content2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["content", "google", "cli"] name = "content2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-content2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-content2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-content2] path = "../content2" +optional = true +default-features = false diff --git a/gen/content2-cli/src/cmn.rs b/gen/content2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/content2-cli/src/cmn.rs +++ b/gen/content2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/content2-cli/src/main.rs b/gen/content2-cli/src/main.rs index d7b7215c07..c5cacfb090 100644 --- a/gen/content2-cli/src/main.rs +++ b/gen/content2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -4615,7 +4615,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "content2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/content2/Cargo.toml b/gen/content2/Cargo.toml index 9ee00804d8..c7cee8e717 100644 --- a/gen/content2/Cargo.toml +++ b/gen/content2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/content2/src/build.rs b/gen/content2/src/build.rs index ca163851b8..30cf963efe 100644 --- a/gen/content2/src/build.rs +++ b/gen/content2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-content2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-content2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/content2/src/lib.rs b/gen/content2/src/lib.rs index 8344094f44..209131522f 100644 --- a/gen/content2/src/lib.rs +++ b/gen/content2/src/lib.rs @@ -211,6 +211,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/content2_sandbox-cli/Cargo.toml b/gen/content2_sandbox-cli/Cargo.toml index 5ee3b1ed52..6b0d9ab2b8 100644 --- a/gen/content2_sandbox-cli/Cargo.toml +++ b/gen/content2_sandbox-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["content", "google", "cli"] name = "content2-sandbox" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-content2_sandbox/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-content2_sandbox/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-content2_sandbox] path = "../content2_sandbox" +optional = true +default-features = false diff --git a/gen/content2_sandbox-cli/src/cmn.rs b/gen/content2_sandbox-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/content2_sandbox-cli/src/cmn.rs +++ b/gen/content2_sandbox-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/content2_sandbox-cli/src/main.rs b/gen/content2_sandbox-cli/src/main.rs index b6257b38a2..269f109b13 100644 --- a/gen/content2_sandbox-cli/src/main.rs +++ b/gen/content2_sandbox-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1315,7 +1315,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "content2-sandbox", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/content2_sandbox/Cargo.toml b/gen/content2_sandbox/Cargo.toml index 8e40170e3f..77cb069aa1 100644 --- a/gen/content2_sandbox/Cargo.toml +++ b/gen/content2_sandbox/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/content2_sandbox/src/build.rs b/gen/content2_sandbox/src/build.rs index 57cdec78d3..566f437ef0 100644 --- a/gen/content2_sandbox/src/build.rs +++ b/gen/content2_sandbox/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-content2_sandbox", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-content2_sandbox", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/content2_sandbox/src/lib.rs b/gen/content2_sandbox/src/lib.rs index 5798f69ca2..65655691ac 100644 --- a/gen/content2_sandbox/src/lib.rs +++ b/gen/content2_sandbox/src/lib.rs @@ -193,6 +193,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/coordinate1-cli/Cargo.toml b/gen/coordinate1-cli/Cargo.toml index ab60ab2d40..25de9c3314 100644 --- a/gen/coordinate1-cli/Cargo.toml +++ b/gen/coordinate1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["coordinate", "google", "cli"] name = "coordinate1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-coordinate1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-coordinate1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-coordinate1] path = "../coordinate1" +optional = true +default-features = false diff --git a/gen/coordinate1-cli/src/cmn.rs b/gen/coordinate1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/coordinate1-cli/src/cmn.rs +++ b/gen/coordinate1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/coordinate1-cli/src/main.rs b/gen/coordinate1-cli/src/main.rs index a5530a652c..08d1511662 100644 --- a/gen/coordinate1-cli/src/main.rs +++ b/gen/coordinate1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1148,7 +1148,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "coordinate1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/coordinate1/Cargo.toml b/gen/coordinate1/Cargo.toml index 7755fdeae0..699c3c6095 100644 --- a/gen/coordinate1/Cargo.toml +++ b/gen/coordinate1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/coordinate1/src/build.rs b/gen/coordinate1/src/build.rs index 9e3a454192..8c06474865 100644 --- a/gen/coordinate1/src/build.rs +++ b/gen/coordinate1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-coordinate1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-coordinate1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/coordinate1/src/lib.rs b/gen/coordinate1/src/lib.rs index ebab90c812..21837c758d 100644 --- a/gen/coordinate1/src/lib.rs +++ b/gen/coordinate1/src/lib.rs @@ -202,6 +202,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/customsearch1-cli/Cargo.toml b/gen/customsearch1-cli/Cargo.toml index 30ee1c6287..9227e2d88a 100644 --- a/gen/customsearch1-cli/Cargo.toml +++ b/gen/customsearch1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["customsearch", "google", "cli"] name = "customsearch1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-customsearch1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-customsearch1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-customsearch1] path = "../customsearch1" +optional = true +default-features = false diff --git a/gen/customsearch1-cli/src/cmn.rs b/gen/customsearch1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/customsearch1-cli/src/cmn.rs +++ b/gen/customsearch1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/customsearch1-cli/src/main.rs b/gen/customsearch1-cli/src/main.rs index be250d2c0f..a668001905 100644 --- a/gen/customsearch1-cli/src/main.rs +++ b/gen/customsearch1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -246,7 +246,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "customsearch1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/customsearch1/Cargo.toml b/gen/customsearch1/Cargo.toml index 9e28949794..77a3d8630c 100644 --- a/gen/customsearch1/Cargo.toml +++ b/gen/customsearch1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/customsearch1/src/build.rs b/gen/customsearch1/src/build.rs index 5b976f33de..4510e7f475 100644 --- a/gen/customsearch1/src/build.rs +++ b/gen/customsearch1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-customsearch1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-customsearch1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/customsearch1/src/lib.rs b/gen/customsearch1/src/lib.rs index 2eac80361b..eb8a488028 100644 --- a/gen/customsearch1/src/lib.rs +++ b/gen/customsearch1/src/lib.rs @@ -203,6 +203,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dataproc1-cli/Cargo.toml b/gen/dataproc1-cli/Cargo.toml index 826e2392f1..85fedf9c58 100644 --- a/gen/dataproc1-cli/Cargo.toml +++ b/gen/dataproc1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dataproc", "google", "cli"] name = "dataproc1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dataproc1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dataproc1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dataproc1] path = "../dataproc1" +optional = true +default-features = false diff --git a/gen/dataproc1-cli/src/cmn.rs b/gen/dataproc1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dataproc1-cli/src/cmn.rs +++ b/gen/dataproc1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dataproc1-cli/src/main.rs b/gen/dataproc1-cli/src/main.rs index 1ef3db315f..4db73373de 100644 --- a/gen/dataproc1-cli/src/main.rs +++ b/gen/dataproc1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1419,7 +1419,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dataproc1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dataproc1/Cargo.toml b/gen/dataproc1/Cargo.toml index d3e69b9857..01c10df8da 100644 --- a/gen/dataproc1/Cargo.toml +++ b/gen/dataproc1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dataproc1/src/build.rs b/gen/dataproc1/src/build.rs index 58d881163c..9d997604f1 100644 --- a/gen/dataproc1/src/build.rs +++ b/gen/dataproc1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dataproc1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dataproc1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dataproc1/src/lib.rs b/gen/dataproc1/src/lib.rs index 59d0c1c903..1ccb71789c 100644 --- a/gen/dataproc1/src/lib.rs +++ b/gen/dataproc1/src/lib.rs @@ -193,6 +193,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/datastore1_beta2-cli/Cargo.toml b/gen/datastore1_beta2-cli/Cargo.toml index 990d48fc61..6616fc4626 100644 --- a/gen/datastore1_beta2-cli/Cargo.toml +++ b/gen/datastore1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["datastore", "google", "cli"] name = "datastore1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-datastore1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-datastore1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-datastore1_beta2] path = "../datastore1_beta2" +optional = true +default-features = false diff --git a/gen/datastore1_beta2-cli/src/cmn.rs b/gen/datastore1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/datastore1_beta2-cli/src/cmn.rs +++ b/gen/datastore1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/datastore1_beta2-cli/src/main.rs b/gen/datastore1_beta2-cli/src/main.rs index aa9ed3c9f2..0bae641afd 100644 --- a/gen/datastore1_beta2-cli/src/main.rs +++ b/gen/datastore1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -656,7 +656,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "datastore1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/datastore1_beta2/Cargo.toml b/gen/datastore1_beta2/Cargo.toml index e1f5746fd7..03f52767c0 100644 --- a/gen/datastore1_beta2/Cargo.toml +++ b/gen/datastore1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/datastore1_beta2/src/build.rs b/gen/datastore1_beta2/src/build.rs index dc60da5afb..817de0f2d2 100644 --- a/gen/datastore1_beta2/src/build.rs +++ b/gen/datastore1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-datastore1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-datastore1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/datastore1_beta2/src/lib.rs b/gen/datastore1_beta2/src/lib.rs index 7d569eedfd..33c99a49ac 100644 --- a/gen/datastore1_beta2/src/lib.rs +++ b/gen/datastore1_beta2/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/deploymentmanager2-cli/Cargo.toml b/gen/deploymentmanager2-cli/Cargo.toml index d39cebc585..1645e1b327 100644 --- a/gen/deploymentmanager2-cli/Cargo.toml +++ b/gen/deploymentmanager2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["deploymentmanager", "google", "cli"] name = "deploymentmanager2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-deploymentmanager2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-deploymentmanager2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-deploymentmanager2] path = "../deploymentmanager2" +optional = true +default-features = false diff --git a/gen/deploymentmanager2-cli/src/cmn.rs b/gen/deploymentmanager2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/deploymentmanager2-cli/src/cmn.rs +++ b/gen/deploymentmanager2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/deploymentmanager2-cli/src/main.rs b/gen/deploymentmanager2-cli/src/main.rs index 7df6a13eee..f5f4af27ae 100644 --- a/gen/deploymentmanager2-cli/src/main.rs +++ b/gen/deploymentmanager2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1283,7 +1283,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "deploymentmanager2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/deploymentmanager2/Cargo.toml b/gen/deploymentmanager2/Cargo.toml index fb4617ba4c..d79b083427 100644 --- a/gen/deploymentmanager2/Cargo.toml +++ b/gen/deploymentmanager2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/deploymentmanager2/src/build.rs b/gen/deploymentmanager2/src/build.rs index ded7972eee..aebcca083b 100644 --- a/gen/deploymentmanager2/src/build.rs +++ b/gen/deploymentmanager2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-deploymentmanager2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-deploymentmanager2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/deploymentmanager2/src/lib.rs b/gen/deploymentmanager2/src/lib.rs index 5d2b15d927..f286f414be 100644 --- a/gen/deploymentmanager2/src/lib.rs +++ b/gen/deploymentmanager2/src/lib.rs @@ -196,6 +196,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/deploymentmanager2_beta2-cli/Cargo.toml b/gen/deploymentmanager2_beta2-cli/Cargo.toml index 65b5c86fb1..4f19cdf9ff 100644 --- a/gen/deploymentmanager2_beta2-cli/Cargo.toml +++ b/gen/deploymentmanager2_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["deploymentmanager", "google", "cli"] name = "deploymentmanager2-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-deploymentmanager2_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-deploymentmanager2_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-deploymentmanager2_beta2] path = "../deploymentmanager2_beta2" +optional = true +default-features = false diff --git a/gen/deploymentmanager2_beta2-cli/src/cmn.rs b/gen/deploymentmanager2_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/deploymentmanager2_beta2-cli/src/cmn.rs +++ b/gen/deploymentmanager2_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/deploymentmanager2_beta2-cli/src/main.rs b/gen/deploymentmanager2_beta2-cli/src/main.rs index dbebcab5bc..d31030ee03 100644 --- a/gen/deploymentmanager2_beta2-cli/src/main.rs +++ b/gen/deploymentmanager2_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1049,7 +1049,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "deploymentmanager2-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/deploymentmanager2_beta2/Cargo.toml b/gen/deploymentmanager2_beta2/Cargo.toml index 8eca78dd7b..eca68c3b5c 100644 --- a/gen/deploymentmanager2_beta2/Cargo.toml +++ b/gen/deploymentmanager2_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2_beta2" -version = "0.1.12+20160201" +version = "0.1.13+20160201" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta2" @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.7" -mime = "0.1.0" -serde = ">= 0.7.0" -serde_json = ">= 0.7.0" -yup-oauth2 = ">= 0.5.4" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = ">= 0.23" } -serde_codegen = { version = ">= 0.6" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/deploymentmanager2_beta2/README.md b/gen/deploymentmanager2_beta2/README.md index 50f94ece22..13d6764a53 100644 --- a/gen/deploymentmanager2_beta2/README.md +++ b/gen/deploymentmanager2_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-deploymentmanager2_beta2` library allows access to all features of the *Google Deployment Manager* service. -This documentation was generated from *Deployment Manager* crate version *0.1.12+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.12*. +This documentation was generated from *Deployment Manager* crate version *0.1.13+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.13*. Everything else about the *Deployment Manager* *v2_beta2* API can be found at the [official documentation site](https://developers.google.com/deployment-manager/). diff --git a/gen/deploymentmanager2_beta2/src/build.rs b/gen/deploymentmanager2_beta2/src/build.rs index 4432190e78..12c6baf748 100644 --- a/gen/deploymentmanager2_beta2/src/build.rs +++ b/gen/deploymentmanager2_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-deploymentmanager2_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-deploymentmanager2_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/deploymentmanager2_beta2/src/lib.rs b/gen/deploymentmanager2_beta2/src/lib.rs index 6db43f3744..a4e1e336d6 100644 --- a/gen/deploymentmanager2_beta2/src/lib.rs +++ b/gen/deploymentmanager2_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Deployment Manager* crate version *0.1.12+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.12*. +//! This documentation was generated from *Deployment Manager* crate version *0.1.13+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.13*. //! //! Everything else about the *Deployment Manager* *v2_beta2* API can be found at the //! [official documentation site](https://developers.google.com/deployment-manager/). @@ -194,6 +194,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/deploymentmanager2_beta2/src/lib.rs.in b/gen/deploymentmanager2_beta2/src/lib.rs.in index 7839ef7d2a..53fa38499f 100644 --- a/gen/deploymentmanager2_beta2/src/lib.rs.in +++ b/gen/deploymentmanager2_beta2/src/lib.rs.in @@ -148,7 +148,7 @@ impl<'a, C, A> DeploymentManager DeploymentManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.12".to_string(), + _user_agent: "google-api-rust-client/0.1.13".to_string(), } } @@ -169,7 +169,7 @@ impl<'a, C, A> DeploymentManager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.12`. + /// It defaults to `google-api-rust-client/0.1.13`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1198,7 +1198,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -1268,8 +1268,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -1451,7 +1450,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, OperationsListResponse)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -1529,8 +1528,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -1732,7 +1730,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ManifestsListResponse)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -1811,8 +1809,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -2019,7 +2016,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Manifest)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -2090,8 +2087,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -2279,7 +2275,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ResourceType)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -2350,8 +2346,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -2544,7 +2539,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ResourcesListResponse)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -2623,8 +2618,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -2835,7 +2829,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, TypesListResponse)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -2913,8 +2907,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -3123,7 +3116,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -3213,8 +3206,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); @@ -3425,7 +3417,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Deployment)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -3495,8 +3487,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -3679,7 +3670,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -3759,8 +3750,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); @@ -3945,7 +3935,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, DeploymentsListResponse)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -4023,8 +4013,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) @@ -4233,7 +4222,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -4323,8 +4312,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); @@ -4535,7 +4523,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, @@ -4605,8 +4593,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } } }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) diff --git a/gen/dfareporting2d1-cli/Cargo.toml b/gen/dfareporting2d1-cli/Cargo.toml index d4afc928c9..4726215338 100644 --- a/gen/dfareporting2d1-cli/Cargo.toml +++ b/gen/dfareporting2d1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dfareporting", "google", "cli"] name = "dfareporting2d1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dfareporting2d1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dfareporting2d1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dfareporting2d1] path = "../dfareporting2d1" +optional = true +default-features = false diff --git a/gen/dfareporting2d1-cli/src/cmn.rs b/gen/dfareporting2d1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dfareporting2d1-cli/src/cmn.rs +++ b/gen/dfareporting2d1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dfareporting2d1-cli/src/main.rs b/gen/dfareporting2d1-cli/src/main.rs index b094d8f906..3fe009bbb0 100644 --- a/gen/dfareporting2d1-cli/src/main.rs +++ b/gen/dfareporting2d1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -16778,7 +16778,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dfareporting2d1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dfareporting2d1/Cargo.toml b/gen/dfareporting2d1/Cargo.toml index 89a4a6d4fb..9a4f7bc99a 100644 --- a/gen/dfareporting2d1/Cargo.toml +++ b/gen/dfareporting2d1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dfareporting2d1/src/build.rs b/gen/dfareporting2d1/src/build.rs index 055dc500b4..959f18340f 100644 --- a/gen/dfareporting2d1/src/build.rs +++ b/gen/dfareporting2d1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dfareporting2d1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dfareporting2d1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dfareporting2d1/src/lib.rs b/gen/dfareporting2d1/src/lib.rs index 9849a4296b..e5315977f2 100644 --- a/gen/dfareporting2d1/src/lib.rs +++ b/gen/dfareporting2d1/src/lib.rs @@ -303,6 +303,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dfareporting2d2-cli/Cargo.toml b/gen/dfareporting2d2-cli/Cargo.toml index c76c40f78d..5b83381d71 100644 --- a/gen/dfareporting2d2-cli/Cargo.toml +++ b/gen/dfareporting2d2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dfareporting", "google", "cli"] name = "dfareporting2d2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dfareporting2d2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dfareporting2d2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dfareporting2d2] path = "../dfareporting2d2" +optional = true +default-features = false diff --git a/gen/dfareporting2d2-cli/src/cmn.rs b/gen/dfareporting2d2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dfareporting2d2-cli/src/cmn.rs +++ b/gen/dfareporting2d2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dfareporting2d2-cli/src/main.rs b/gen/dfareporting2d2-cli/src/main.rs index bb571e107a..ca100d0f39 100644 --- a/gen/dfareporting2d2-cli/src/main.rs +++ b/gen/dfareporting2d2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -16798,7 +16798,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dfareporting2d2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dfareporting2d2/Cargo.toml b/gen/dfareporting2d2/Cargo.toml index 31b9426211..811c2c580d 100644 --- a/gen/dfareporting2d2/Cargo.toml +++ b/gen/dfareporting2d2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dfareporting2d2/src/build.rs b/gen/dfareporting2d2/src/build.rs index 0a12d85da6..fe38a30393 100644 --- a/gen/dfareporting2d2/src/build.rs +++ b/gen/dfareporting2d2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dfareporting2d2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dfareporting2d2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dfareporting2d2/src/lib.rs b/gen/dfareporting2d2/src/lib.rs index 5480703fab..188feb0ba6 100644 --- a/gen/dfareporting2d2/src/lib.rs +++ b/gen/dfareporting2d2/src/lib.rs @@ -303,6 +303,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dfareporting2d3-cli/Cargo.toml b/gen/dfareporting2d3-cli/Cargo.toml index 4f5a80e0b4..92da6c4ec7 100644 --- a/gen/dfareporting2d3-cli/Cargo.toml +++ b/gen/dfareporting2d3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dfareporting", "google", "cli"] name = "dfareporting2d3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dfareporting2d3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dfareporting2d3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dfareporting2d3] path = "../dfareporting2d3" +optional = true +default-features = false diff --git a/gen/dfareporting2d3-cli/src/cmn.rs b/gen/dfareporting2d3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dfareporting2d3-cli/src/cmn.rs +++ b/gen/dfareporting2d3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dfareporting2d3-cli/src/main.rs b/gen/dfareporting2d3-cli/src/main.rs index d672a39581..99fa10c403 100644 --- a/gen/dfareporting2d3-cli/src/main.rs +++ b/gen/dfareporting2d3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -16755,7 +16755,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dfareporting2d3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dfareporting2d3/Cargo.toml b/gen/dfareporting2d3/Cargo.toml index 354684f049..bc38549ef7 100644 --- a/gen/dfareporting2d3/Cargo.toml +++ b/gen/dfareporting2d3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dfareporting2d3/src/build.rs b/gen/dfareporting2d3/src/build.rs index 51eb388b81..f0349f90dd 100644 --- a/gen/dfareporting2d3/src/build.rs +++ b/gen/dfareporting2d3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dfareporting2d3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dfareporting2d3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dfareporting2d3/src/lib.rs b/gen/dfareporting2d3/src/lib.rs index 0cea9c99b7..2b4a97a232 100644 --- a/gen/dfareporting2d3/src/lib.rs +++ b/gen/dfareporting2d3/src/lib.rs @@ -303,6 +303,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dfareporting2d4-cli/Cargo.toml b/gen/dfareporting2d4-cli/Cargo.toml index 059fa9cd5c..59ada33dbb 100644 --- a/gen/dfareporting2d4-cli/Cargo.toml +++ b/gen/dfareporting2d4-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dfareporting", "google", "cli"] name = "dfareporting2d4" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dfareporting2d4/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dfareporting2d4/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dfareporting2d4] path = "../dfareporting2d4" +optional = true +default-features = false diff --git a/gen/dfareporting2d4-cli/src/cmn.rs b/gen/dfareporting2d4-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dfareporting2d4-cli/src/cmn.rs +++ b/gen/dfareporting2d4-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dfareporting2d4-cli/src/main.rs b/gen/dfareporting2d4-cli/src/main.rs index 54469cc047..421abf1195 100644 --- a/gen/dfareporting2d4-cli/src/main.rs +++ b/gen/dfareporting2d4-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -16758,7 +16758,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dfareporting2d4", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dfareporting2d4/Cargo.toml b/gen/dfareporting2d4/Cargo.toml index 534feed4ed..c2bae8883a 100644 --- a/gen/dfareporting2d4/Cargo.toml +++ b/gen/dfareporting2d4/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dfareporting2d4/src/build.rs b/gen/dfareporting2d4/src/build.rs index 76c824b3fd..b3c183c532 100644 --- a/gen/dfareporting2d4/src/build.rs +++ b/gen/dfareporting2d4/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dfareporting2d4", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dfareporting2d4", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dfareporting2d4/src/lib.rs b/gen/dfareporting2d4/src/lib.rs index b9c7c1ab5a..35f2415edd 100644 --- a/gen/dfareporting2d4/src/lib.rs +++ b/gen/dfareporting2d4/src/lib.rs @@ -303,6 +303,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/discovery1-cli/Cargo.toml b/gen/discovery1-cli/Cargo.toml index f831793b16..6dc2257923 100644 --- a/gen/discovery1-cli/Cargo.toml +++ b/gen/discovery1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["discovery", "google", "cli"] name = "discovery1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-discovery1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-discovery1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-discovery1] path = "../discovery1" +optional = true +default-features = false diff --git a/gen/discovery1-cli/src/cmn.rs b/gen/discovery1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/discovery1-cli/src/cmn.rs +++ b/gen/discovery1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/discovery1-cli/src/main.rs b/gen/discovery1-cli/src/main.rs index b1c699489f..6e2d7c2488 100644 --- a/gen/discovery1-cli/src/main.rs +++ b/gen/discovery1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -211,7 +211,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "discovery1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/discovery1/Cargo.toml b/gen/discovery1/Cargo.toml index ef0af74693..e6a2cd3c7f 100644 --- a/gen/discovery1/Cargo.toml +++ b/gen/discovery1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/discovery1/src/build.rs b/gen/discovery1/src/build.rs index ee57b87180..a13e254a3e 100644 --- a/gen/discovery1/src/build.rs +++ b/gen/discovery1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-discovery1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-discovery1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/discovery1/src/lib.rs b/gen/discovery1/src/lib.rs index 811f903bef..7f3347673d 100644 --- a/gen/discovery1/src/lib.rs +++ b/gen/discovery1/src/lib.rs @@ -172,6 +172,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dns1-cli/Cargo.toml b/gen/dns1-cli/Cargo.toml index 1c21b6e34a..c25850245f 100644 --- a/gen/dns1-cli/Cargo.toml +++ b/gen/dns1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["dns", "google", "cli"] name = "dns1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-dns1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-dns1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-dns1] path = "../dns1" +optional = true +default-features = false diff --git a/gen/dns1-cli/src/cmn.rs b/gen/dns1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/dns1-cli/src/cmn.rs +++ b/gen/dns1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/dns1-cli/src/main.rs b/gen/dns1-cli/src/main.rs index 93ebeb4909..5b6d005c24 100644 --- a/gen/dns1-cli/src/main.rs +++ b/gen/dns1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -723,7 +723,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "dns1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/dns1/Cargo.toml b/gen/dns1/Cargo.toml index e8f6578428..f0464f4278 100644 --- a/gen/dns1/Cargo.toml +++ b/gen/dns1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/dns1/src/build.rs b/gen/dns1/src/build.rs index 83547cfdd9..0e56e106e5 100644 --- a/gen/dns1/src/build.rs +++ b/gen/dns1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dns1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-dns1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/dns1/src/lib.rs b/gen/dns1/src/lib.rs index 9d61bd45b5..dbedb0bf56 100644 --- a/gen/dns1/src/lib.rs +++ b/gen/dns1/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/doubleclickbidmanager1-cli/Cargo.toml b/gen/doubleclickbidmanager1-cli/Cargo.toml index f13967d472..035778429c 100644 --- a/gen/doubleclickbidmanager1-cli/Cargo.toml +++ b/gen/doubleclickbidmanager1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["doubleclickbidmanage", "google", "cli"] name = "doubleclickbidmanager1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-doubleclickbidmanager1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-doubleclickbidmanager1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-doubleclickbidmanager1] path = "../doubleclickbidmanager1" +optional = true +default-features = false diff --git a/gen/doubleclickbidmanager1-cli/src/cmn.rs b/gen/doubleclickbidmanager1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/doubleclickbidmanager1-cli/src/cmn.rs +++ b/gen/doubleclickbidmanager1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/doubleclickbidmanager1-cli/src/main.rs b/gen/doubleclickbidmanager1-cli/src/main.rs index e5fdfbf4df..0ff67ddc10 100644 --- a/gen/doubleclickbidmanager1-cli/src/main.rs +++ b/gen/doubleclickbidmanager1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -767,7 +767,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "doubleclickbidmanager1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/doubleclickbidmanager1/Cargo.toml b/gen/doubleclickbidmanager1/Cargo.toml index 55f5987e7d..7079c7c35c 100644 --- a/gen/doubleclickbidmanager1/Cargo.toml +++ b/gen/doubleclickbidmanager1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/doubleclickbidmanager1/src/build.rs b/gen/doubleclickbidmanager1/src/build.rs index 4d82c9d756..632a0a3423 100644 --- a/gen/doubleclickbidmanager1/src/build.rs +++ b/gen/doubleclickbidmanager1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-doubleclickbidmanager1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-doubleclickbidmanager1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/doubleclickbidmanager1/src/lib.rs b/gen/doubleclickbidmanager1/src/lib.rs index 3140298864..aefe830a9c 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs +++ b/gen/doubleclickbidmanager1/src/lib.rs @@ -179,6 +179,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/doubleclicksearch2-cli/Cargo.toml b/gen/doubleclicksearch2-cli/Cargo.toml index 35ab7bb3fe..65ff5ff797 100644 --- a/gen/doubleclicksearch2-cli/Cargo.toml +++ b/gen/doubleclicksearch2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["doubleclicksearch", "google", "cli"] name = "doubleclicksearch2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-doubleclicksearch2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-doubleclicksearch2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-doubleclicksearch2] path = "../doubleclicksearch2" +optional = true +default-features = false diff --git a/gen/doubleclicksearch2-cli/src/cmn.rs b/gen/doubleclicksearch2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/doubleclicksearch2-cli/src/cmn.rs +++ b/gen/doubleclicksearch2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/doubleclicksearch2-cli/src/main.rs b/gen/doubleclicksearch2-cli/src/main.rs index a6d8019d97..fbd6302837 100644 --- a/gen/doubleclicksearch2-cli/src/main.rs +++ b/gen/doubleclicksearch2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -928,7 +928,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "doubleclicksearch2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/doubleclicksearch2/Cargo.toml b/gen/doubleclicksearch2/Cargo.toml index 865c3e5bb7..1c87ea9822 100644 --- a/gen/doubleclicksearch2/Cargo.toml +++ b/gen/doubleclicksearch2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/doubleclicksearch2/src/build.rs b/gen/doubleclicksearch2/src/build.rs index d174a77822..1c86a90564 100644 --- a/gen/doubleclicksearch2/src/build.rs +++ b/gen/doubleclicksearch2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-doubleclicksearch2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-doubleclicksearch2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/doubleclicksearch2/src/lib.rs b/gen/doubleclicksearch2/src/lib.rs index dfd2ab457f..2445e6adf5 100644 --- a/gen/doubleclicksearch2/src/lib.rs +++ b/gen/doubleclicksearch2/src/lib.rs @@ -183,6 +183,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/drive2-cli/Cargo.toml b/gen/drive2-cli/Cargo.toml index 57ccd711c3..47eb1c84d6 100644 --- a/gen/drive2-cli/Cargo.toml +++ b/gen/drive2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["drive", "google", "cli"] name = "drive2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-drive2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-drive2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-drive2] path = "../drive2" +optional = true +default-features = false diff --git a/gen/drive2-cli/src/cmn.rs b/gen/drive2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/drive2-cli/src/cmn.rs +++ b/gen/drive2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/drive2-cli/src/main.rs b/gen/drive2-cli/src/main.rs index 6d9dd8122a..26d3feb317 100644 --- a/gen/drive2-cli/src/main.rs +++ b/gen/drive2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -5233,7 +5233,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "drive2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/drive2/Cargo.toml b/gen/drive2/Cargo.toml index 9e423012d2..4f4621a161 100644 --- a/gen/drive2/Cargo.toml +++ b/gen/drive2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/drive2/src/build.rs b/gen/drive2/src/build.rs index 17d87a6ea2..a7edf0278a 100644 --- a/gen/drive2/src/build.rs +++ b/gen/drive2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-drive2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-drive2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/drive2/src/lib.rs b/gen/drive2/src/lib.rs index 2c5ac26661..b2c44652c0 100644 --- a/gen/drive2/src/lib.rs +++ b/gen/drive2/src/lib.rs @@ -249,6 +249,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml index f8bfdbd519..7ccffa1f9e 100644 --- a/gen/drive3-cli/Cargo.toml +++ b/gen/drive3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["drive", "google", "cli"] name = "drive3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-drive3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-drive3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-drive3] path = "../drive3" +optional = true +default-features = false diff --git a/gen/drive3-cli/src/cmn.rs b/gen/drive3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/drive3-cli/src/cmn.rs +++ b/gen/drive3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs index 2b79d87d90..1c7e637d05 100644 --- a/gen/drive3-cli/src/main.rs +++ b/gen/drive3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2947,7 +2947,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "drive3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/drive3/Cargo.toml b/gen/drive3/Cargo.toml index cc0aa85af2..8ffec56dca 100644 --- a/gen/drive3/Cargo.toml +++ b/gen/drive3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/drive3/src/build.rs b/gen/drive3/src/build.rs index 70bd97e5a7..406f314c78 100644 --- a/gen/drive3/src/build.rs +++ b/gen/drive3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-drive3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-drive3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/drive3/src/lib.rs b/gen/drive3/src/lib.rs index 93c856afe1..2a95cfffc7 100644 --- a/gen/drive3/src/lib.rs +++ b/gen/drive3/src/lib.rs @@ -227,6 +227,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/fitness1-cli/Cargo.toml b/gen/fitness1-cli/Cargo.toml index 184ac46f1e..4779cdaf00 100644 --- a/gen/fitness1-cli/Cargo.toml +++ b/gen/fitness1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["fitness", "google", "cli"] name = "fitness1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-fitness1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-fitness1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-fitness1] path = "../fitness1" +optional = true +default-features = false diff --git a/gen/fitness1-cli/src/cmn.rs b/gen/fitness1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/fitness1-cli/src/cmn.rs +++ b/gen/fitness1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/fitness1-cli/src/main.rs b/gen/fitness1-cli/src/main.rs index b28364ee1f..a361ff899e 100644 --- a/gen/fitness1-cli/src/main.rs +++ b/gen/fitness1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1100,7 +1100,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "fitness1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/fitness1/Cargo.toml b/gen/fitness1/Cargo.toml index 808860b6e8..23b4d338da 100644 --- a/gen/fitness1/Cargo.toml +++ b/gen/fitness1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/fitness1/src/build.rs b/gen/fitness1/src/build.rs index 31959cfc52..8e15130217 100644 --- a/gen/fitness1/src/build.rs +++ b/gen/fitness1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-fitness1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-fitness1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/fitness1/src/lib.rs b/gen/fitness1/src/lib.rs index 97bb469008..d126e0257b 100644 --- a/gen/fitness1/src/lib.rs +++ b/gen/fitness1/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/freebase1-cli/Cargo.toml b/gen/freebase1-cli/Cargo.toml index 425b396481..6c8088b681 100644 --- a/gen/freebase1-cli/Cargo.toml +++ b/gen/freebase1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["freebase", "google", "cli"] name = "freebase1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-freebase1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-freebase1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-freebase1] path = "../freebase1" +optional = true +default-features = false diff --git a/gen/freebase1-cli/src/cmn.rs b/gen/freebase1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/freebase1-cli/src/cmn.rs +++ b/gen/freebase1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/freebase1-cli/src/main.rs b/gen/freebase1-cli/src/main.rs index f98cb08359..f586922253 100644 --- a/gen/freebase1-cli/src/main.rs +++ b/gen/freebase1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -298,7 +298,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "freebase1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/freebase1/Cargo.toml b/gen/freebase1/Cargo.toml index 16cdaa8088..d86d3b1b0d 100644 --- a/gen/freebase1/Cargo.toml +++ b/gen/freebase1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/freebase1/src/build.rs b/gen/freebase1/src/build.rs index 3ebe2e950c..cb6722bbcb 100644 --- a/gen/freebase1/src/build.rs +++ b/gen/freebase1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-freebase1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-freebase1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/freebase1/src/lib.rs b/gen/freebase1/src/lib.rs index bf3ebd78f8..37b6edb5d5 100644 --- a/gen/freebase1/src/lib.rs +++ b/gen/freebase1/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/fusiontables2-cli/Cargo.toml b/gen/fusiontables2-cli/Cargo.toml index 617c70ebf6..0dd9fa99d9 100644 --- a/gen/fusiontables2-cli/Cargo.toml +++ b/gen/fusiontables2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["fusiontables", "google", "cli"] name = "fusiontables2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-fusiontables2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-fusiontables2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-fusiontables2] path = "../fusiontables2" +optional = true +default-features = false diff --git a/gen/fusiontables2-cli/src/cmn.rs b/gen/fusiontables2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/fusiontables2-cli/src/cmn.rs +++ b/gen/fusiontables2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/fusiontables2-cli/src/main.rs b/gen/fusiontables2-cli/src/main.rs index e291a397f8..71b242f7a0 100644 --- a/gen/fusiontables2-cli/src/main.rs +++ b/gen/fusiontables2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2644,7 +2644,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "fusiontables2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/fusiontables2/Cargo.toml b/gen/fusiontables2/Cargo.toml index f6a062e337..19dfe8505b 100644 --- a/gen/fusiontables2/Cargo.toml +++ b/gen/fusiontables2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/fusiontables2/src/build.rs b/gen/fusiontables2/src/build.rs index da814aafa4..30da8d3e82 100644 --- a/gen/fusiontables2/src/build.rs +++ b/gen/fusiontables2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-fusiontables2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-fusiontables2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/fusiontables2/src/lib.rs b/gen/fusiontables2/src/lib.rs index 7e4dd868b6..1cc0b772c9 100644 --- a/gen/fusiontables2/src/lib.rs +++ b/gen/fusiontables2/src/lib.rs @@ -201,6 +201,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/games1-cli/Cargo.toml b/gen/games1-cli/Cargo.toml index 02d9dc2fa0..5673b3ac44 100644 --- a/gen/games1-cli/Cargo.toml +++ b/gen/games1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["games", "google", "cli"] name = "games1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-games1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-games1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-games1] path = "../games1" +optional = true +default-features = false diff --git a/gen/games1-cli/src/cmn.rs b/gen/games1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/games1-cli/src/cmn.rs +++ b/gen/games1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/games1-cli/src/main.rs b/gen/games1-cli/src/main.rs index 0fa3ea21b2..cee535bfb9 100644 --- a/gen/games1-cli/src/main.rs +++ b/gen/games1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3813,7 +3813,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "games1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/games1/Cargo.toml b/gen/games1/Cargo.toml index 0b6fb19398..e850dad810 100644 --- a/gen/games1/Cargo.toml +++ b/gen/games1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/games1/src/build.rs b/gen/games1/src/build.rs index b7e45db435..0597452cab 100644 --- a/gen/games1/src/build.rs +++ b/gen/games1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-games1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-games1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/games1/src/lib.rs b/gen/games1/src/lib.rs index 13752cc725..58992b966f 100644 --- a/gen/games1/src/lib.rs +++ b/gen/games1/src/lib.rs @@ -209,6 +209,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/gamesconfiguration1_configuration-cli/Cargo.toml b/gen/gamesconfiguration1_configuration-cli/Cargo.toml index 90c523f831..6ba002b592 100644 --- a/gen/gamesconfiguration1_configuration-cli/Cargo.toml +++ b/gen/gamesconfiguration1_configuration-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["gamesConfiguration", "google", "cli"] name = "gamesconfiguration1-configuration" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-gamesconfiguration1_configuration/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-gamesconfiguration1_configuration/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-gamesconfiguration1_configuration] path = "../gamesconfiguration1_configuration" +optional = true +default-features = false diff --git a/gen/gamesconfiguration1_configuration-cli/src/cmn.rs b/gen/gamesconfiguration1_configuration-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/cmn.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/gamesconfiguration1_configuration-cli/src/main.rs b/gen/gamesconfiguration1_configuration-cli/src/main.rs index 96dc84facc..021697d011 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/main.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1175,7 +1175,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "gamesconfiguration1-configuration", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/gamesconfiguration1_configuration/Cargo.toml b/gen/gamesconfiguration1_configuration/Cargo.toml index b591f5b738..1b63f3c51c 100644 --- a/gen/gamesconfiguration1_configuration/Cargo.toml +++ b/gen/gamesconfiguration1_configuration/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/gamesconfiguration1_configuration/src/build.rs b/gen/gamesconfiguration1_configuration/src/build.rs index 7b3c70fd1f..f735ac5857 100644 --- a/gen/gamesconfiguration1_configuration/src/build.rs +++ b/gen/gamesconfiguration1_configuration/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-gamesconfiguration1_configuration", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-gamesconfiguration1_configuration", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs b/gen/gamesconfiguration1_configuration/src/lib.rs index 09b5be401f..74aaeb0e16 100644 --- a/gen/gamesconfiguration1_configuration/src/lib.rs +++ b/gen/gamesconfiguration1_configuration/src/lib.rs @@ -187,6 +187,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/gamesmanagement1_management-cli/Cargo.toml b/gen/gamesmanagement1_management-cli/Cargo.toml index 0b7631fe8c..03e1170191 100644 --- a/gen/gamesmanagement1_management-cli/Cargo.toml +++ b/gen/gamesmanagement1_management-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["gamesManagement", "google", "cli"] name = "gamesmanagement1-management" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-gamesmanagement1_management/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-gamesmanagement1_management/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-gamesmanagement1_management] path = "../gamesmanagement1_management" +optional = true +default-features = false diff --git a/gen/gamesmanagement1_management-cli/src/cmn.rs b/gen/gamesmanagement1_management-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/gamesmanagement1_management-cli/src/cmn.rs +++ b/gen/gamesmanagement1_management-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/gamesmanagement1_management-cli/src/main.rs b/gen/gamesmanagement1_management-cli/src/main.rs index dd56f2ddf7..691e708602 100644 --- a/gen/gamesmanagement1_management-cli/src/main.rs +++ b/gen/gamesmanagement1_management-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1608,7 +1608,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "gamesmanagement1-management", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/gamesmanagement1_management/Cargo.toml b/gen/gamesmanagement1_management/Cargo.toml index 02167fed4b..e5eb1b3c63 100644 --- a/gen/gamesmanagement1_management/Cargo.toml +++ b/gen/gamesmanagement1_management/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/gamesmanagement1_management/src/build.rs b/gen/gamesmanagement1_management/src/build.rs index 317ed1ce61..d6b45f54db 100644 --- a/gen/gamesmanagement1_management/src/build.rs +++ b/gen/gamesmanagement1_management/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-gamesmanagement1_management", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-gamesmanagement1_management", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/gamesmanagement1_management/src/lib.rs b/gen/gamesmanagement1_management/src/lib.rs index 7fac97512c..d04fbdb18e 100644 --- a/gen/gamesmanagement1_management/src/lib.rs +++ b/gen/gamesmanagement1_management/src/lib.rs @@ -187,6 +187,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/gan1_beta1-cli/Cargo.toml b/gen/gan1_beta1-cli/Cargo.toml index 90070b96dc..500ed07b23 100644 --- a/gen/gan1_beta1-cli/Cargo.toml +++ b/gen/gan1_beta1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["gan", "google", "cli"] name = "gan1-beta1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-gan1_beta1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-gan1_beta1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-gan1_beta1] path = "../gan1_beta1" +optional = true +default-features = false diff --git a/gen/gan1_beta1-cli/src/cmn.rs b/gen/gan1_beta1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/gan1_beta1-cli/src/cmn.rs +++ b/gen/gan1_beta1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/gan1_beta1-cli/src/main.rs b/gen/gan1_beta1-cli/src/main.rs index fce2ec7227..3ad9d0dac3 100644 --- a/gen/gan1_beta1-cli/src/main.rs +++ b/gen/gan1_beta1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -908,7 +908,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "gan1-beta1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/gan1_beta1/Cargo.toml b/gen/gan1_beta1/Cargo.toml index e38d12c073..18ea532c03 100644 --- a/gen/gan1_beta1/Cargo.toml +++ b/gen/gan1_beta1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/gan1_beta1/src/build.rs b/gen/gan1_beta1/src/build.rs index 8be4fdfee2..0b6aa24c5e 100644 --- a/gen/gan1_beta1/src/build.rs +++ b/gen/gan1_beta1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-gan1_beta1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-gan1_beta1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/gan1_beta1/src/lib.rs b/gen/gan1_beta1/src/lib.rs index 8dd7a1f3f1..36ab7989f3 100644 --- a/gen/gan1_beta1/src/lib.rs +++ b/gen/gan1_beta1/src/lib.rs @@ -197,6 +197,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/genomics1-cli/Cargo.toml b/gen/genomics1-cli/Cargo.toml index cb21aec331..ed54c1a654 100644 --- a/gen/genomics1-cli/Cargo.toml +++ b/gen/genomics1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["genomics", "google", "cli"] name = "genomics1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-genomics1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-genomics1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-genomics1] path = "../genomics1" +optional = true +default-features = false diff --git a/gen/genomics1-cli/src/cmn.rs b/gen/genomics1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/genomics1-cli/src/cmn.rs +++ b/gen/genomics1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/genomics1-cli/src/main.rs b/gen/genomics1-cli/src/main.rs index 8ea23bf780..992114944f 100644 --- a/gen/genomics1-cli/src/main.rs +++ b/gen/genomics1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -4644,7 +4644,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "genomics1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/genomics1/Cargo.toml b/gen/genomics1/Cargo.toml index eabed5f642..265bfd1b1c 100644 --- a/gen/genomics1/Cargo.toml +++ b/gen/genomics1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/genomics1/src/build.rs b/gen/genomics1/src/build.rs index 6b0f6b58f6..21b314d6e1 100644 --- a/gen/genomics1/src/build.rs +++ b/gen/genomics1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-genomics1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-genomics1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/genomics1/src/lib.rs b/gen/genomics1/src/lib.rs index 507ea6c721..1c01f3a80e 100644 --- a/gen/genomics1/src/lib.rs +++ b/gen/genomics1/src/lib.rs @@ -207,6 +207,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/gmail1-cli/Cargo.toml b/gen/gmail1-cli/Cargo.toml index db0a5f3eb2..af93d2f10c 100644 --- a/gen/gmail1-cli/Cargo.toml +++ b/gen/gmail1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["gmail", "google", "cli"] name = "gmail1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-gmail1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-gmail1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-gmail1] path = "../gmail1" +optional = true +default-features = false diff --git a/gen/gmail1-cli/src/cmn.rs b/gen/gmail1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/gmail1-cli/src/cmn.rs +++ b/gen/gmail1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/gmail1-cli/src/main.rs b/gen/gmail1-cli/src/main.rs index d7b91047e1..2ec6794eed 100644 --- a/gen/gmail1-cli/src/main.rs +++ b/gen/gmail1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -2522,7 +2522,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "gmail1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/gmail1/Cargo.toml b/gen/gmail1/Cargo.toml index 263616c9ac..7fb4aea9a5 100644 --- a/gen/gmail1/Cargo.toml +++ b/gen/gmail1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/gmail1/src/build.rs b/gen/gmail1/src/build.rs index 058fd3d8e1..972226e20f 100644 --- a/gen/gmail1/src/build.rs +++ b/gen/gmail1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-gmail1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-gmail1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/gmail1/src/lib.rs b/gen/gmail1/src/lib.rs index e6af31adb8..0c214f70b6 100644 --- a/gen/gmail1/src/lib.rs +++ b/gen/gmail1/src/lib.rs @@ -199,6 +199,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/groupsmigration1-cli/Cargo.toml b/gen/groupsmigration1-cli/Cargo.toml index 6a9bb7df6b..1eda3ae390 100644 --- a/gen/groupsmigration1-cli/Cargo.toml +++ b/gen/groupsmigration1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["groupsmigration", "google", "cli"] name = "groupsmigration1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-groupsmigration1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-groupsmigration1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-groupsmigration1] path = "../groupsmigration1" +optional = true +default-features = false diff --git a/gen/groupsmigration1-cli/src/cmn.rs b/gen/groupsmigration1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/groupsmigration1-cli/src/cmn.rs +++ b/gen/groupsmigration1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/groupsmigration1-cli/src/main.rs b/gen/groupsmigration1-cli/src/main.rs index 307569a64b..6ee1296154 100644 --- a/gen/groupsmigration1-cli/src/main.rs +++ b/gen/groupsmigration1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -159,7 +159,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "groupsmigration1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/groupsmigration1/Cargo.toml b/gen/groupsmigration1/Cargo.toml index f55c55a2d6..b207a42723 100644 --- a/gen/groupsmigration1/Cargo.toml +++ b/gen/groupsmigration1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/groupsmigration1/src/build.rs b/gen/groupsmigration1/src/build.rs index 7b9965aa44..405a00196d 100644 --- a/gen/groupsmigration1/src/build.rs +++ b/gen/groupsmigration1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-groupsmigration1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-groupsmigration1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/groupsmigration1/src/lib.rs b/gen/groupsmigration1/src/lib.rs index 03f5e18b92..81f5149184 100644 --- a/gen/groupsmigration1/src/lib.rs +++ b/gen/groupsmigration1/src/lib.rs @@ -177,6 +177,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/groupssettings1-cli/Cargo.toml b/gen/groupssettings1-cli/Cargo.toml index d0756346ea..0087af8847 100644 --- a/gen/groupssettings1-cli/Cargo.toml +++ b/gen/groupssettings1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["groupssettings", "google", "cli"] name = "groupssettings1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-groupssettings1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-groupssettings1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-groupssettings1] path = "../groupssettings1" +optional = true +default-features = false diff --git a/gen/groupssettings1-cli/src/cmn.rs b/gen/groupssettings1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/groupssettings1-cli/src/cmn.rs +++ b/gen/groupssettings1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/groupssettings1-cli/src/main.rs b/gen/groupssettings1-cli/src/main.rs index 4621e03af3..3c74d15804 100644 --- a/gen/groupssettings1-cli/src/main.rs +++ b/gen/groupssettings1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -387,7 +387,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "groupssettings1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/groupssettings1/Cargo.toml b/gen/groupssettings1/Cargo.toml index 77ffdabcdd..589ba41432 100644 --- a/gen/groupssettings1/Cargo.toml +++ b/gen/groupssettings1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/groupssettings1/src/build.rs b/gen/groupssettings1/src/build.rs index 3e24be5bec..a629df6903 100644 --- a/gen/groupssettings1/src/build.rs +++ b/gen/groupssettings1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-groupssettings1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-groupssettings1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/groupssettings1/src/lib.rs b/gen/groupssettings1/src/lib.rs index 7fb4abd7a0..7471400070 100644 --- a/gen/groupssettings1/src/lib.rs +++ b/gen/groupssettings1/src/lib.rs @@ -180,6 +180,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/iam1-cli/Cargo.toml b/gen/iam1-cli/Cargo.toml index 7671ee3760..e881e0f8d2 100644 --- a/gen/iam1-cli/Cargo.toml +++ b/gen/iam1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["iam", "google", "cli"] name = "iam1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-iam1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-iam1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-iam1] path = "../iam1" +optional = true +default-features = false diff --git a/gen/iam1-cli/src/cmn.rs b/gen/iam1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/iam1-cli/src/cmn.rs +++ b/gen/iam1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/iam1-cli/src/main.rs b/gen/iam1-cli/src/main.rs index eb5ea57965..d364023b2d 100644 --- a/gen/iam1-cli/src/main.rs +++ b/gen/iam1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1038,7 +1038,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "iam1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/iam1/Cargo.toml b/gen/iam1/Cargo.toml index 7153178b3e..19390f9580 100644 --- a/gen/iam1/Cargo.toml +++ b/gen/iam1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/iam1/src/build.rs b/gen/iam1/src/build.rs index 63d480dedf..ead987cfe5 100644 --- a/gen/iam1/src/build.rs +++ b/gen/iam1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-iam1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-iam1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/iam1/src/lib.rs b/gen/iam1/src/lib.rs index 6984290d9a..2af5b446e5 100644 --- a/gen/iam1/src/lib.rs +++ b/gen/iam1/src/lib.rs @@ -180,6 +180,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/identitytoolkit3-cli/Cargo.toml b/gen/identitytoolkit3-cli/Cargo.toml index fb378d7ca4..34137c0b6d 100644 --- a/gen/identitytoolkit3-cli/Cargo.toml +++ b/gen/identitytoolkit3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["identitytoolkit", "google", "cli"] name = "identitytoolkit3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-identitytoolkit3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-identitytoolkit3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-identitytoolkit3] path = "../identitytoolkit3" +optional = true +default-features = false diff --git a/gen/identitytoolkit3-cli/src/cmn.rs b/gen/identitytoolkit3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/identitytoolkit3-cli/src/cmn.rs +++ b/gen/identitytoolkit3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/identitytoolkit3-cli/src/main.rs b/gen/identitytoolkit3-cli/src/main.rs index 2a976d62b9..99429adae8 100644 --- a/gen/identitytoolkit3-cli/src/main.rs +++ b/gen/identitytoolkit3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1556,7 +1556,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "identitytoolkit3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/identitytoolkit3/Cargo.toml b/gen/identitytoolkit3/Cargo.toml index fc352a2db0..ecebbdf1e7 100644 --- a/gen/identitytoolkit3/Cargo.toml +++ b/gen/identitytoolkit3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/identitytoolkit3/src/build.rs b/gen/identitytoolkit3/src/build.rs index 4e8c9394cd..efcb7e17ca 100644 --- a/gen/identitytoolkit3/src/build.rs +++ b/gen/identitytoolkit3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-identitytoolkit3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-identitytoolkit3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/identitytoolkit3/src/lib.rs b/gen/identitytoolkit3/src/lib.rs index 70ca4e64b7..befa886317 100644 --- a/gen/identitytoolkit3/src/lib.rs +++ b/gen/identitytoolkit3/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/kgsearch1-cli/Cargo.toml b/gen/kgsearch1-cli/Cargo.toml index 3d7f0e77b7..2a8b7146a9 100644 --- a/gen/kgsearch1-cli/Cargo.toml +++ b/gen/kgsearch1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["kgsearch", "google", "cli"] name = "kgsearch1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-kgsearch1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-kgsearch1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-kgsearch1] path = "../kgsearch1" +optional = true +default-features = false diff --git a/gen/kgsearch1-cli/src/cmn.rs b/gen/kgsearch1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/kgsearch1-cli/src/cmn.rs +++ b/gen/kgsearch1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/kgsearch1-cli/src/main.rs b/gen/kgsearch1-cli/src/main.rs index b01ffa934b..1912c06d45 100644 --- a/gen/kgsearch1-cli/src/main.rs +++ b/gen/kgsearch1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -174,7 +174,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "kgsearch1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/kgsearch1/Cargo.toml b/gen/kgsearch1/Cargo.toml index b81b4d56d0..5840ce77f2 100644 --- a/gen/kgsearch1/Cargo.toml +++ b/gen/kgsearch1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/kgsearch1/src/build.rs b/gen/kgsearch1/src/build.rs index cfd14121ce..28ec260e5c 100644 --- a/gen/kgsearch1/src/build.rs +++ b/gen/kgsearch1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-kgsearch1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-kgsearch1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/kgsearch1/src/lib.rs b/gen/kgsearch1/src/lib.rs index 4d3b73387a..4c541f167b 100644 --- a/gen/kgsearch1/src/lib.rs +++ b/gen/kgsearch1/src/lib.rs @@ -179,6 +179,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/licensing1-cli/Cargo.toml b/gen/licensing1-cli/Cargo.toml index 2d3da2e3c4..3fcd5ff32e 100644 --- a/gen/licensing1-cli/Cargo.toml +++ b/gen/licensing1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["licensing", "google", "cli"] name = "licensing1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-licensing1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-licensing1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-licensing1] path = "../licensing1" +optional = true +default-features = false diff --git a/gen/licensing1-cli/src/cmn.rs b/gen/licensing1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/licensing1-cli/src/cmn.rs +++ b/gen/licensing1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/licensing1-cli/src/main.rs b/gen/licensing1-cli/src/main.rs index fcb38d9b7c..8e46d40b1b 100644 --- a/gen/licensing1-cli/src/main.rs +++ b/gen/licensing1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -600,7 +600,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "licensing1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/licensing1/Cargo.toml b/gen/licensing1/Cargo.toml index b0d3660b89..56c5fb2bef 100644 --- a/gen/licensing1/Cargo.toml +++ b/gen/licensing1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/licensing1/src/build.rs b/gen/licensing1/src/build.rs index 6178ac0bdd..7ee1d4814e 100644 --- a/gen/licensing1/src/build.rs +++ b/gen/licensing1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-licensing1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-licensing1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/licensing1/src/lib.rs b/gen/licensing1/src/lib.rs index 274a3406a9..fa4dd61cd5 100644 --- a/gen/licensing1/src/lib.rs +++ b/gen/licensing1/src/lib.rs @@ -180,6 +180,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/logging2_beta1-cli/Cargo.toml b/gen/logging2_beta1-cli/Cargo.toml index 603fd4b4b8..edf1e3ddd2 100644 --- a/gen/logging2_beta1-cli/Cargo.toml +++ b/gen/logging2_beta1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["logging", "google", "cli"] name = "logging2-beta1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-logging2_beta1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-logging2_beta1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-logging2_beta1] path = "../logging2_beta1" +optional = true +default-features = false diff --git a/gen/logging2_beta1-cli/src/cmn.rs b/gen/logging2_beta1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/logging2_beta1-cli/src/cmn.rs +++ b/gen/logging2_beta1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/logging2_beta1-cli/src/main.rs b/gen/logging2_beta1-cli/src/main.rs index d67ca7584c..c67d780d05 100644 --- a/gen/logging2_beta1-cli/src/main.rs +++ b/gen/logging2_beta1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1124,7 +1124,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "logging2-beta1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/logging2_beta1/Cargo.toml b/gen/logging2_beta1/Cargo.toml index 8136305a04..7d374833f8 100644 --- a/gen/logging2_beta1/Cargo.toml +++ b/gen/logging2_beta1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/logging2_beta1/src/build.rs b/gen/logging2_beta1/src/build.rs index d993da1571..4915f6684c 100644 --- a/gen/logging2_beta1/src/build.rs +++ b/gen/logging2_beta1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-logging2_beta1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-logging2_beta1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/logging2_beta1/src/lib.rs b/gen/logging2_beta1/src/lib.rs index 44bb3bf232..fe9482630a 100644 --- a/gen/logging2_beta1/src/lib.rs +++ b/gen/logging2_beta1/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/manager1_beta2-cli/Cargo.toml b/gen/manager1_beta2-cli/Cargo.toml index 6142124afa..f7d68d86b8 100644 --- a/gen/manager1_beta2-cli/Cargo.toml +++ b/gen/manager1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["manager", "google", "cli"] name = "manager1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-manager1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-manager1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-manager1_beta2] path = "../manager1_beta2" +optional = true +default-features = false diff --git a/gen/manager1_beta2-cli/src/cmn.rs b/gen/manager1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/manager1_beta2-cli/src/cmn.rs +++ b/gen/manager1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/manager1_beta2-cli/src/main.rs b/gen/manager1_beta2-cli/src/main.rs index e3431fa1fe..aa584e889f 100644 --- a/gen/manager1_beta2-cli/src/main.rs +++ b/gen/manager1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -618,7 +618,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "manager1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/manager1_beta2/Cargo.toml b/gen/manager1_beta2/Cargo.toml index 738ba3b1b4..3573c4b687 100644 --- a/gen/manager1_beta2/Cargo.toml +++ b/gen/manager1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/manager1_beta2/src/build.rs b/gen/manager1_beta2/src/build.rs index 06df0ca6a5..cc661d359c 100644 --- a/gen/manager1_beta2/src/build.rs +++ b/gen/manager1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-manager1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-manager1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/manager1_beta2/src/lib.rs b/gen/manager1_beta2/src/lib.rs index 37576bd28e..2e13b30edd 100644 --- a/gen/manager1_beta2/src/lib.rs +++ b/gen/manager1_beta2/src/lib.rs @@ -179,6 +179,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/mirror1-cli/Cargo.toml b/gen/mirror1-cli/Cargo.toml index 57553cded0..662bd5a336 100644 --- a/gen/mirror1-cli/Cargo.toml +++ b/gen/mirror1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["mirror", "google", "cli"] name = "mirror1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-mirror1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-mirror1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-mirror1] path = "../mirror1" +optional = true +default-features = false diff --git a/gen/mirror1-cli/src/cmn.rs b/gen/mirror1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/mirror1-cli/src/cmn.rs +++ b/gen/mirror1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/mirror1-cli/src/main.rs b/gen/mirror1-cli/src/main.rs index 077040a578..17de166d5a 100644 --- a/gen/mirror1-cli/src/main.rs +++ b/gen/mirror1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1940,7 +1940,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "mirror1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/mirror1/Cargo.toml b/gen/mirror1/Cargo.toml index ab1ffc6ced..1ea7cbda2b 100644 --- a/gen/mirror1/Cargo.toml +++ b/gen/mirror1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/mirror1/src/build.rs b/gen/mirror1/src/build.rs index 9d9512cdd8..aa0da5964a 100644 --- a/gen/mirror1/src/build.rs +++ b/gen/mirror1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-mirror1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-mirror1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/mirror1/src/lib.rs b/gen/mirror1/src/lib.rs index 2f375df40c..4a0b285167 100644 --- a/gen/mirror1/src/lib.rs +++ b/gen/mirror1/src/lib.rs @@ -203,6 +203,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/monitoring3-cli/Cargo.toml b/gen/monitoring3-cli/Cargo.toml index 8fce203e59..f8fa5097a4 100644 --- a/gen/monitoring3-cli/Cargo.toml +++ b/gen/monitoring3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["monitoring", "google", "cli"] name = "monitoring3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-monitoring3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-monitoring3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-monitoring3] path = "../monitoring3" +optional = true +default-features = false diff --git a/gen/monitoring3-cli/src/cmn.rs b/gen/monitoring3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/monitoring3-cli/src/cmn.rs +++ b/gen/monitoring3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/monitoring3-cli/src/main.rs b/gen/monitoring3-cli/src/main.rs index f6f0a768eb..2ef8a1cfd2 100644 --- a/gen/monitoring3-cli/src/main.rs +++ b/gen/monitoring3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1199,7 +1199,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "monitoring3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/monitoring3/Cargo.toml b/gen/monitoring3/Cargo.toml index 516489372b..3ca302e854 100644 --- a/gen/monitoring3/Cargo.toml +++ b/gen/monitoring3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/monitoring3/src/build.rs b/gen/monitoring3/src/build.rs index e9d4422e12..74ad1bb9b6 100644 --- a/gen/monitoring3/src/build.rs +++ b/gen/monitoring3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-monitoring3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-monitoring3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/monitoring3/src/lib.rs b/gen/monitoring3/src/lib.rs index 2b257a08c2..6e235e554f 100644 --- a/gen/monitoring3/src/lib.rs +++ b/gen/monitoring3/src/lib.rs @@ -181,6 +181,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/oauth2_v2-cli/Cargo.toml b/gen/oauth2_v2-cli/Cargo.toml index a2fe164080..eb999505a3 100644 --- a/gen/oauth2_v2-cli/Cargo.toml +++ b/gen/oauth2_v2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["oauth2", "google", "cli"] name = "oauth2-v2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-oauth2_v2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-oauth2_v2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-oauth2_v2] path = "../oauth2_v2" +optional = true +default-features = false diff --git a/gen/oauth2_v2-cli/src/cmn.rs b/gen/oauth2_v2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/oauth2_v2-cli/src/cmn.rs +++ b/gen/oauth2_v2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/oauth2_v2-cli/src/main.rs b/gen/oauth2_v2-cli/src/main.rs index b9dd7994a7..a33cbd7e82 100644 --- a/gen/oauth2_v2-cli/src/main.rs +++ b/gen/oauth2_v2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -332,7 +332,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "oauth2-v2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/oauth2_v2/Cargo.toml b/gen/oauth2_v2/Cargo.toml index be7e30a097..5ef2c813a7 100644 --- a/gen/oauth2_v2/Cargo.toml +++ b/gen/oauth2_v2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/oauth2_v2/src/build.rs b/gen/oauth2_v2/src/build.rs index e66e831671..4c6b1a62be 100644 --- a/gen/oauth2_v2/src/build.rs +++ b/gen/oauth2_v2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-oauth2_v2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-oauth2_v2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/oauth2_v2/src/lib.rs b/gen/oauth2_v2/src/lib.rs index eea8f91163..f965c3a787 100644 --- a/gen/oauth2_v2/src/lib.rs +++ b/gen/oauth2_v2/src/lib.rs @@ -177,6 +177,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/pagespeedonline2-cli/Cargo.toml b/gen/pagespeedonline2-cli/Cargo.toml index 3ba9cf18f2..6fe996b3c2 100644 --- a/gen/pagespeedonline2-cli/Cargo.toml +++ b/gen/pagespeedonline2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["pagespeedonline", "google", "cli"] name = "pagespeedonline2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-pagespeedonline2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-pagespeedonline2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-pagespeedonline2] path = "../pagespeedonline2" +optional = true +default-features = false diff --git a/gen/pagespeedonline2-cli/src/cmn.rs b/gen/pagespeedonline2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/pagespeedonline2-cli/src/cmn.rs +++ b/gen/pagespeedonline2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/pagespeedonline2-cli/src/main.rs b/gen/pagespeedonline2-cli/src/main.rs index 7402d2e525..4fe9575114 100644 --- a/gen/pagespeedonline2-cli/src/main.rs +++ b/gen/pagespeedonline2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -168,7 +168,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "pagespeedonline2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/pagespeedonline2/Cargo.toml b/gen/pagespeedonline2/Cargo.toml index 8d3ed5a61f..a6cfdd48d7 100644 --- a/gen/pagespeedonline2/Cargo.toml +++ b/gen/pagespeedonline2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/pagespeedonline2/src/build.rs b/gen/pagespeedonline2/src/build.rs index b691eb3767..4345ddcaae 100644 --- a/gen/pagespeedonline2/src/build.rs +++ b/gen/pagespeedonline2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-pagespeedonline2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-pagespeedonline2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/pagespeedonline2/src/lib.rs b/gen/pagespeedonline2/src/lib.rs index 12e15f6606..b4f8b3d536 100644 --- a/gen/pagespeedonline2/src/lib.rs +++ b/gen/pagespeedonline2/src/lib.rs @@ -177,6 +177,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/partners2-cli/Cargo.toml b/gen/partners2-cli/Cargo.toml index 05d1044d35..b10addb87c 100644 --- a/gen/partners2-cli/Cargo.toml +++ b/gen/partners2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["partners", "google", "cli"] name = "partners2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-partners2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-partners2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-partners2] path = "../partners2" +optional = true +default-features = false diff --git a/gen/partners2-cli/src/cmn.rs b/gen/partners2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/partners2-cli/src/cmn.rs +++ b/gen/partners2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/partners2-cli/src/main.rs b/gen/partners2-cli/src/main.rs index 76fb1997f7..0dfd990f28 100644 --- a/gen/partners2-cli/src/main.rs +++ b/gen/partners2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -715,7 +715,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "partners2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/partners2/Cargo.toml b/gen/partners2/Cargo.toml index e0d622671c..4cc85cc7e2 100644 --- a/gen/partners2/Cargo.toml +++ b/gen/partners2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/partners2/src/build.rs b/gen/partners2/src/build.rs index 406272c4a4..41fb354353 100644 --- a/gen/partners2/src/build.rs +++ b/gen/partners2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-partners2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-partners2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/partners2/src/lib.rs b/gen/partners2/src/lib.rs index 11cdf199e7..c69ea57c40 100644 --- a/gen/partners2/src/lib.rs +++ b/gen/partners2/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/people1-cli/Cargo.toml b/gen/people1-cli/Cargo.toml index d409d27705..4758e837ea 100644 --- a/gen/people1-cli/Cargo.toml +++ b/gen/people1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["people", "google", "cli"] name = "people1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-people1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-people1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-people1] path = "../people1" +optional = true +default-features = false diff --git a/gen/people1-cli/src/cmn.rs b/gen/people1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/people1-cli/src/cmn.rs +++ b/gen/people1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/people1-cli/src/main.rs b/gen/people1-cli/src/main.rs index f7c7873d35..7c7f434460 100644 --- a/gen/people1-cli/src/main.rs +++ b/gen/people1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -292,7 +292,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "people1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/people1/Cargo.toml b/gen/people1/Cargo.toml index 9ae10beaf2..1b0b1819b5 100644 --- a/gen/people1/Cargo.toml +++ b/gen/people1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/people1/src/build.rs b/gen/people1/src/build.rs index 6b5b7a09ea..d397b1d31d 100644 --- a/gen/people1/src/build.rs +++ b/gen/people1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-people1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-people1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/people1/src/lib.rs b/gen/people1/src/lib.rs index f2ea1642da..3449784467 100644 --- a/gen/people1/src/lib.rs +++ b/gen/people1/src/lib.rs @@ -173,6 +173,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/playmoviespartner1-cli/Cargo.toml b/gen/playmoviespartner1-cli/Cargo.toml index 564aec08d8..4a39b0edef 100644 --- a/gen/playmoviespartner1-cli/Cargo.toml +++ b/gen/playmoviespartner1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["playmoviespartner", "google", "cli"] name = "playmoviespartner1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-playmoviespartner1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-playmoviespartner1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-playmoviespartner1] path = "../playmoviespartner1" +optional = true +default-features = false diff --git a/gen/playmoviespartner1-cli/src/cmn.rs b/gen/playmoviespartner1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/playmoviespartner1-cli/src/cmn.rs +++ b/gen/playmoviespartner1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/playmoviespartner1-cli/src/main.rs b/gen/playmoviespartner1-cli/src/main.rs index ecef3c8e82..f5df3a4ea8 100644 --- a/gen/playmoviespartner1-cli/src/main.rs +++ b/gen/playmoviespartner1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -585,7 +585,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "playmoviespartner1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/playmoviespartner1/Cargo.toml b/gen/playmoviespartner1/Cargo.toml index 1335ac3d4d..3a95d60580 100644 --- a/gen/playmoviespartner1/Cargo.toml +++ b/gen/playmoviespartner1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/playmoviespartner1/src/build.rs b/gen/playmoviespartner1/src/build.rs index fc97d3fa42..dffdbcaaf9 100644 --- a/gen/playmoviespartner1/src/build.rs +++ b/gen/playmoviespartner1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-playmoviespartner1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-playmoviespartner1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/playmoviespartner1/src/lib.rs b/gen/playmoviespartner1/src/lib.rs index bf8f4df95e..59009da935 100644 --- a/gen/playmoviespartner1/src/lib.rs +++ b/gen/playmoviespartner1/src/lib.rs @@ -172,6 +172,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/plus1-cli/Cargo.toml b/gen/plus1-cli/Cargo.toml index a0955bde12..83c4fab761 100644 --- a/gen/plus1-cli/Cargo.toml +++ b/gen/plus1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["plus", "google", "cli"] name = "plus1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-plus1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-plus1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-plus1] path = "../plus1" +optional = true +default-features = false diff --git a/gen/plus1-cli/src/cmn.rs b/gen/plus1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/plus1-cli/src/cmn.rs +++ b/gen/plus1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/plus1-cli/src/main.rs b/gen/plus1-cli/src/main.rs index 28811993b3..edb7e88a22 100644 --- a/gen/plus1-cli/src/main.rs +++ b/gen/plus1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -668,7 +668,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "plus1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/plus1/Cargo.toml b/gen/plus1/Cargo.toml index 4abd9d70b5..2ced13227f 100644 --- a/gen/plus1/Cargo.toml +++ b/gen/plus1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/plus1/src/build.rs b/gen/plus1/src/build.rs index b8cdc64329..4d103d8e68 100644 --- a/gen/plus1/src/build.rs +++ b/gen/plus1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-plus1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-plus1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/plus1/src/lib.rs b/gen/plus1/src/lib.rs index 6014188002..518988c125 100644 --- a/gen/plus1/src/lib.rs +++ b/gen/plus1/src/lib.rs @@ -181,6 +181,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/plusdomains1-cli/Cargo.toml b/gen/plusdomains1-cli/Cargo.toml index d7047a5952..88a06a42f2 100644 --- a/gen/plusdomains1-cli/Cargo.toml +++ b/gen/plusdomains1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["plusDomains", "google", "cli"] name = "plusdomains1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-plusdomains1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-plusdomains1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-plusdomains1] path = "../plusdomains1" +optional = true +default-features = false diff --git a/gen/plusdomains1-cli/src/cmn.rs b/gen/plusdomains1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/plusdomains1-cli/src/cmn.rs +++ b/gen/plusdomains1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/plusdomains1-cli/src/main.rs b/gen/plusdomains1-cli/src/main.rs index 6048b54b01..9a22aff51f 100644 --- a/gen/plusdomains1-cli/src/main.rs +++ b/gen/plusdomains1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1606,7 +1606,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "plusdomains1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/plusdomains1/Cargo.toml b/gen/plusdomains1/Cargo.toml index 7fffd31d4b..b17e0ecf07 100644 --- a/gen/plusdomains1/Cargo.toml +++ b/gen/plusdomains1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/plusdomains1/src/build.rs b/gen/plusdomains1/src/build.rs index 2db0524193..2b9bde83e4 100644 --- a/gen/plusdomains1/src/build.rs +++ b/gen/plusdomains1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-plusdomains1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-plusdomains1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/plusdomains1/src/lib.rs b/gen/plusdomains1/src/lib.rs index 01f8f2c1c4..7b549dfead 100644 --- a/gen/plusdomains1/src/lib.rs +++ b/gen/plusdomains1/src/lib.rs @@ -195,6 +195,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/prediction1d6-cli/Cargo.toml b/gen/prediction1d6-cli/Cargo.toml index 8ef834bdfc..f24d46fe93 100644 --- a/gen/prediction1d6-cli/Cargo.toml +++ b/gen/prediction1d6-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["prediction", "google", "cli"] name = "prediction1d6" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-prediction1d6/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-prediction1d6/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-prediction1d6] path = "../prediction1d6" +optional = true +default-features = false diff --git a/gen/prediction1d6-cli/src/cmn.rs b/gen/prediction1d6-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/prediction1d6-cli/src/cmn.rs +++ b/gen/prediction1d6-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/prediction1d6-cli/src/main.rs b/gen/prediction1d6-cli/src/main.rs index 5c19bb2a6f..77790e5bd1 100644 --- a/gen/prediction1d6-cli/src/main.rs +++ b/gen/prediction1d6-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -682,7 +682,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "prediction1d6", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/prediction1d6/Cargo.toml b/gen/prediction1d6/Cargo.toml index af428e85fb..563164d9c7 100644 --- a/gen/prediction1d6/Cargo.toml +++ b/gen/prediction1d6/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/prediction1d6/src/build.rs b/gen/prediction1d6/src/build.rs index 41b1240fb8..919fd8c865 100644 --- a/gen/prediction1d6/src/build.rs +++ b/gen/prediction1d6/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-prediction1d6", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-prediction1d6", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/prediction1d6/src/lib.rs b/gen/prediction1d6/src/lib.rs index 602ab62538..8e14041c8a 100644 --- a/gen/prediction1d6/src/lib.rs +++ b/gen/prediction1d6/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/proximitybeacon1_beta1-cli/Cargo.toml b/gen/proximitybeacon1_beta1-cli/Cargo.toml index 3795c84756..cdeb22c6d7 100644 --- a/gen/proximitybeacon1_beta1-cli/Cargo.toml +++ b/gen/proximitybeacon1_beta1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["proximitybeacon", "google", "cli"] name = "proximitybeacon1-beta1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-proximitybeacon1_beta1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-proximitybeacon1_beta1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-proximitybeacon1_beta1] path = "../proximitybeacon1_beta1" +optional = true +default-features = false diff --git a/gen/proximitybeacon1_beta1-cli/src/cmn.rs b/gen/proximitybeacon1_beta1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/proximitybeacon1_beta1-cli/src/cmn.rs +++ b/gen/proximitybeacon1_beta1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/proximitybeacon1_beta1-cli/src/main.rs b/gen/proximitybeacon1_beta1-cli/src/main.rs index 8a6367d9d9..59ec1505b1 100644 --- a/gen/proximitybeacon1_beta1-cli/src/main.rs +++ b/gen/proximitybeacon1_beta1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1026,7 +1026,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "proximitybeacon1-beta1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/proximitybeacon1_beta1/Cargo.toml b/gen/proximitybeacon1_beta1/Cargo.toml index af291b10e8..f12c42a905 100644 --- a/gen/proximitybeacon1_beta1/Cargo.toml +++ b/gen/proximitybeacon1_beta1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/proximitybeacon1_beta1/src/build.rs b/gen/proximitybeacon1_beta1/src/build.rs index 6f5f433cf9..78c399bcb4 100644 --- a/gen/proximitybeacon1_beta1/src/build.rs +++ b/gen/proximitybeacon1_beta1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-proximitybeacon1_beta1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-proximitybeacon1_beta1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/proximitybeacon1_beta1/src/lib.rs b/gen/proximitybeacon1_beta1/src/lib.rs index 51ca09a6d4..c4f8741e99 100644 --- a/gen/proximitybeacon1_beta1/src/lib.rs +++ b/gen/proximitybeacon1_beta1/src/lib.rs @@ -190,6 +190,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/pubsub1-cli/Cargo.toml b/gen/pubsub1-cli/Cargo.toml index 51e49e6edb..1d17267414 100644 --- a/gen/pubsub1-cli/Cargo.toml +++ b/gen/pubsub1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["pubsub", "google", "cli"] name = "pubsub1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-pubsub1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-pubsub1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-pubsub1] path = "../pubsub1" +optional = true +default-features = false diff --git a/gen/pubsub1-cli/src/cmn.rs b/gen/pubsub1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/pubsub1-cli/src/cmn.rs +++ b/gen/pubsub1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/pubsub1-cli/src/main.rs b/gen/pubsub1-cli/src/main.rs index 2b447006a1..08adc012cf 100644 --- a/gen/pubsub1-cli/src/main.rs +++ b/gen/pubsub1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1592,7 +1592,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "pubsub1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/pubsub1/Cargo.toml b/gen/pubsub1/Cargo.toml index d3caeb3eba..82470440a6 100644 --- a/gen/pubsub1/Cargo.toml +++ b/gen/pubsub1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/pubsub1/src/build.rs b/gen/pubsub1/src/build.rs index 53a003ffc0..058ba14e53 100644 --- a/gen/pubsub1/src/build.rs +++ b/gen/pubsub1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-pubsub1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-pubsub1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/pubsub1/src/lib.rs b/gen/pubsub1/src/lib.rs index 81e17b8603..75e1e877a4 100644 --- a/gen/pubsub1/src/lib.rs +++ b/gen/pubsub1/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/pubsub1_beta2-cli/Cargo.toml b/gen/pubsub1_beta2-cli/Cargo.toml index 2c77db37e2..445a33427c 100644 --- a/gen/pubsub1_beta2-cli/Cargo.toml +++ b/gen/pubsub1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["pubsub", "google", "cli"] name = "pubsub1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-pubsub1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-pubsub1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-pubsub1_beta2] path = "../pubsub1_beta2" +optional = true +default-features = false diff --git a/gen/pubsub1_beta2-cli/src/cmn.rs b/gen/pubsub1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/pubsub1_beta2-cli/src/cmn.rs +++ b/gen/pubsub1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/pubsub1_beta2-cli/src/main.rs b/gen/pubsub1_beta2-cli/src/main.rs index 9f6e91e69c..87d5983058 100644 --- a/gen/pubsub1_beta2-cli/src/main.rs +++ b/gen/pubsub1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1593,7 +1593,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "pubsub1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/pubsub1_beta2/Cargo.toml b/gen/pubsub1_beta2/Cargo.toml index 4d5b01dfb7..574a41aaf6 100644 --- a/gen/pubsub1_beta2/Cargo.toml +++ b/gen/pubsub1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/pubsub1_beta2/src/build.rs b/gen/pubsub1_beta2/src/build.rs index eb394345cd..b849024ef4 100644 --- a/gen/pubsub1_beta2/src/build.rs +++ b/gen/pubsub1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-pubsub1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-pubsub1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/pubsub1_beta2/src/lib.rs b/gen/pubsub1_beta2/src/lib.rs index 9f024727e3..9ef2544a32 100644 --- a/gen/pubsub1_beta2/src/lib.rs +++ b/gen/pubsub1_beta2/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/qpxexpress1-cli/Cargo.toml b/gen/qpxexpress1-cli/Cargo.toml index d5ba2c4af6..dfab968187 100644 --- a/gen/qpxexpress1-cli/Cargo.toml +++ b/gen/qpxexpress1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["qpxExpress", "google", "cli"] name = "qpxexpress1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-qpxexpress1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-qpxexpress1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-qpxexpress1] path = "../qpxexpress1" +optional = true +default-features = false diff --git a/gen/qpxexpress1-cli/src/cmn.rs b/gen/qpxexpress1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/qpxexpress1-cli/src/cmn.rs +++ b/gen/qpxexpress1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/qpxexpress1-cli/src/main.rs b/gen/qpxexpress1-cli/src/main.rs index ce070d6a37..98b36f9d2f 100644 --- a/gen/qpxexpress1-cli/src/main.rs +++ b/gen/qpxexpress1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -194,7 +194,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "qpxexpress1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/qpxexpress1/Cargo.toml b/gen/qpxexpress1/Cargo.toml index 2f4128f432..9f1f425128 100644 --- a/gen/qpxexpress1/Cargo.toml +++ b/gen/qpxexpress1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/qpxexpress1/src/build.rs b/gen/qpxexpress1/src/build.rs index e9d23e8e96..ffe680a479 100644 --- a/gen/qpxexpress1/src/build.rs +++ b/gen/qpxexpress1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-qpxexpress1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-qpxexpress1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/qpxexpress1/src/lib.rs b/gen/qpxexpress1/src/lib.rs index 6bd543accc..515a4cb3fd 100644 --- a/gen/qpxexpress1/src/lib.rs +++ b/gen/qpxexpress1/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/replicapool1_beta2-cli/Cargo.toml b/gen/replicapool1_beta2-cli/Cargo.toml index 6b1c189104..7ed26ae8dc 100644 --- a/gen/replicapool1_beta2-cli/Cargo.toml +++ b/gen/replicapool1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["replicapool", "google", "cli"] name = "replicapool1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-replicapool1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-replicapool1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-replicapool1_beta2] path = "../replicapool1_beta2" +optional = true +default-features = false diff --git a/gen/replicapool1_beta2-cli/src/cmn.rs b/gen/replicapool1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/replicapool1_beta2-cli/src/cmn.rs +++ b/gen/replicapool1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/replicapool1_beta2-cli/src/main.rs b/gen/replicapool1_beta2-cli/src/main.rs index 54d4c8fd03..5c9c7c68a9 100644 --- a/gen/replicapool1_beta2-cli/src/main.rs +++ b/gen/replicapool1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1001,7 +1001,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "replicapool1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/replicapool1_beta2/Cargo.toml b/gen/replicapool1_beta2/Cargo.toml index fca5dff7c8..4478492a81 100644 --- a/gen/replicapool1_beta2/Cargo.toml +++ b/gen/replicapool1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/replicapool1_beta2/src/build.rs b/gen/replicapool1_beta2/src/build.rs index d5a179460c..e7602163f2 100644 --- a/gen/replicapool1_beta2/src/build.rs +++ b/gen/replicapool1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-replicapool1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-replicapool1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/replicapool1_beta2/src/lib.rs b/gen/replicapool1_beta2/src/lib.rs index 83dbcbfdb9..534b06a2f8 100644 --- a/gen/replicapool1_beta2/src/lib.rs +++ b/gen/replicapool1_beta2/src/lib.rs @@ -186,6 +186,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/replicapoolupdater1_beta1-cli/Cargo.toml b/gen/replicapoolupdater1_beta1-cli/Cargo.toml index 90c8ab2b8f..95c4b66a44 100644 --- a/gen/replicapoolupdater1_beta1-cli/Cargo.toml +++ b/gen/replicapoolupdater1_beta1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["replicapoolupdater", "google", "cli"] name = "replicapoolupdater1-beta1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-replicapoolupdater1_beta1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-replicapoolupdater1_beta1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-replicapoolupdater1_beta1] path = "../replicapoolupdater1_beta1" +optional = true +default-features = false diff --git a/gen/replicapoolupdater1_beta1-cli/src/cmn.rs b/gen/replicapoolupdater1_beta1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/cmn.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/replicapoolupdater1_beta1-cli/src/main.rs b/gen/replicapoolupdater1_beta1-cli/src/main.rs index 3d06c9fb40..b3bdd8c816 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/main.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -739,7 +739,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "replicapoolupdater1-beta1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/replicapoolupdater1_beta1/Cargo.toml b/gen/replicapoolupdater1_beta1/Cargo.toml index d773711ffc..19a3f3446f 100644 --- a/gen/replicapoolupdater1_beta1/Cargo.toml +++ b/gen/replicapoolupdater1_beta1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/replicapoolupdater1_beta1/src/build.rs b/gen/replicapoolupdater1_beta1/src/build.rs index ed49c17064..2a6b15d274 100644 --- a/gen/replicapoolupdater1_beta1/src/build.rs +++ b/gen/replicapoolupdater1_beta1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-replicapoolupdater1_beta1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-replicapoolupdater1_beta1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs b/gen/replicapoolupdater1_beta1/src/lib.rs index 34d274e819..1b276178eb 100644 --- a/gen/replicapoolupdater1_beta1/src/lib.rs +++ b/gen/replicapoolupdater1_beta1/src/lib.rs @@ -184,6 +184,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/reseller1_sandbox-cli/Cargo.toml b/gen/reseller1_sandbox-cli/Cargo.toml index ea9cb632fa..2f5c6b952e 100644 --- a/gen/reseller1_sandbox-cli/Cargo.toml +++ b/gen/reseller1_sandbox-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["reseller", "google", "cli"] name = "reseller1-sandbox" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-reseller1_sandbox/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-reseller1_sandbox/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-reseller1_sandbox] path = "../reseller1_sandbox" +optional = true +default-features = false diff --git a/gen/reseller1_sandbox-cli/src/cmn.rs b/gen/reseller1_sandbox-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/reseller1_sandbox-cli/src/cmn.rs +++ b/gen/reseller1_sandbox-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/reseller1_sandbox-cli/src/main.rs b/gen/reseller1_sandbox-cli/src/main.rs index 30954fe028..56592345e1 100644 --- a/gen/reseller1_sandbox-cli/src/main.rs +++ b/gen/reseller1_sandbox-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1209,7 +1209,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "reseller1-sandbox", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/reseller1_sandbox/Cargo.toml b/gen/reseller1_sandbox/Cargo.toml index 191acf79c0..d67bc5a3f3 100644 --- a/gen/reseller1_sandbox/Cargo.toml +++ b/gen/reseller1_sandbox/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/reseller1_sandbox/src/build.rs b/gen/reseller1_sandbox/src/build.rs index 4618188b3c..cc1568de7b 100644 --- a/gen/reseller1_sandbox/src/build.rs +++ b/gen/reseller1_sandbox/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-reseller1_sandbox", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-reseller1_sandbox", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/reseller1_sandbox/src/lib.rs b/gen/reseller1_sandbox/src/lib.rs index f912a8600c..af05cae2f0 100644 --- a/gen/reseller1_sandbox/src/lib.rs +++ b/gen/reseller1_sandbox/src/lib.rs @@ -188,6 +188,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/resourceviews1_beta2-cli/Cargo.toml b/gen/resourceviews1_beta2-cli/Cargo.toml index 039ea08f05..e91ee3a4b2 100644 --- a/gen/resourceviews1_beta2-cli/Cargo.toml +++ b/gen/resourceviews1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["resourceviews", "google", "cli"] name = "resourceviews1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-resourceviews1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-resourceviews1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-resourceviews1_beta2] path = "../resourceviews1_beta2" +optional = true +default-features = false diff --git a/gen/resourceviews1_beta2-cli/src/cmn.rs b/gen/resourceviews1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/resourceviews1_beta2-cli/src/cmn.rs +++ b/gen/resourceviews1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/resourceviews1_beta2-cli/src/main.rs b/gen/resourceviews1_beta2-cli/src/main.rs index dfbe35e818..e71b95aea7 100644 --- a/gen/resourceviews1_beta2-cli/src/main.rs +++ b/gen/resourceviews1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -892,7 +892,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "resourceviews1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/resourceviews1_beta2/Cargo.toml b/gen/resourceviews1_beta2/Cargo.toml index 776baaa96e..0344dccabd 100644 --- a/gen/resourceviews1_beta2/Cargo.toml +++ b/gen/resourceviews1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/resourceviews1_beta2/src/build.rs b/gen/resourceviews1_beta2/src/build.rs index 4eaf30fa6d..e2e7bd42e7 100644 --- a/gen/resourceviews1_beta2/src/build.rs +++ b/gen/resourceviews1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-resourceviews1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-resourceviews1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/resourceviews1_beta2/src/lib.rs b/gen/resourceviews1_beta2/src/lib.rs index 6774f9f0a5..7957009c0c 100644 --- a/gen/resourceviews1_beta2/src/lib.rs +++ b/gen/resourceviews1_beta2/src/lib.rs @@ -185,6 +185,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/script1-cli/Cargo.toml b/gen/script1-cli/Cargo.toml index 49e6142993..c07c958b33 100644 --- a/gen/script1-cli/Cargo.toml +++ b/gen/script1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["script", "google", "cli"] name = "script1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-script1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-script1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-script1] path = "../script1" +optional = true +default-features = false diff --git a/gen/script1-cli/src/cmn.rs b/gen/script1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/script1-cli/src/cmn.rs +++ b/gen/script1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/script1-cli/src/main.rs b/gen/script1-cli/src/main.rs index 9ae1826f66..d62135b08a 100644 --- a/gen/script1-cli/src/main.rs +++ b/gen/script1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -190,7 +190,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "script1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/script1/Cargo.toml b/gen/script1/Cargo.toml index 26bfcd76d8..0a4727398f 100644 --- a/gen/script1/Cargo.toml +++ b/gen/script1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/script1/src/build.rs b/gen/script1/src/build.rs index dea7368edf..3c6ebd2d7c 100644 --- a/gen/script1/src/build.rs +++ b/gen/script1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-script1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-script1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/script1/src/lib.rs b/gen/script1/src/lib.rs index 9b51981279..28cbfa891e 100644 --- a/gen/script1/src/lib.rs +++ b/gen/script1/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/serviceregistryalpha-cli/Cargo.toml b/gen/serviceregistryalpha-cli/Cargo.toml index fcaf4fd05a..51f35c11d7 100644 --- a/gen/serviceregistryalpha-cli/Cargo.toml +++ b/gen/serviceregistryalpha-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["serviceregistry", "google", "cli"] name = "serviceregistryalpha" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-serviceregistryalpha/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-serviceregistryalpha/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-serviceregistryalpha] path = "../serviceregistryalpha" +optional = true +default-features = false diff --git a/gen/serviceregistryalpha-cli/src/cmn.rs b/gen/serviceregistryalpha-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/serviceregistryalpha-cli/src/cmn.rs +++ b/gen/serviceregistryalpha-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/serviceregistryalpha-cli/src/main.rs b/gen/serviceregistryalpha-cli/src/main.rs index 1e0c48da7e..eebc23694c 100644 --- a/gen/serviceregistryalpha-cli/src/main.rs +++ b/gen/serviceregistryalpha-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -700,7 +700,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "serviceregistryalpha", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/serviceregistryalpha/Cargo.toml b/gen/serviceregistryalpha/Cargo.toml index 19a7cf277b..457e5308d5 100644 --- a/gen/serviceregistryalpha/Cargo.toml +++ b/gen/serviceregistryalpha/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/serviceregistryalpha/src/build.rs b/gen/serviceregistryalpha/src/build.rs index eae48c100d..3e8a8a963e 100644 --- a/gen/serviceregistryalpha/src/build.rs +++ b/gen/serviceregistryalpha/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-serviceregistryalpha", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-serviceregistryalpha", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/serviceregistryalpha/src/lib.rs b/gen/serviceregistryalpha/src/lib.rs index ad96e2140a..9f6b60247e 100644 --- a/gen/serviceregistryalpha/src/lib.rs +++ b/gen/serviceregistryalpha/src/lib.rs @@ -183,6 +183,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/siteverification1-cli/Cargo.toml b/gen/siteverification1-cli/Cargo.toml index 109aa5d27b..f2a48e112f 100644 --- a/gen/siteverification1-cli/Cargo.toml +++ b/gen/siteverification1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["siteVerification", "google", "cli"] name = "siteverification1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-siteverification1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-siteverification1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-siteverification1] path = "../siteverification1" +optional = true +default-features = false diff --git a/gen/siteverification1-cli/src/cmn.rs b/gen/siteverification1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/siteverification1-cli/src/cmn.rs +++ b/gen/siteverification1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/siteverification1-cli/src/main.rs b/gen/siteverification1-cli/src/main.rs index 34699a183f..8553ff0b56 100644 --- a/gen/siteverification1-cli/src/main.rs +++ b/gen/siteverification1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -620,7 +620,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "siteverification1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/siteverification1/Cargo.toml b/gen/siteverification1/Cargo.toml index 1ad7789bf9..bd9245ef01 100644 --- a/gen/siteverification1/Cargo.toml +++ b/gen/siteverification1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/siteverification1/src/build.rs b/gen/siteverification1/src/build.rs index 393ae40006..c87100c840 100644 --- a/gen/siteverification1/src/build.rs +++ b/gen/siteverification1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-siteverification1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-siteverification1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/siteverification1/src/lib.rs b/gen/siteverification1/src/lib.rs index 6569e207e9..eb382d3877 100644 --- a/gen/siteverification1/src/lib.rs +++ b/gen/siteverification1/src/lib.rs @@ -181,6 +181,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/spectrum1_explorer-cli/Cargo.toml b/gen/spectrum1_explorer-cli/Cargo.toml index 3ce09b3999..967485bc3f 100644 --- a/gen/spectrum1_explorer-cli/Cargo.toml +++ b/gen/spectrum1_explorer-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["spectrum", "google", "cli"] name = "spectrum1-explorer" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-spectrum1_explorer/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-spectrum1_explorer/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-spectrum1_explorer] path = "../spectrum1_explorer" +optional = true +default-features = false diff --git a/gen/spectrum1_explorer-cli/src/cmn.rs b/gen/spectrum1_explorer-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/spectrum1_explorer-cli/src/cmn.rs +++ b/gen/spectrum1_explorer-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/spectrum1_explorer-cli/src/main.rs b/gen/spectrum1_explorer-cli/src/main.rs index 43dbb2d629..e3b0ccb35b 100644 --- a/gen/spectrum1_explorer-cli/src/main.rs +++ b/gen/spectrum1_explorer-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -781,7 +781,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "spectrum1-explorer", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/spectrum1_explorer/Cargo.toml b/gen/spectrum1_explorer/Cargo.toml index 4de51cdeca..a4832f5a4a 100644 --- a/gen/spectrum1_explorer/Cargo.toml +++ b/gen/spectrum1_explorer/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/spectrum1_explorer/src/build.rs b/gen/spectrum1_explorer/src/build.rs index 39fc592e11..1dd86a9180 100644 --- a/gen/spectrum1_explorer/src/build.rs +++ b/gen/spectrum1_explorer/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-spectrum1_explorer", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-spectrum1_explorer", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/spectrum1_explorer/src/lib.rs b/gen/spectrum1_explorer/src/lib.rs index a4668f681f..bad131a4ed 100644 --- a/gen/spectrum1_explorer/src/lib.rs +++ b/gen/spectrum1_explorer/src/lib.rs @@ -178,6 +178,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/sqladmin1_beta4-cli/Cargo.toml b/gen/sqladmin1_beta4-cli/Cargo.toml index 54da418642..d602f218c0 100644 --- a/gen/sqladmin1_beta4-cli/Cargo.toml +++ b/gen/sqladmin1_beta4-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["sqladmin", "google", "cli"] name = "sqladmin1-beta4" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-sqladmin1_beta4/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-sqladmin1_beta4/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-sqladmin1_beta4] path = "../sqladmin1_beta4" +optional = true +default-features = false diff --git a/gen/sqladmin1_beta4-cli/src/cmn.rs b/gen/sqladmin1_beta4-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/sqladmin1_beta4-cli/src/cmn.rs +++ b/gen/sqladmin1_beta4-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/sqladmin1_beta4-cli/src/main.rs b/gen/sqladmin1_beta4-cli/src/main.rs index 153966f9a9..bed8a676be 100644 --- a/gen/sqladmin1_beta4-cli/src/main.rs +++ b/gen/sqladmin1_beta4-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3011,7 +3011,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "sqladmin1-beta4", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/sqladmin1_beta4/Cargo.toml b/gen/sqladmin1_beta4/Cargo.toml index c52f2b83b5..7f3f5cffd9 100644 --- a/gen/sqladmin1_beta4/Cargo.toml +++ b/gen/sqladmin1_beta4/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/sqladmin1_beta4/src/build.rs b/gen/sqladmin1_beta4/src/build.rs index 8f6c568064..18e356a58c 100644 --- a/gen/sqladmin1_beta4/src/build.rs +++ b/gen/sqladmin1_beta4/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-sqladmin1_beta4", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-sqladmin1_beta4", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/sqladmin1_beta4/src/lib.rs b/gen/sqladmin1_beta4/src/lib.rs index cce46d3cfc..86da5c67e6 100644 --- a/gen/sqladmin1_beta4/src/lib.rs +++ b/gen/sqladmin1_beta4/src/lib.rs @@ -216,6 +216,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/storage1-cli/Cargo.toml b/gen/storage1-cli/Cargo.toml index 75a51bfba8..7a7cc2d548 100644 --- a/gen/storage1-cli/Cargo.toml +++ b/gen/storage1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["storage", "google", "cli"] name = "storage1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-storage1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-storage1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-storage1] path = "../storage1" +optional = true +default-features = false diff --git a/gen/storage1-cli/src/cmn.rs b/gen/storage1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/storage1-cli/src/cmn.rs +++ b/gen/storage1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/storage1-cli/src/main.rs b/gen/storage1-cli/src/main.rs index b732179bae..84665f895e 100644 --- a/gen/storage1-cli/src/main.rs +++ b/gen/storage1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3385,7 +3385,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "storage1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/storage1/Cargo.toml b/gen/storage1/Cargo.toml index 4fd06b1d25..03a0b1b549 100644 --- a/gen/storage1/Cargo.toml +++ b/gen/storage1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/storage1/src/build.rs b/gen/storage1/src/build.rs index ef9cfc2428..8852ee03bd 100644 --- a/gen/storage1/src/build.rs +++ b/gen/storage1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-storage1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-storage1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/storage1/src/lib.rs b/gen/storage1/src/lib.rs index 3029d3502f..a55206ec62 100644 --- a/gen/storage1/src/lib.rs +++ b/gen/storage1/src/lib.rs @@ -227,6 +227,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/storagetransfer1-cli/Cargo.toml b/gen/storagetransfer1-cli/Cargo.toml index f2bb1a23f2..a7509d8db3 100644 --- a/gen/storagetransfer1-cli/Cargo.toml +++ b/gen/storagetransfer1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["storagetransfer", "google", "cli"] name = "storagetransfer1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-storagetransfer1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-storagetransfer1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-storagetransfer1] path = "../storagetransfer1" +optional = true +default-features = false diff --git a/gen/storagetransfer1-cli/src/cmn.rs b/gen/storagetransfer1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/storagetransfer1-cli/src/cmn.rs +++ b/gen/storagetransfer1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/storagetransfer1-cli/src/main.rs b/gen/storagetransfer1-cli/src/main.rs index abebff6e3c..572366ce7f 100644 --- a/gen/storagetransfer1-cli/src/main.rs +++ b/gen/storagetransfer1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1002,7 +1002,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "storagetransfer1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/storagetransfer1/Cargo.toml b/gen/storagetransfer1/Cargo.toml index 275da3cb37..ca7eddd021 100644 --- a/gen/storagetransfer1/Cargo.toml +++ b/gen/storagetransfer1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/storagetransfer1/src/build.rs b/gen/storagetransfer1/src/build.rs index 6f04d187e1..c45c353791 100644 --- a/gen/storagetransfer1/src/build.rs +++ b/gen/storagetransfer1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-storagetransfer1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-storagetransfer1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/storagetransfer1/src/lib.rs b/gen/storagetransfer1/src/lib.rs index 292c28c5df..836f360520 100644 --- a/gen/storagetransfer1/src/lib.rs +++ b/gen/storagetransfer1/src/lib.rs @@ -187,6 +187,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/tagmanager1-cli/Cargo.toml b/gen/tagmanager1-cli/Cargo.toml index 5436400a78..c00acab0d3 100644 --- a/gen/tagmanager1-cli/Cargo.toml +++ b/gen/tagmanager1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["tagmanager", "google", "cli"] name = "tagmanager1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-tagmanager1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-tagmanager1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-tagmanager1] path = "../tagmanager1" +optional = true +default-features = false diff --git a/gen/tagmanager1-cli/src/cmn.rs b/gen/tagmanager1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/tagmanager1-cli/src/cmn.rs +++ b/gen/tagmanager1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/tagmanager1-cli/src/main.rs b/gen/tagmanager1-cli/src/main.rs index a021ada31d..41a975f058 100644 --- a/gen/tagmanager1-cli/src/main.rs +++ b/gen/tagmanager1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -3723,7 +3723,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "tagmanager1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/tagmanager1/Cargo.toml b/gen/tagmanager1/Cargo.toml index fecde00349..21e076cf53 100644 --- a/gen/tagmanager1/Cargo.toml +++ b/gen/tagmanager1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/tagmanager1/src/build.rs b/gen/tagmanager1/src/build.rs index dfa567c207..059419c056 100644 --- a/gen/tagmanager1/src/build.rs +++ b/gen/tagmanager1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-tagmanager1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-tagmanager1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/tagmanager1/src/lib.rs b/gen/tagmanager1/src/lib.rs index 0f187f8612..ca6b703ca9 100644 --- a/gen/tagmanager1/src/lib.rs +++ b/gen/tagmanager1/src/lib.rs @@ -230,6 +230,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/taskqueue1_beta2-cli/Cargo.toml b/gen/taskqueue1_beta2-cli/Cargo.toml index bafd6f440e..7441ce3b47 100644 --- a/gen/taskqueue1_beta2-cli/Cargo.toml +++ b/gen/taskqueue1_beta2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["taskqueue", "google", "cli"] name = "taskqueue1-beta2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-taskqueue1_beta2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-taskqueue1_beta2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-taskqueue1_beta2] path = "../taskqueue1_beta2" +optional = true +default-features = false diff --git a/gen/taskqueue1_beta2-cli/src/cmn.rs b/gen/taskqueue1_beta2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/taskqueue1_beta2-cli/src/cmn.rs +++ b/gen/taskqueue1_beta2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/taskqueue1_beta2-cli/src/main.rs b/gen/taskqueue1_beta2-cli/src/main.rs index e4e24f849b..0b04ac9510 100644 --- a/gen/taskqueue1_beta2-cli/src/main.rs +++ b/gen/taskqueue1_beta2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -675,7 +675,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "taskqueue1-beta2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/taskqueue1_beta2/Cargo.toml b/gen/taskqueue1_beta2/Cargo.toml index 75f34bae4f..dca594544e 100644 --- a/gen/taskqueue1_beta2/Cargo.toml +++ b/gen/taskqueue1_beta2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/taskqueue1_beta2/src/build.rs b/gen/taskqueue1_beta2/src/build.rs index d3fdda0944..6bf9018b70 100644 --- a/gen/taskqueue1_beta2/src/build.rs +++ b/gen/taskqueue1_beta2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-taskqueue1_beta2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-taskqueue1_beta2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/taskqueue1_beta2/src/lib.rs b/gen/taskqueue1_beta2/src/lib.rs index 7ee28e38bb..8b6749de70 100644 --- a/gen/taskqueue1_beta2/src/lib.rs +++ b/gen/taskqueue1_beta2/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/tasks1-cli/Cargo.toml b/gen/tasks1-cli/Cargo.toml index b7f0f37265..35d2180cf1 100644 --- a/gen/tasks1-cli/Cargo.toml +++ b/gen/tasks1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["tasks", "google", "cli"] name = "tasks1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-tasks1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-tasks1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-tasks1] path = "../tasks1" +optional = true +default-features = false diff --git a/gen/tasks1-cli/src/cmn.rs b/gen/tasks1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/tasks1-cli/src/cmn.rs +++ b/gen/tasks1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/tasks1-cli/src/main.rs b/gen/tasks1-cli/src/main.rs index 2fcf76dbd2..bcd492b7e4 100644 --- a/gen/tasks1-cli/src/main.rs +++ b/gen/tasks1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1158,7 +1158,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "tasks1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/tasks1/Cargo.toml b/gen/tasks1/Cargo.toml index bcb292e8d8..d5d5cb4f01 100644 --- a/gen/tasks1/Cargo.toml +++ b/gen/tasks1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/tasks1/src/build.rs b/gen/tasks1/src/build.rs index cc274beb01..2863d540eb 100644 --- a/gen/tasks1/src/build.rs +++ b/gen/tasks1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-tasks1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-tasks1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/tasks1/src/lib.rs b/gen/tasks1/src/lib.rs index a26b05161e..1266ae06f0 100644 --- a/gen/tasks1/src/lib.rs +++ b/gen/tasks1/src/lib.rs @@ -191,6 +191,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/toolresults1_beta3-cli/Cargo.toml b/gen/toolresults1_beta3-cli/Cargo.toml index 35d0711cc5..c8941ab38e 100644 --- a/gen/toolresults1_beta3-cli/Cargo.toml +++ b/gen/toolresults1_beta3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["toolresults", "google", "cli"] name = "toolresults1-beta3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-toolresults1_beta3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-toolresults1_beta3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-toolresults1_beta3] path = "../toolresults1_beta3" +optional = true +default-features = false diff --git a/gen/toolresults1_beta3-cli/src/cmn.rs b/gen/toolresults1_beta3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/toolresults1_beta3-cli/src/cmn.rs +++ b/gen/toolresults1_beta3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/toolresults1_beta3-cli/src/main.rs b/gen/toolresults1_beta3-cli/src/main.rs index 37133caa56..be7665f2a1 100644 --- a/gen/toolresults1_beta3-cli/src/main.rs +++ b/gen/toolresults1_beta3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -1271,7 +1271,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "toolresults1-beta3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/toolresults1_beta3/Cargo.toml b/gen/toolresults1_beta3/Cargo.toml index c5e61e05f9..70ccd81b75 100644 --- a/gen/toolresults1_beta3/Cargo.toml +++ b/gen/toolresults1_beta3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/toolresults1_beta3/src/build.rs b/gen/toolresults1_beta3/src/build.rs index 0286b9ea56..0d27bef4fa 100644 --- a/gen/toolresults1_beta3/src/build.rs +++ b/gen/toolresults1_beta3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-toolresults1_beta3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-toolresults1_beta3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/toolresults1_beta3/src/lib.rs b/gen/toolresults1_beta3/src/lib.rs index 8866ccb0ec..0b32973ff8 100644 --- a/gen/toolresults1_beta3/src/lib.rs +++ b/gen/toolresults1_beta3/src/lib.rs @@ -182,6 +182,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/translate2-cli/Cargo.toml b/gen/translate2-cli/Cargo.toml index 03d567898b..4201c55584 100644 --- a/gen/translate2-cli/Cargo.toml +++ b/gen/translate2-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["translate", "google", "cli"] name = "translate2" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-translate2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-translate2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-translate2] path = "../translate2" +optional = true +default-features = false diff --git a/gen/translate2-cli/src/cmn.rs b/gen/translate2-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/translate2-cli/src/cmn.rs +++ b/gen/translate2-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/translate2-cli/src/main.rs b/gen/translate2-cli/src/main.rs index 3b03438037..8b4fff1517 100644 --- a/gen/translate2-cli/src/main.rs +++ b/gen/translate2-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -286,7 +286,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "translate2", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/translate2/Cargo.toml b/gen/translate2/Cargo.toml index 91137004bc..18032b9fb3 100644 --- a/gen/translate2/Cargo.toml +++ b/gen/translate2/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/translate2/src/build.rs b/gen/translate2/src/build.rs index 92a5275dd1..7045aac196 100644 --- a/gen/translate2/src/build.rs +++ b/gen/translate2/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-translate2", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-translate2", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/translate2/src/lib.rs b/gen/translate2/src/lib.rs index abf8c87532..f3f77795fe 100644 --- a/gen/translate2/src/lib.rs +++ b/gen/translate2/src/lib.rs @@ -176,6 +176,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/urlshortener1-cli/Cargo.toml b/gen/urlshortener1-cli/Cargo.toml index 92c2e57982..130a0f831b 100644 --- a/gen/urlshortener1-cli/Cargo.toml +++ b/gen/urlshortener1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["urlshortener", "google", "cli"] name = "urlshortener1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-urlshortener1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-urlshortener1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-urlshortener1] path = "../urlshortener1" +optional = true +default-features = false diff --git a/gen/urlshortener1-cli/src/cmn.rs b/gen/urlshortener1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/urlshortener1-cli/src/cmn.rs +++ b/gen/urlshortener1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/urlshortener1-cli/src/main.rs b/gen/urlshortener1-cli/src/main.rs index e56139fed0..f067b3f25c 100644 --- a/gen/urlshortener1-cli/src/main.rs +++ b/gen/urlshortener1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -323,7 +323,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "urlshortener1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/urlshortener1/Cargo.toml b/gen/urlshortener1/Cargo.toml index 41be31ea3f..80273a1e00 100644 --- a/gen/urlshortener1/Cargo.toml +++ b/gen/urlshortener1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/urlshortener1/src/build.rs b/gen/urlshortener1/src/build.rs index 41ca4162b5..46c7816e44 100644 --- a/gen/urlshortener1/src/build.rs +++ b/gen/urlshortener1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-urlshortener1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-urlshortener1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/urlshortener1/src/lib.rs b/gen/urlshortener1/src/lib.rs index 2c1dd83be1..77c22b670c 100644 --- a/gen/urlshortener1/src/lib.rs +++ b/gen/urlshortener1/src/lib.rs @@ -174,6 +174,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/webfonts1-cli/Cargo.toml b/gen/webfonts1-cli/Cargo.toml index 887c50e2a8..7df8402320 100644 --- a/gen/webfonts1-cli/Cargo.toml +++ b/gen/webfonts1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["webfonts", "google", "cli"] name = "webfonts1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-webfonts1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-webfonts1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-webfonts1] path = "../webfonts1" +optional = true +default-features = false diff --git a/gen/webfonts1-cli/src/cmn.rs b/gen/webfonts1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/webfonts1-cli/src/cmn.rs +++ b/gen/webfonts1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/webfonts1-cli/src/main.rs b/gen/webfonts1-cli/src/main.rs index b6efd91bd7..b7203d18bd 100644 --- a/gen/webfonts1-cli/src/main.rs +++ b/gen/webfonts1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -156,7 +156,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "webfonts1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/webfonts1/Cargo.toml b/gen/webfonts1/Cargo.toml index 0a109d66a9..3d1b78ed59 100644 --- a/gen/webfonts1/Cargo.toml +++ b/gen/webfonts1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/webfonts1/src/build.rs b/gen/webfonts1/src/build.rs index 52932e12c0..b330293d32 100644 --- a/gen/webfonts1/src/build.rs +++ b/gen/webfonts1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-webfonts1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-webfonts1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/webfonts1/src/lib.rs b/gen/webfonts1/src/lib.rs index db37509dac..b796664839 100644 --- a/gen/webfonts1/src/lib.rs +++ b/gen/webfonts1/src/lib.rs @@ -173,6 +173,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/webmasters3-cli/Cargo.toml b/gen/webmasters3-cli/Cargo.toml index d41a2a2897..dd0bcf0990 100644 --- a/gen/webmasters3-cli/Cargo.toml +++ b/gen/webmasters3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["webmasters", "google", "cli"] name = "webmasters3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-webmasters3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-webmasters3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-webmasters3] path = "../webmasters3" +optional = true +default-features = false diff --git a/gen/webmasters3-cli/src/cmn.rs b/gen/webmasters3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/webmasters3-cli/src/cmn.rs +++ b/gen/webmasters3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/webmasters3-cli/src/main.rs b/gen/webmasters3-cli/src/main.rs index 128f697b8e..d6dde6d868 100644 --- a/gen/webmasters3-cli/src/main.rs +++ b/gen/webmasters3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -860,7 +860,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "webmasters3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/webmasters3/Cargo.toml b/gen/webmasters3/Cargo.toml index 06d910bc99..0fa665c341 100644 --- a/gen/webmasters3/Cargo.toml +++ b/gen/webmasters3/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/webmasters3/src/build.rs b/gen/webmasters3/src/build.rs index 1f951293cf..09e9893639 100644 --- a/gen/webmasters3/src/build.rs +++ b/gen/webmasters3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-webmasters3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-webmasters3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/webmasters3/src/lib.rs b/gen/webmasters3/src/lib.rs index 595be2ef47..d409fdcffc 100644 --- a/gen/webmasters3/src/lib.rs +++ b/gen/webmasters3/src/lib.rs @@ -180,6 +180,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/youtube3-cli/Cargo.toml b/gen/youtube3-cli/Cargo.toml index 09589c277c..80f55a0c5a 100644 --- a/gen/youtube3-cli/Cargo.toml +++ b/gen/youtube3-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["youtube", "google", "cli"] name = "youtube3" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-youtube3/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-youtube3/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-youtube3] path = "../youtube3" +optional = true +default-features = false diff --git a/gen/youtube3-cli/src/cmn.rs b/gen/youtube3-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/youtube3-cli/src/cmn.rs +++ b/gen/youtube3-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/youtube3-cli/src/main.rs b/gen/youtube3-cli/src/main.rs index 27263e8cb2..52145de7a4 100644 --- a/gen/youtube3-cli/src/main.rs +++ b/gen/youtube3-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -6629,7 +6629,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "youtube3", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/youtube3/cargo.toml b/gen/youtube3/cargo.toml index c2026691b6..be81be2074 100644 --- a/gen/youtube3/cargo.toml +++ b/gen/youtube3/cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/youtube3/src/build.rs b/gen/youtube3/src/build.rs index b842d9ee05..d7e2a671d9 100644 --- a/gen/youtube3/src/build.rs +++ b/gen/youtube3/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-youtube3", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-youtube3", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index 785e6947df..39a5992f99 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -255,6 +255,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/youtubeanalytics1-cli/Cargo.toml b/gen/youtubeanalytics1-cli/Cargo.toml index 0f7d786169..ececef975e 100644 --- a/gen/youtubeanalytics1-cli/Cargo.toml +++ b/gen/youtubeanalytics1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["youtubeAnalytics", "google", "cli"] name = "youtubeanalytics1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-youtubeanalytics1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-youtubeanalytics1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-youtubeanalytics1] path = "../youtubeanalytics1" +optional = true +default-features = false diff --git a/gen/youtubeanalytics1-cli/src/cmn.rs b/gen/youtubeanalytics1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/youtubeanalytics1-cli/src/cmn.rs +++ b/gen/youtubeanalytics1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/youtubeanalytics1-cli/src/main.rs b/gen/youtubeanalytics1-cli/src/main.rs index a84c7a6d73..dafe6999f3 100644 --- a/gen/youtubeanalytics1-cli/src/main.rs +++ b/gen/youtubeanalytics1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -838,7 +838,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "youtubeanalytics1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/youtubeanalytics1/Cargo.toml b/gen/youtubeanalytics1/Cargo.toml index 1898985b38..bd74a1bee8 100644 --- a/gen/youtubeanalytics1/Cargo.toml +++ b/gen/youtubeanalytics1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/youtubeanalytics1/src/build.rs b/gen/youtubeanalytics1/src/build.rs index e250dbab65..ce2e145560 100644 --- a/gen/youtubeanalytics1/src/build.rs +++ b/gen/youtubeanalytics1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-youtubeanalytics1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-youtubeanalytics1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/youtubeanalytics1/src/lib.rs b/gen/youtubeanalytics1/src/lib.rs index b20df3e9d1..22e38580ad 100644 --- a/gen/youtubeanalytics1/src/lib.rs +++ b/gen/youtubeanalytics1/src/lib.rs @@ -187,6 +187,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/youtubereporting1-cli/Cargo.toml b/gen/youtubereporting1-cli/Cargo.toml index ab93d890ed..38d049020c 100644 --- a/gen/youtubereporting1-cli/Cargo.toml +++ b/gen/youtubereporting1-cli/Cargo.toml @@ -17,19 +17,27 @@ keywords = ["youtubereporting", "google", "cli"] name = "youtubereporting1" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -strsim = "0.4" -yup-hyper-mock = "1.0" -clap = "2.0" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +strsim = "^0.4" +yup-hyper-mock = "^1.0" +clap = "^2.0" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly","google-youtubereporting1/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex","google-youtubereporting1/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } [dependencies.google-youtubereporting1] path = "../youtubereporting1" +optional = true +default-features = false diff --git a/gen/youtubereporting1-cli/src/cmn.rs b/gen/youtubereporting1-cli/src/cmn.rs index ae86fdef65..779c1dc086 100644 --- a/gen/youtubereporting1-cli/src/cmn.rs +++ b/gen/youtubereporting1-cli/src/cmn.rs @@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O match fs::File::open(file_path) { Ok(f) => Some(f), Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); None } } @@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage { Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), - _ => Err(json::Error::IoError(err)) + _ => Err(json::Error::Io(err)) }, Ok(_) => Ok(()), } @@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage { Err(serde_err) => Err(serde_err), } }, - Err(io_err) => Err(json::Error::IoError(io_err)) + Err(io_err) => Err(json::Error::Io(io_err)) } } } @@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage { Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(json::Error::IoError(io_err)) + _ => Err(json::Error::Io(io_err)) } } } @@ -477,7 +477,7 @@ pub enum ConfigurationError { DirectoryUnset, HomeExpansionFailed(String), Secret(ApplicationSecretError), - IOError((String, io::Error)), + Io((String, io::Error)), } impl fmt::Display for ConfigurationError { @@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError { => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) + ConfigurationError::Io((ref path, ref err)) => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), } } @@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError { #[derive(Debug)] pub enum InputError { - IOError((String, io::Error)), + Io((String, io::Error)), Mime(String), } impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::IOError((ref file_path, ref io_err)) + InputError::Io((ref file_path, ref io_err)) => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), @@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str, let secret_path = Path::new(dir).join(secret_basename); let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( + Err(CLIError::Configuration(ConfigurationError::Io( (secret_str(), io_err) ))) }; @@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str, = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { Err(serde_err) => match serde_err { - json::Error::IoError(err) => err, + json::Error::Io(err) => err, _ => panic!("Unexpected serde error: {:#?}", serde_err) }, Ok(_) => continue, @@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str, }, Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::Io(err)) => return secret_io_error(err), Err(json_err) => return Err(CLIError::Configuration( diff --git a/gen/youtubereporting1-cli/src/main.rs b/gen/youtubereporting1-cli/src/main.rs index 737b6de669..ea95f8a738 100644 --- a/gen/youtubereporting1-cli/src/main.rs +++ b/gen/youtubereporting1-cli/src/main.rs @@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_ use std::default::Default; use std::str::FromStr; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; use serde_json as json; use clap::ArgMatches; @@ -663,7 +663,7 @@ impl<'n> Engine<'n> { JsonTokenStorage { program_name: "youtubereporting1", db_dir: config_dir.clone(), - }, None); + }, Some(FlowType::InstalledInteractive)); let client = if opt.is_present("debug") { diff --git a/gen/youtubereporting1/Cargo.toml b/gen/youtubereporting1/Cargo.toml index 51665819d3..ebfe56ab3b 100644 --- a/gen/youtubereporting1/Cargo.toml +++ b/gen/youtubereporting1/Cargo.toml @@ -16,14 +16,20 @@ build = "src/build.rs" [dependencies] -hyper = "0.8" -mime = "0.2.0" -serde = "0.6.0" -serde_json = "0.6.0" -yup-oauth2 = ">= 0.5.6" -url = ">= 0.5" +hyper = "^ 0.9" +mime = "^ 0.2.0" +serde = "^ 0.7.5" +serde_json = "^ 0.7.0" +yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false } +serde_macros = { version = "0.7.5", optional = true } +url = "= 0.5" + +[features] +default = ["with-syntex"] +nightly = ["serde_macros","yup-oauth2/nightly"] +with-syntex = ["serde_codegen","syntex","yup-oauth2/with-syntex"] [build-dependencies] -syntex = { version = "= 0.28" } -serde_codegen = { version = "= 0.6.13" } +syntex = { version = "= 0.32", optional = true } +serde_codegen = { version = "= 0.7.5", optional = true } diff --git a/gen/youtubereporting1/src/build.rs b/gen/youtubereporting1/src/build.rs index 4eb97c6a04..d033ea1836 100644 --- a/gen/youtubereporting1/src/build.rs +++ b/gen/youtubereporting1/src/build.rs @@ -1,16 +1,28 @@ -extern crate syntex; -extern crate serde_codegen; +#[cfg(feature = "with-syntex")] +mod inner { + extern crate syntex; + extern crate serde_codegen; -use std::env; -use std::path::Path; + use std::env; + use std::path::Path; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-youtubereporting1", &src, &dst).unwrap(); + } +} + +#[cfg(not(feature = "with-syntex"))] +mod inner { + pub fn main() {} +} pub fn main() { - let out_dir = env::var_os("OUT_DIR").unwrap(); - - let src = Path::new("src/lib.rs.in"); - let dst = Path::new(&out_dir).join("lib.rs"); - - let mut registry = syntex::Registry::new(); - serde_codegen::register(&mut registry); - registry.expand("google-youtubereporting1", &src, &dst).unwrap(); -} + inner::main() +} \ No newline at end of file diff --git a/gen/youtubereporting1/src/lib.rs b/gen/youtubereporting1/src/lib.rs index 09c05ccd24..607bfb0ce8 100644 --- a/gen/youtubereporting1/src/lib.rs +++ b/gen/youtubereporting1/src/lib.rs @@ -191,6 +191,12 @@ // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . +#![cfg_attr(feature = "nightly", feature(custom_derive, custom_attribute, plugin))] +#![cfg_attr(feature = "nightly", plugin(serde_macros))] #![allow(unused_imports, unused_mut, dead_code)] +#[cfg(feature = "nightly")] +include!("lib.rs.in"); + +#[cfg(feature = "with-syntex")] include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file