Search code examples
google-tvgoogle-closuregoogle-closure-library

GoogleTV Closure Library Getting Started


I've been trying to figure out how to use the google closure library for d-pad navigation for my web app. I cannot for the life of me get closure to work. I'm following google's guide here https://developers.google.com/tv/web/lib/closure/gettingstarted

The guide asks to checkout from their SVN repo, but I'm just using the downloaded zip of the library from github. The guide asks to perform the following command

gtv-ui-lib/closure-library/closure/bin/build/depswriter.py \
  --root_with_prefix="gtv-ui-lib/source ../../../../gtv-ui-lib/source" \
  --output_file=tv-deps.js

to create a deps.js file. Can somebody explain to me how to execute this command? Is it supposed to be in a python command prompt or something else? When I copy and paste their exact html and javascript page code and use the premade deps.js file for the guide, my page doesn't function with keyboard navigation, so I'm assuming the deps.js file is my problem because everything else is exactly from the guide.


Solution

  • You will need to have python installed on your development machine and make sure that it is added to your path environment. The closure depswriter can be executed by using python from the command line (if you are using *nix then you can just invoke the file from the cli). Try:

    python WHERE-YOU-UNZIPPED-THE-ZIP-PATH/gtv-ui-lib/closure-library/closure/bin/build/depswriter.py \
      --root_with_prefix="gtv-ui-lib/source ../../../../gtv-ui-lib/source" \
      --output_file=tv-deps.js
    

    I would also recommend checking out the source from the SVN repo and not using the github zip file. The SVN repo is the most upto date and the github is a mirror that can sometimes fall behind. To ensure you have the latest version of the code do install the SVN tools and checkout from the specified repo.