Jenkins自动编译库并上传服务器
github地址
首先添加 git
地址:
再添加定时构建,每天夜里构建一次:
执行 shell
脚本进行构建
cd networklayerecho "build json x86"
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - Unix Makefiles" ./
cd cmake-build-release
makeecho "build json hisi500"
cd ..
cmake -S . -B cmake-build-release-hisi3531 -DCMAKE_C_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc -DCMAKE_CXX_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-g++ -G "CodeBlocks - Unix Makefiles"
cd cmake-build-release-hisi3531
makeecho "make dir"
if [ ! -d "/var/www/html/libs/networklayer" ]; thenmkdir /var/www/html/libs/networklayer
fiif [ ! -d "/var/www/html/libs/networklayer/lib" ]; thenmkdir /var/www/html/libs/networklayer/lib
fiif [ ! -d "/var/www/html/libs/networklayer/lib/hisi500" ]; thenmkdir /var/www/html/libs/networklayer/lib/hisi500
fiif [ ! -d "/var/www/html/libs/networklayer/lib/x86" ]; thenmkdir /var/www/html/libs/networklayer/lib/x86
fiif [ ! -d "/var/www/html/libs/networklayer/include" ]; thenmkdir /var/www/html/libs/networklayer/include
fiecho "clean before"
rm -rf /var/www/html/libs/networklayer/include/*
rm -rf /var/www/html/libs/networklayer/lib/hisi500/*
rm -rf /var/www/html/libs/networklayer/lib/x86/*echo "copy"
cp -dprf ${WORKSPACE}/libs/hisi500/libNetWorkLayer.a /var/www/html/libs/networklayer/lib/hisi500
cp -dprf ${WORKSPACE}/libs/x86/libNetWorkLayer.a /var/www/html/libs/networklayer/lib/x86cp -dprf ${WORKSPACE}/libs/hisi500/libNetWorkLayer.so /var/www/html/libs/networklayer/lib/hisi500
cp -dprf ${WORKSPACE}/libs/x86/libNetWorkLayer.so /var/www/html/libs/networklayer/lib/x86cp -dprf ${WORKSPACE}/networklayer/src/net_work_layer.h /var/www/html/libs/networklayer/include/
cp -dprf ${WORKSPACE}/networklayer/src/net_work_common_data.h /var/www/html/libs/networklayer/include/ls -lh /var/www/html/libs/networklayer/lib/*
ls -lh /var/www/html/libs/networklayer/include/*#bak
#cmake -S . -B cmake-build-release-hisi3531 -DCMAKE_C_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc -DCMAKE_CXX_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-g++ -G "CodeBlocks - Unix Makefiles"
#cd cmake-build-release-hisi3531
#make
这里成功添加到了服务器上
然后将本地库上传修改为统一从服务器获取:
cd mediaService
if [ ! -d "include" ]; thenmkdir include
fi
cd include
rm -fr *
wget http://192.168.1.132/libs/rtspclient/include/ -r -c -np -nH -E -R html --cut-dirs 3
wget http://192.168.1.132/libs/tulog/include/ -r -c -np -nH -E -R html --cut-dirs 3
wget http://192.168.1.132/libs/networklayer/include/ -r -c -np -nH -E -R html --cut-dirs 3if [ ! -d "trcode" ]; thenmkdir trcode
fi
cd trcode
wget http://192.168.1.132/libs/hi3531_video_transcode/include/ -r -c -np -nH -E -R html --cut-dirs 3
cd ../if [ ! -d "libevent" ]; thenmkdir libevent
fi
cd libevent
wget http://192.168.1.132/libs/libevent/include/ -r -c -np -nH -E -R html --cut-dirs 3
cd ../if [ ! -d "json" ]; thenmkdir json
fi
cd json
wget http://192.168.1.132/libs/json/include/ -r -c -np -nH -E -R html --cut-dirs 3
cd ../if [ ! -d "gtest" ]; thenmkdir gtest
fi
cd gtest
wget http://192.168.1.132/libs/gtest/include/ -r -c -np -nH -E -R html --cut-dirs 3
cd ../cd ../
if [ ! -d "libs" ]; thenmkdir libs
fi
cd libs
rm -fr *
if [ ! -d "hisi500" ]; thenmkdir hisi500
fi
cd hisi500
wget http://192.168.1.132/libs/hi3531_video_transcode/lib/ -r -c -np -nH -E -R html --cut-dirs 3
wget http://192.168.1.132/libs/json/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4
wget http://192.168.1.132/libs/networklayer/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4
wget http://192.168.1.132/libs/rtspclient/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4
wget http://192.168.1.132/libs/tulog/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4if [ ! -d "gtest" ]; thenmkdir gtest
fi
cd gtest
wget http://192.168.1.132/libs/gtest/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4
cd ../
if [ ! -d "libevent" ]; thenmkdir libevent
fi
cd libevent
wget http://192.168.1.132/libs/libevent/lib/hisi500/ -r -c -np -nH -E -R html --cut-dirs 4
cd ../
cd ../
cd ../ls -lh ${WORKSPACE}/mediaService/include/*
ls -lh ${WORKSPACE}/mediaService/libs/*cmake -S . -B cmake-build-release-hisi3531 -DCMAKE_C_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc -DCMAKE_CXX_COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-g++ -G "CodeBlocks - Unix Makefiles"
cd cmake-build-release-hisi3531
make