windows下载android源码

来源:互联网 发布:软件空下载 编辑:程序博客网 时间:2024/06/11 04:53

安装mysysgit
进入d盘 cd D:
创建个文件夹mkdir aosp
打开cd aosp
执行
git clone https://aosp.tuna.tsinghua.edu.cn/android/platform/manifest.git
cd manifest/
git tag
git checkout -b android-7.0.0_r1
然后在manifest下面会生成一个default.xml文件
安装python并配置环境变量
新建一个文本文档命名为download.py
将下面文件粘贴到里面
然后在命令行执行 python D:/download.py
rootdir 是源码要下载的地方
D:/Git/bin/git.exe 这个是git所在目录
D:/AOSP/manifest/default.xml 这个就是git checkout -b android-7.0.0_r1生成的

import xml.dom.minidom  import os  from subprocess import call  #downloaded source path  rootdir = "D:/AOSP"  #git program path  git = "D:/Git/bin/git.exe"dom = xml.dom.minidom.parse("D:/AOSP/manifest/default.xml")  root = dom.documentElement  prefix = git + " clone https://aosp.tuna.tsinghua.edu.cn/"  suffix = ".git"  if not os.path.exists(rootdir):      os.mkdir(rootdir)  for node in root.getElementsByTagName("project"):      os.chdir(rootdir)      d = node.getAttribute("path")      last = d.rfind("/")      if last != -1:          d = rootdir + "/" + d[:last]          if not os.path.exists(d):              os.makedirs(d)          os.chdir(d)      cmd = prefix + node.getAttribute("name") + suffix      call(cmd)
0 0
原创粉丝点击