You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
2 months ago
|
|
||
|
# addSubdirs用来添加子项目及其依赖关系, 并自动忽略缺失的项目.
|
||
|
# 用法 addSubdirs(项目, 依赖项1 [依赖项2] ...)
|
||
|
|
||
|
defineTest(addSubdirs){
|
||
|
for(prj, 1){
|
||
|
prj = $$replace(prj, \\\\, /)
|
||
|
prj_id = $$replace(prj, [/\\\\], _)
|
||
|
SUBDIRS *= $$prj_id
|
||
|
#message ($${prj_id}.subdir = $$prj)
|
||
|
eval ($${prj_id}.subdir = $$prj)
|
||
|
for(dep, 2){
|
||
|
dep = $$replace(dep, \\\\], /)
|
||
|
dep_id = $$replace(dep, [/\\\\], _)
|
||
|
#message($${prj_id}.depends += $$dep_id)
|
||
|
eval ($${prj_id}.depends *= $$dep_id)
|
||
|
isEmpty($${dep_id}.subdir){
|
||
|
#message($${dep_id}.subdir = $$dep)
|
||
|
eval ($${dep_id}.subdir = $$dep)
|
||
|
export ($${dep_id}.subdir)
|
||
|
}
|
||
|
}
|
||
|
export ($${prj_id}.subdir)
|
||
|
export ($${prj_id}.depends)
|
||
|
}
|
||
|
export (SUBDIRS)
|
||
|
}
|
||
|
|
||
|
defineTest(fixDepends){
|
||
|
for(prj_id, SUBDIRS){
|
||
|
eval (prj = \$\$$${prj_id}.subdir)
|
||
|
!exists($$prj){
|
||
|
dirMissing *= $$prj
|
||
|
dirNeedBy -= $$prj
|
||
|
SUBDIRS -= $$prj_id
|
||
|
}
|
||
|
for(dep_id, $${prj_id}.depends){
|
||
|
eval (dep = \$\$$${dep_id}.subdir)
|
||
|
!exists($$dep){
|
||
|
dirMissing *= $$dep
|
||
|
s1 = $$find(dirMissing, $$dep)
|
||
|
isEmpty(s1){
|
||
|
dirNeedBy *= $$prj
|
||
|
}
|
||
|
eval ($${prj_id}.depends -= $$dep_id)
|
||
|
}
|
||
|
s = $$find(SUBDIRS, $$dep_id)
|
||
|
isEmpty(s){
|
||
|
#message("Project \"$$dep\" is not in project list. (need by \"$$prj\").")
|
||
|
listMissing *= $$dep
|
||
|
listNeedBy *= $$prj
|
||
|
eval ($${prj_id}.depends -= $$dep_id)
|
||
|
}
|
||
|
}
|
||
|
export ($${prj_id}.depends)
|
||
|
}
|
||
|
|
||
|
export (SUBDIRS)
|
||
|
|
||
|
!isEmpty(dirMissing){
|
||
|
message("dir missing: $${dirMissing}")
|
||
|
!isEmpty(dirNeedBy){
|
||
|
message(" -- need by: $${dirNeedBy}, may cause link problem.")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
!isEmpty(listMissing){
|
||
|
message("dir not in 'SUBDIRS': $${listMissing}")
|
||
|
message(" -- need by: $${listNeedBy}, may cause link problem.")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|