-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgradle_cache_to_manifest.py
40 lines (31 loc) · 1.11 KB
/
gradle_cache_to_manifest.py
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
# File name: gradle_cache_to_manifest.py
# Author by: ksh ([email protected])
# History:
# [2021/03/02 08:27 PM] Created.
#
# Function: Create a manifest file that contains a list of the latest versions of android gradle cache libraries.
# This manifest can be used in gradle offline synchronize.
import os
from shutil import copyfile
src = "E:/android/gradle_home/caches/modules-2/files-2.1/"
manifest_file_path = "E:/android/gradle_cache_manifest.txt"
def processGroup(group):
artifects = os.listdir(src + group)
for artifect in artifects:
processArtifect(group, artifect)
return
def processArtifect(group, artifect):
src_artifect_dir = src + group + "/" + artifect
versions = os.listdir(src_artifect_dir)
last_version = versions[-1]
processVersion(group, artifect, last_version)
return
def processVersion(group, artifect, version):
manifest_file.write(group + ':' + artifect + ':' + version + '\n')
return
manifest_file = open(manifest_file_path, 'w')
groups = os.listdir(src)
for group in groups:
processGroup(group)
manifest_file.close()
print("Done!")