summaryrefslogtreecommitdiff
path: root/build.sh
blob: d3fb41b6ac99152da31f74e0389848b561656986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash 
 
# mostly copied from github.com:phhusson/treble_experimentations 
set -e
 
thisdir="$(readlink -f "$(dirname "$0")")"
echo "thisdir=$thisdir"
release_name="$(date +%y%m%d)"
mkdir -p release/"$release_name"
 
jobs=$(nproc)
 
function clone_or_checkout() {
    local dir="$1"
    local repo="$2"
    local branch="$3"
    
    if [[ -d "$dir" ]];then
        (
            cd "$dir"
            git fetch
            git reset --hard
            git checkout origin/"$branch"
        )
    else
        git clone "$repo" "$dir" -b "$branch"
    fi
}
 
function init_repo() {
    repo init -u https://github.com/LineageOS/android.git -b lineage-15.1
}
 
function setup_code() {
    clone_or_checkout .repo/local_manifests "$thisdir" master
    clone_or_checkout dakkar-patches "$thisdir" master
    clone_or_checkout patches https://github.com/phhusson/treble_patches android-8.1
 
    repo sync -c -j$jobs --force-sync
 
    rm -f device/*/sepolicy/common/private/genfs_contexts
 
    bash "$thisdir/apply-patches.sh" patches
    bash "$thisdir/apply-patches.sh" dakkar-patches
}
 
if [[ "$1" == "init" ]]; then
    init_repo
    setup_code
elif [[ "$1" == "setup" ]]; then
    setup_code
fi
 
. build/envsetup.sh
 
lunch treble_dakkar_m5-userdebug
make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" installclean
make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" -j$jobs systemimage
make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" vndk-test-sepolicy
cp $OUT/system.img release/"$release_name"/system-dakkar-m5.img