[HTC Desire C] <CyberAnarchy>:
Part 3 is here! Even if I move on to part 4... It won't mean this is over. I will keep on adding stuff here.

So now...........

###########################

TIPS,TRICKS AND MISC STUFF

###########################

Nightlies:

Okay so you have sources synced for a ROM say cm11.

Its complete and running with a proper device tree and kernel.

You want to do nightly or weekly builds for it.

So what IS a nightly/weekly?

These are build of the ROM done every night or week by pulling the latest source code of the ROM with all the new commits and build it to keep the ROM up to date.

How to do it? Sure compile every night. But that's not conventional eh?

So let's use this script for night lies!(please tell me if it didn't work).

#!/bin/bash
#navigate to source directory
cd ~/home/user/android/system
#clean out folder before building
make clobber
#sync source. Modyfy script to set -j flags accordingly
repo sync
#Set up for building
source build/envsetup.sh
#Start build process
brunch cm_golfu-userdebug
#rename to nightly
cd ~/home/user/android/system/out/target/product/golfu
mv cm-11*.zip cm-11-$(date +%Y%m%d)-golfu-NIGHTLY.zip

I've explained what the script does along the way.

Make changes accordingly for different Roms,devices and weeklies.

Save it as script.sh

Then navigate to folder of script and type

./script.sh

If some permission issue arises type

su chmod 755 script.sh

CCACHE:

Wanna cut down compilation time?? Use CCACHE!

Go to /home and open .baschrc by using gedit .basrc in terminal

Add these lines:

export USE_CCACHE=1
export CCACHE_DIR=/source-directory/prebuilts/misc/linux-x86/ccache

Navigate to source-directory and type this in terminal:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

50G = 50gb of cache . Change it accordingly.

Cherry Picking:

Want to apply changes to your device tree by applying commits from github? Instead of manual copy-pasting its better to cherry pick those commits and apply in

your device tree!!

FIrstly, Navigate to your device tree.

Now that thats done:

git init
git pull git@github.com:username/android_device_htc_golfu.git

Now after that time to fetch the project from which we are cherry picking:

git fetch git://github.com/user/repo.git

Now time to cherry-pick the commit itself. You might have noticed that the commit has a particular id which looks like a long string.

eg: ab72e4ab36778474593ffce89150aece01d5f9c

so what we do now is:

git cherry-pick thecommitid

And you are done!!

Local Manifests:

There are many useless files in the source (for us) that we donot need. The vendor, kernel and device trees of official devices may be included. Why should we waste

data by downloading them? Lets remove them from our sync!

cd source/.repo
gedit local_manifest.xml

example of how to remove a project:

<remove-project name="CyanogenMod/android_hardware_qcom_fm" />

Using the reference flag:

Now that we have compiled CyanogenMod and want to compile another ROM , should we waste hours syncing again??

NO

We shall use the reference flag instead!!

So now navigate to the new folder created for the new source and then enter:

repo init --reference=~/rootofdownloadedsource -u git://url.com/ROM.git -b branch

What the reference flag does is it just simply transfers the common projects instead of re-downloading them saving time and data! :D