Skip to content

Upgrading fred

DC* edited this page Mar 14, 2021 · 12 revisions

This document shows how to upgrade the fred version that is bundled with the application.

Fred (Freenet REference Daemon) makes possible to connect to Freenet. It's developed here.

Important

The application can't require freenet/fred directly. So we packaged freenet/fred into freenet-mobile/fred. In the future we expect to be able to require directly from freenet/fred.

Setup

Here's how the application requires a fred version (gradle):

implementation 'com.github.freenet-mobile:fred:1486.1m'

This is obtained from jitpack (https://jitpack.io/#freenet-mobile/fred):

repositories {
     ...
     maven { url 'https://jitpack.io' }
 }

So, before anything we need to go to freenet-mobile/fred and pull in the changes from freenet/fred.

For this you'll need both freenet-mobile (obviously) and freenet/fred as remotes:

$ git remote -v
origin	[email protected]:freenet-mobile/fred.git (fetch)
origin	[email protected]:freenet-mobile/fred.git (push)
upstream	https://github.com/freenet/fred.git (fetch)
upstream	https://github.com/freenet/fred.git (push)

Steps to upgrade

First, move to freenet-mobile/fred repository and create a new branch from master:

$ git checkout master
$ git pull
$ git checkout -b 1486m

The naming schema is to use the new release version (in this example: 1486) with "m" as suffix (for mobile). So, if the new release is 1495, the branch name will be "1495m".

You'll need to pull the tagged release from upstream as follows:

$ git fetch --all
$ git merge build01489

Some changes need to be cherry-picked:

$ git cherry-pick 54d20249b2ee665def78411c465ae196f9dd7956
$ git cherry-pick 198f2d99e58bfc2c6e1291018b3c523bb7f53927

These changes are needed for fred to work on a non-JVM VM.

You can inspect the changes here and here

Run the tests with ./gradlew test and everything should pass.

Watch out!, some tests may fail randomly on some Linux distributions:

freenet.client.CodeTest > testSimpleRev FAILED
     java.lang.NullPointerException at CodeTest.java:102
 
freenet.client.CodeTest > testShifted FAILED
     java.lang.NullPointerException at CodeTest.java:127
 
freenet.client.CodeTest > testSimple FAILED
     java.lang.NullPointerException at CodeTest.java:115
Shutting down...
 
949 tests completed, 3 failed
 
> Task :test FAILED
 
FAILURE: Build failed with an exception.

You should be able to tag and build on jitpack:

$ git tag -s 1486.1m -m "1486.1m"

Tag naming schema is similar to branch naming. Except it uses the release version (in this case 1486) with a dot (".") as separator and "1m" as suffix. "m" is for mobile and is static and the number refers to the build # (in case you have to build multiple times for different reasons. In such case you'll have "1486.2m", "1486.3m", "1486.4m" and so on.

Once you push the tag with:

$ git push --tags

You'll see the release on:

https://github.com/freenet-mobile/fred/releases

And jitpack should be pick it up in minutes:

https://jitpack.io/com/github/freenet-mobile/fred/1486.1m/build.log

When the build passes you'll be able to update the dependencies on gradle, see Setup section.

Clone this wiki locally