Building the pdk (platform development kit)

1) get a cupcake source tree with all the normal tools... and add doxygen 
(We currently support version 1.4.6)

  sudo apt-get install doxygen
  
Make sure that you are using the right version of java
  
  sudo update-java-alternatives -s java-1.5.0-sun

If that doesn't work, go through the instructions on

  http://source.android.com/download again.


2) from the root
  . build/envsetup.sh


4) mkdir dist
   mkdir logs
   
then build everything:

   time make -j8 pdk pdk_all dist DIST_DIR=dist 2>&1 | tee logs/`date +%y%m%d-%H%M%S`

so you can have a record of the build commands in the logs directory.


5) the pdk and pndk tar file is put in the dist directory.

6) the pdk-docs are in 

  out/target/common/docs/online-pdk


--------------------------------------------------------------------------------
# Build Notes

The build target 'pdk' brings in the pdk/pndk make files into the build system.
  Then there are three targets:
    pdk_docs - which builds just the pdk documentation
    pndk - which builds the platform's native development kit (native compiler, linker, etc.)
    pdk_all - which builds the above two targets

To change which version of doxygen runs you can pass in the variable:
  doxygen_version='<path/name_of_doxygen_executable>'
on the make line.


--------------------------------------------------------------------------------
# Testing

You must install google appengine.  See: http://code.google.com/appengine/downloads.html

Here's the command to run the pdk-docs server locally:
  python <path_to_appengine_installation>/dev_appserver.py --address 0.0.0.0 \
    <path_to_cupcake_code>/android/out/target/common/docs

To verify it is working, you can access it with a browser locally on port 8080:

http://localhost:8080/online-pdk/guide/index.html

NOTE: If you are trying to get to the appengine local testing instance remotely
you will have to ssh tunnel into your linux box as appengine only serves the web
host locally.  

On a Windows machine to check your current port forwarding settings:

1. Start putty.
2. Click on your session in the list and hit load (this loads the settings so you can edit them)
3. Go to SSH -> tunnels and look at the Forwarded ports box

L8080   localhost:8080

Means that you can point your webbrowser on your laptop to http://localhost:8080/ and it will show you the same thing as on your workstation for http://localhost:8080/

To add port forwarding

1. Start putty.
2. Click on your session in the list and hit load (this loads the settings so you can edit them)
3. Go to SSH -> tunnels.
4. Pick an unused port on your laptop (8080, 8888, something like that) and put it in the "source port box"
5. In the destination box, put localhost:8888 (replace with the actual port number the service is running on)
6. Hit add.
7. Go back to "Session" and save your new settings so this configuration will happen every time you login.
 

--------------------------------------------------------------------------------
# Deployment

To host the pdk docs on the internal appengine run:
/home/build/static/projects/apphosting/devtools/appcfg.py update <path_to_cupcake_src>/out/target/common/docs
where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
all of which are tarred up by the Pdk.mk file when using the target pdk_docs. 

To host the pdk docs on the external appengine run:
/home/build/static/projects/apphosting/devtools/appcfg.py -s pdk-docs.appspot.com update <path_to_cupcake_src>/out/target/common/docs
where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
all of which are tarred up by the Pdk.mk file when using the target pdk_docs.