We've heard from a number of site owners who want to make sure their public source code is searchable via Google Code Search. To help with that, we extended the Sitemap Protocol to support code files. This makes it possible to specify all the code files on your site, as well as the programming language and software license for each file.
To get started, check out the new Code Search tags for Sitemaps. For complete software packages that are archives (.tar, .tar.gz, .tar.bz2, or .zip), you can create a packagemap file to describe all the individual code files in each package. For example:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:codesearch="http://www.google.com/codesearch/schemas/sitemap/1.0">
<url>
<loc>http://example.com/download/myfile.c</loc>
<codesearch:codesearch>
<codesearch:filetype>C</codesearch:filetype>
<codesearch:license>LGPL</codesearch:license>
</codesearch:codesearch>
</url>
<url>
<loc>http://example.com/download/myproject.tgz</loc>
<codesearch:codesearch>
<codesearch:filetype>archive</codesearch:filetype>
<codesearch:license>Apache</codesearch:license>
<codesearch:packagemap>packagemap.xml</codesearch:packagemap>
</codesearch:codesearch>
</url>
</urlset>
Once you've created your Sitemap, post it to a public URL on your site and then be sure to submit it through Google Webmaster Tools.
We hope this effort will help make even more code accessible and useful for developers. Let us know what you think. There's still a lot more code out there, so we'll keep working on improving Google Code Search as a tool for finding it.