-
Notifications
You must be signed in to change notification settings - Fork 4
/
populateSubDependencies.pri
148 lines (138 loc) · 7.47 KB
/
populateSubDependencies.pri
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Author(s) : Loic Touraine, Stephane Leduc
# Detect build toolchain and define REMAKEN_TARGET_ARCH and REMAKEN_TARGET_PLATFORM
include(remaken_arch_define.pri)
defineReplace(populateSubDependencies) {
# list contains same size!
packageDepsFilesList = $$1
parentPkgList = $$2
# TODO add assert on same size on list
index =
# loop on packageDepsFilesList, and use 'index' for manage a index for parentPkgList
for (depfile, packageDepsFilesList) {
indexSize = $$size(index)
parentPkg = $$member(parentPkgList,$$indexSize)
index+=1
exists($${depfile}) {
baseDepFile = $$basename(depfile)
message("---- Parsing sub-dependencies from " $${depfile} " ----" )
dependencies = $$cat($${depfile})
for (dependency, dependencies) {
#message (dependency $$dependency)
dependencyPkgDepFiles=""
dependencyMetaInf = $$split(dependency, |)
pkgInformation = $$member(dependencyMetaInf,0)
pkgInfoList = $$split(pkgInformation, $$LITERAL_HASH)
pkgName = $$member(pkgInfoList,0)
pkgInComment = $$str_member(pkgName, 0, 1)
!equals (pkgInComment, $$PKG_COMMENT) {
pkgChannel = "stable"
pkgInfoListSize = $$size(pkgInfoList)
equals(pkgInfoListSize,2) {
pkgChannel = $$member(pkgInfoList,1)
}
pkgVersion = $$member(dependencyMetaInf,1)
pkgLibInformation = $$member(dependencyMetaInf,2)
pkgLibConditionList = $$split(pkgLibInformation, %)
libName = $$take_first(pkgLibConditionList)
pkgTypeInformation = $$member(dependencyMetaInf,3)
pkgLinkMode = $$member(dependencyMetaInf,5)
pkgTypeInfoList = $$split(pkgTypeInformation, @)
pkgCategory = $$member(pkgTypeInfoList,0)
pkgRepoType = $${pkgCategory}
pkgTypeInfoListSize = $$size(pkgTypeInfoList)
equals(pkgTypeInfoListSize,2) {
pkgRepoType = $$member(pkgTypeInfoList,1)
} else {
equals(pkgCategory,"bcomBuild")|equals(pkgCategory,"remakenBuild")|equals(pkgCategory,"thirdParties") {
pkgRepoType = "artifactory"
} # otherwise pkgRepoType = pkgCategory
}
# check pkgLinkMode not empty and mandatory equals to static|shared, otherwise set to default DEPLINKMODE
equals(pkgLinkMode,"")|equals(pkgLinkMode,"default") {
pkgLinkMode = $${DEPLINKMODE}
} else {
if (!equals(pkgLinkMode,"static"):!equals(pkgLinkMode,"shared"):!equals(pkgLinkMode,"na")){
pkgLinkMode = $${DEPLINKMODE}
}
}
verboseMessage(" ---- Processing dependency $${pkgName}_$${pkgVersion}@$${pkgRepoType} repository")
pkgTreeItem = $${parentPkg}|$${pkgName}|$${pkgLinkMode}
equals(pkgRepoType,"http")|equals(pkgRepoType,"artifactory") | equals(pkgRepoType,"github") | equals(pkgRepoType,"nexus") {
deployFolder=$${REMAKENDEPSFOLDER}/$${REMAKEN_TARGET_PLATFORM}/$${pkgName}/$${pkgVersion}
!equals(pkgCategory,$${pkgRepoType}) {
deployFolder=$${REMAKENDEPSFOLDER}/$${REMAKEN_TARGET_PLATFORM}/$${pkgCategory}/$${pkgName}/$${pkgVersion}
!exists($${deployFolder}) { #try old structure for backward compatibility
warning("No package found at " $${deployFolder})
warning("--> Try with old structure for backward compatibility")
deployFolder=$${REMAKENDEPSFOLDER}/$${pkgCategory}/$${REMAKEN_TARGET_PLATFORM}/$${pkgName}/$${pkgVersion}
}
}
!exists($${deployFolder}) {
warning("No package found at " $${deployFolder})
warning("--> Dependencies source folder should include the target platform information " $${REMAKEN_TARGET_PLATFORM})
deployFolder=$${REMAKENDEPSFOLDER}/$${pkgName}/$${pkgVersion}
!equals(pkgCategory,$${pkgRepoType}) {
deployFolder=$${REMAKENDEPSFOLDER}/$${pkgCategory}/$${pkgName}/$${pkgVersion}
}
warning("--> Finally try without target platform in $${deployFolder}")
}
!exists($${deployFolder}) {
error(" No package found at " $${deployFolder})
}
contains(pkgLinkMode,static) {
exists($${deployFolder}/packagedependencies-static.txt) {
dependencyPkgDepFiles=$${deployFolder}/packagedependencies-static.txt
}
else {
exists($${deployFolder}/packagedependencies.txt) {
dependencyPkgDepFiles=$${deployFolder}/packagedependencies.txt
}
}
}
else {
exists($${deployFolder}/packagedependencies.txt) {
dependencyPkgDepFiles=$${deployFolder}/packagedependencies.txt
}
}
}
currentPackageDeps += $${dependencyPkgDepFiles}
!isEmpty(dependencyPkgDepFiles) {
# subdependency file found => depfile;parentPkg;parentPkg|pkgName|pkgLinkMode (first parent pk g is used for re-call function and specify parent!)
outPackageDeps += $${dependencyPkgDepFiles};$${pkgName};$${pkgTreeItem}
} else {
# no subdependency file found => parentPkg|pkgName|pkgLinkMode
outPackageDeps += $${pkgTreeItem}
}
isEmpty(currentPackageDeps) {
message(" ---- No sub-dependencies found ----")
} else {
message(" ---- Sub-dependencies found :" )
for(var, currentPackageDeps) {
message(" ==>" $${var} )
}
}
message(" ")
} # comment package
else {
#message(package in comment : $${pkg.name})
}
} # for(var, dependencies)
} #!exists($${depfile})
} # for(depfile, packagedepsfiles)
return ($${outPackageDeps})
}
# return pkgParent dep if static, otherwise empty
defineReplace(getStaticParentPkg) {
pkg = $$1
subDepsTree = $$2
for(var, subDepsTree) {
depInf = $$split(var, |)
pkgParent = $$member(depInf,0)
pkgName = $$member(depInf,1)
pkgMode = $$member(depInf,2)
if (equals(pkg,$${pkgName}):equals(pkgMode,"static")) {
return ($$pkgParent)
}
}
return ()
}