日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

android源码下载方法 批量下载 基于windows os

發布時間:2023/11/27 生活经验 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android源码下载方法 批量下载 基于windows os 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

  1. 安裝win版的Gitbash, 在這里 http://msysgit.googlecode.com/files/Git-1.6.0.2-preview20080923.exe。 選擇默認安裝路徑(否則后面你要手動修改下載的腳本)。 將C:\Program Files\Git\bin 加進系統路徑。Android的源碼在這里:http://git.source.android.com/
  2. 為了省去一些麻煩,目前提供下載的腳本,都是將腳本的路徑和將要用來存放源代碼的路徑寫成固定的了。 你需要在F盤騰出至少4G的空間目前來看至少10GB空間。因為我即將下載完成,已經達到6點幾G的大小,占用空間達到近9G。如果磁盤空間不足,git會報錯,那就麻煩了,我已經吃了這個苦頭了。因為據網上說android的source code的size將近3.8G。在F盤根目錄下創建android_source_code目錄和download_android-source_script。顧名思義,前者用來存放源代碼,后者用來存放下載腳本。
  3. 到這里 https://www.sugarsync.com/pf/D033416_6684866_66541 下載下載腳本,解壓將所有文件放置f:\download_android-source_script\ 目錄下,注意:該目錄下直接就放這些腳本,不要因為解壓的原因,再在這腳本外面套上一些多余的文件夾。就是像這樣就可以了:

  1. 開始-->運行-->cmd-->f:-->cd\ -->cd download_android-source_script-->dlBatchFile.bat 然后就能看到如下圖的下載界面,比較慢。

下載的進度結果,就寫在存放源碼目錄下的clone_result.log里。要是遇到網絡中斷,你可以看看你下載到哪了。然后手工修改dlBatchFile.bat

  1. 其實這些bat腳本和sh腳本使用python腳本生成的,腳本寫的很簡陋,隨便寫下,沒用心考究,注釋都沒寫,代碼如下:

view sourceprint?

01
import os

02

03
fileP = open("git_reps.txt", "r");

04

05
logFileP = open("2.log","w")

06

07
for singleLine in fileP:

08

09
if ((not singleLine.startswith("\t")) and (not singleLine.startswith("\n")) and (not singleLine.startswith(" ")) and (not singleLine.startswith("\r\n"))):

10

11
logFileP.write(singleLine)

12

13
fileP.close();

14

15
logFileP.close()

16

17

18

19
sourceDir = "%android_source_code_path%"

20

21
allrepsFileP = open("2.log", "r")

22

23
dlBatchFileP = open("dlBatchFile.bat", "w")

24

25
gitRepHead = "git clone git://android.git.kernel.org/"

26

27
#device/htc/passion-common.git

28

29
i = 0

30

31
for singleAdd in allrepsFileP:

32

33
i = i + 1

34

35
print singleAdd

36

37
gitScriptFileName = "git_script_" + singleAdd.replace("/", "_")[:-1] + ".sh"

38

39
lastDa = singleAdd.rfind("/")

40

41
singleDir = singleAdd[0:lastDa]

42

43
singleDir = singleDir.replace("/", "\\")

44

45
print singleDir

46

47
dlBatchFileP.write("if not exist " + singleDir + " md " + singleDir + "\n")

48

49
dlBatchFileP.write("cd " + singleDir + "\n")

50

51
dlBatchFileP.write("copy " + "F:\\download_android-source_script\\" + gitScriptFileName + " /y \n")

52

53
dlBatchFileP.write("\"C:\\Program Files\\Git\\bin\\sh\" " + gitScriptFileName + "\n")

54

55
dlBatchFileP.write("del " + gitScriptFileName + "\n")

56

57
dlBatchFileP.write("cd \\" + "\n")

58

59
dlBatchFileP.write("cd " + sourceDir + "\n")

60

61
dlBatchFileP.write("echo " + str(i) + "---::" + singleDir + " >>clone_result.log \n")

62

63
dlBatchFileP.write("\n")

64

65
spFileP = open(gitScriptFileName,"w")

66

67
spFileP.write(gitRepHead + singleAdd[:-1])

68

69
spFileP.close()

70

71
dlBatchFileP.close()

72

73
allrepsFileP.close()

#git_reps.txt中是直接從http://git.source.android.com/復制粘貼過來的。

ps:Su Zhengang兄弟在mail list中提到repo,如下,Fyr。

Su Zhengang
發送至 china-android-.

顯示詳細信息 14:26 (2 小時前)

為什么不用repo呢?

下載repo

Download thereposcript and make sure it is executable:
$ curl http://android.git.kernel.org/repo >~/bin/repo

$ chmod a+x ~/bin/repo

下載android代碼

$ repo init -u git://android.git.kernel.org/platform/manifest.git

$ repo sync

這些就可以了,具體說明: http://source.android.com/source/download.html

出處 android源碼下載方法 批量下載 基于windows os - Simoncook是個程序員 - 博客園

轉載于:https://www.cnblogs.com/masky5310/archive/2011/03/30/1999852.html

總結

以上是生活随笔為你收集整理的android源码下载方法 批量下载 基于windows os的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。