Developer
Source Code
We are using git as our source code management system, hosted on github. We have many different git repositories for the website, freenet itself (fred), official plugins, the two installers, libraries and so on; for the list, see our page on github.
We strongly recommend that you use the official command-line git client, or the Windows port. If you want to use the Eclipse git integration, see the tutorial here.
You can obtain the latest source code from git using the following command line:
git clone git://github.com/freenet/fred-staging.git
Once you have cloned the repository, to get new changes you should do:
git pull origin
More information on how to use git is further down this page.
Git is a distributed revision control system, this means amongst other things:
- Everyone has a full copy of the repository, including all the history.
- Branching and merging is easy.
- Working offline (e.g. on a train) is easy.
- We are much less vulnerable to compromise or failure of a central server.
- Anonymous contribution over Freenet is much easier.
- Generally a more secure workflow.
We have divided the code up into many sub-projects, each of which has two repositories: the -staging repository, which has the latest code, to which any developer can write, and the -official repository, which contains code which has been reviewed by trusted developers. This is for security, because we give out developer rights without any real checking, and because git allows destruction of old history. Stable builds are released from the official repository, and the responsible developer will create a signed tag, which you can verify, for that build.
Most other projects using github use a different model, where a trusted maintainer pulls from other people's trees, rather than allowing any developer to commit to a staging area; if you fork our code, and would like us to merge your changes (maybe even over Freenet, but there will be additional checks in this case: for legal reasons we must be certain that anonymous contributions are your own work), feel free to contact us!
To get write access to the repository you should create a github account and then contact us either through the development mailing list or on IRC in the #freenet channel at irc.freenode.net.Note that you must use a real (working) email address when committing; we will provide contributors with @freenetproject.org redirects.
Build Instructions
To build the source code you will need Apache ANT.
Full Build
Building Fred (the Freenet reference daemon) with ant will pull in freenet-ext.jar for third party dependancies from the website. To build freenet-ext.jar yourself you need to get the contrib module, build it, and put it into lib/freenet-ext.jar before you build the main project. Note also that the contrib module contains a number of native libraries used to improve performance; you may also want to rebuild these.
Plugins, installers etc can generally be built with ant, but some libraries may be written in other languages and have their own building procedures.
Basic git workflow
To pull all changes to the repository:
git pull origin
Or if you want to review the changes before you merge them into your local repository:
git fetch origin git log -p -M --ignore-space-change master..origin/master
If you are happy with the changes, then either merge your local changes into the remote changes:
git rebase origin/master
Or merge the remote changes into your local repository:
git merge origin/master
The latter will result in a non-linear history, so you should use rebase unless your local changes are very large.
To commit your local changes to your local repository:
git commit -a
Or:
git commit [ filenames you want to commit ]
To upload your changes (assuming you have cloned the -staging tree):
git push origin
To view recent changes:
git log -p -M --ignore-space-change
To undo one or more local commits, assuming you have not pushed your changes, and have not merged remote changes (this will simply reset your local repository to a previous version, getting rid of everything since then):
git reset [ last good revision ]
Or if you have committed your change, you will need to revert it:
git revert [ revision to get rid of ]
More documentation for git can be found here or here.
If you don't like a commit, generally you should post to the devl mailing list. You should CC the author of the commit, but unless it is a trivial matter you should always mail devl.