Skip to main content

Android Project Product

Project description

README

在多个Android项目自由跳转脚本,包含自动补全,可以直接修改template或者修改json配置进行安装,支持自定义命令

目录

一、安装及使用

  • pip3 install anpp
  • anpp-build new
    .
    ├── LICENSE
    ├── Makefile
    ├── androiddir.bash.template
    ├── config.json
    ├── generator.py
    └── tools
        ├── custom.sh
        └── custom.py
    

二、配置方法

2.1 修改androiddir.bash.template

修改文件数组:androiddir.bash.template

  • defaultPath:所有项目的根目录
  • projects: 项目文件夹名
  • products:项目对应的产品名
  • kernels:内核相对路径,相对于projects
  • dtss:dts相对路径,相对kernels
  • bootloaderStage1s:第一阶段bootloader
  • bootloaderStage2s:第二阶段bootloader
  • outs:out目录,不含product名
  • efuses:签名工具目录
  • components:跳转命令别命(alias)

2.2 修改config.json

修改json数据:config.json

  • defaultPath:所有项目的根目录
  • project_keys:用于定义project支持哪些属性,定义了但是在project中没有赋值的会使用.(路径)替代
    • project: 项目文件夹名
    • product:项目对应的产品名
    • kernel:内核相对路径,相对于projects
    • dts:dts相对路径,相对kernels
    • bootloaderStage1s:第一阶段bootloader
    • bootloaderStage2s:第二阶段bootloader
    • out:out目录,不含product名
    • efuse:签名工具目录
  • components:用于合成路径,以及shell命令的alias
    • cmd:shell命令alias
    • combine:使用project_keys中的属性,完成cmd命令的路径组合

三、安装anpp shell脚本

3.1 直接安装androiddir.bash.template修改

  • make template
    cp androiddir.bash.template ~/.androiddir.sh
    check if source .androiddir.sh path in /home/pi/.bashrc:
    .androiddir.sh path not source in /home/pi/.bashrc
    tail ~/.bashrc last 2 line for terminal check
    ~/.bashrc content
    ...
    # add anpp(https://github.com/ZengjfOS/anpp) function to bash env
    source ~/.androiddir.sh
    
  • source ~/.bashrc

3.2 安装config.json模版

  • 以下三条命令执行的内容是一致的
    • make
    • make json
    • make install
  • make log
    python3 ./generator.py ~/.androiddir.sh
    defaultPath: ~/zengjf/
    projects: ['M0-project', 'A00-project', 'M8-project', 'L00-project']
    products: ['M0', 'k61v1_64_bsp', 'k62v1_64', 's138']
    kernels: ['kernel-4.9', 'kernel-4.9', 'kernel-4.19', 'android/kernel/msm-4.14']
    bootloaderStage1s: ['vendor/mediatek/proprietary/bootable/bootloader/preloader', 'vendor/mediatek/proprietary/bootable/bootloader/preloader', 'vendor/mediatek/proprietary/bootable/bootloader/preloader', 'android/fibo/bp_code/boot_images']
    bootloaderStage2s: ['vendor/mediatek/proprietary/bootable/bootloader/lk', 'vendor/mediatek/proprietary/bootable/bootloader/lk', 'vendor/mediatek/proprietary/bootable/bootloader/lk', 'android/bootable/bootloader/edk2']
    outs: ['out/target/product', 'out/target/product', 'out/target/product', 'android/out/target/product']
    efuses: ['vendor/mediatek/proprietary/scripts/sign-image_v2', 'vendor/mediatek/proprietary/scripts/sign-image_v2', 'vendor/mediatek/proprietary/scripts/sign-image_v2', 'sc13x_download_images_v2/qcm6125-la-2-0/common/sectools']
    check if source .androiddir.sh path in /home/pi/.bashrc:
    .androiddir.sh path not source in /home/pi/.bashrc
    tail ~/.bashrc last 2 line for terminal check
    ~/.bashrc content
    ...
    # add anpp(https://github.com/ZengjfOS/anpp) function to bash env
    source ~/.androiddir.sh
    
  • source ~/.bashrc

四、clean

make clean

rm ~/.androiddir.sh
sed -i "/.androiddir.sh/d" ~/.bashrc
sed -i "/ZengjfOS\/anpp/d" ~/.bashrc

五、anpp使用方法

5.1 自动补全使用

  • anpp <tab><tab>
    a00   l00  m0    m8
    
    • list project
  • anpp m0 <tab><tab>
    android  bs1      bs2      dts      kernel   out
    
    • list component
  • m0 <tab><tab>
    android  bs1      bs2      dts      kernel   out
    
    • list component

5.2 项目源代码跳转

  • projects中的名字去除-project后缀,小写名字可以直接跳转到对应的目录
  • 譬如M0-project,去除名字为M0,小写为m0,所以直接在终端输入m0,可以直接调转到其源代码根目录

5.3 其他跳转命令

NO. 命令名 说明
1 android 跳转到当前project的根目录
2 bs1 跳转到当前project的bootloader第一阶段目录
3 bs2 跳转到当前project的bootloader第二阶段目录
4 dts 跳转到当前project的设备树目录
5 kernel 跳转到当前project的内核目录
6 out 跳转到当前project的out目录
7 efuse 跳转到当前project的签名工具目录

六、自定义命令

  • 以上的命令都是相对通用的命令,如果需要自定义其他的命令,在custom.sh中进行处理
  • project_product_custom()会被传入完整的项目参数,以供所有的数据处理,参数顺序参考config.json中的project_keys数组顺序
  • 自定义命令依赖project名字调用,例如:m0 test命令,调用M0-project的test自定义功能。本质是调用custom.shproject_product_custom(),需要自行完成针对参数判断处理
  • 支持anppc(android project product custom)直接调用project_product_custom()函数处理

七、自定义别名

config.json中的alias字段用于自定义shell alias

八、自动扫描生成配置

  • 目前只支持QCOM、MTK代码架构
  • config.json中增加scan字段
    • true: 表是开启自动扫描,不使用config.json中的项目配置
    • false: 表是关闭自动扫描,使用config.json中的项目配置

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anpp-0.1.3.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

anpp-0.1.3-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file anpp-0.1.3.tar.gz.

File metadata

  • Download URL: anpp-0.1.3.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for anpp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1fbe81f2438d9336c518377a673b22e06d540291d0a4abae07bc6bf275bbd480
MD5 0a0e3d907cd18976edffa44c120a77ea
BLAKE2b-256 789074ea1400fb097869dc87c42e8a77872ea152995b401d0355259e53965ef0

See more details on using hashes here.

File details

Details for the file anpp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: anpp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for anpp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1818ed3c29e09cf7bba08aefbb4e1cc82cffe13c1a70fa2383bcf47a5bf6f1e1
MD5 08691e54f3e04b1f1b73d570bd62b3d8
BLAKE2b-256 511aeb42a737390d34c65a5edabd5be116edec07b34d66aabcd8ef5754089418

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page