Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
许可证标头的Xcode检查_Xcode_Scripting_Comments_Licensing - Fatal编程技术网

许可证标头的Xcode检查

许可证标头的Xcode检查,xcode,scripting,comments,licensing,Xcode,Scripting,Comments,Licensing,我甚至不确定这是否可能,但我会试一试 Xcode是否有可能(即使用插件)检查每个文件是否包含有效的许可证头,如果没有,则停止编译 提前感谢。我不确定这是否是正确答案,但您可以在构建阶段添加一个shell脚本,该脚本可以检查项目中的文件是否有有效的许可证标头(通过grep+regex)。我不确定这是否是正确答案,但是,您可以在构建阶段添加一个shell脚本,该脚本可以检查项目中的文件是否有有效的许可证头(通过grep+regex)。以下是完整的设置!请注意,这也会产生Xcode错误。:) #/bi

我甚至不确定这是否可能,但我会试一试

Xcode是否有可能(即使用插件)检查每个文件是否包含有效的许可证头,如果没有,则停止编译


提前感谢。

我不确定这是否是正确答案,但您可以在构建阶段添加一个shell脚本,该脚本可以检查项目中的文件是否有有效的许可证标头(通过grep+regex)。

我不确定这是否是正确答案,但是,您可以在构建阶段添加一个shell脚本,该脚本可以检查项目中的文件是否有有效的许可证头(通过grep+regex)。

以下是完整的设置!请注意,这也会产生Xcode错误。:)

#/bin/bash
searchString=`cat license.txt`
错误计数=0
读取文件时
做
grep-F“${searchString}”$file>/dev/null
如果[$?-ne 0];然后
echo-e$文件:1:错误:未找到有效的许可证标头!1>&2 
错误计数=1
fi

完成<这是完整的设置!请注意,这也会产生Xcode错误。:)

#/bin/bash
searchString=`cat license.txt`
错误计数=0
读取文件时
做
grep-F“${searchString}”$file>/dev/null
如果[$?-ne 0];然后
echo-e$文件:1:错误:未找到有效的许可证标头!1>&2 
错误计数=1
fi

谢谢,我不知道这是可能的。一旦一切就绪,我就会发回。谢谢,我不知道这是可能的。一旦一切就绪,我会发回邮件。
#!/bin/bash

searchString=`cat license.txt`

ERROR_COUNT=0
while read file
do
    grep -F "${searchString}" $file > /dev/null
    if [ $? -ne 0 ]; then
        echo -e $file:1: error : No valid License Header found! 1>&2 
        ERROR_COUNT=1
    fi
done < <(find . -type d \( -name "TTTAttributedLabel" -o -name "minizip" -o -name "SSZipArchive" \) -prune -o -type f \( -name "*.m" -o -name "*.h" -o -name "*.pch" \) -print)


exit $ERROR_COUNT