webui: redefined building webui

on linux: 'make' don't build libresapi every time anymore,
it now knows when, what and how to 'build' webui

on windows: builds old style
This commit is contained in:
zeners 2016-04-30 14:21:09 +02:00
parent baf940443d
commit 0a6ae559fd
2 changed files with 113 additions and 37 deletions

View File

@ -15,19 +15,75 @@ INCLUDEPATH += ../../libretroshare/src
unix {
webui_files.path = "$${DATA_DIR}/webui"
webui_files.files = webui/*
webui_files.files = webui/app.js webui/app.css webui/index.html
INSTALLS += webui_files
webui_img_files.path = "$${DATA_DIR}/webui/img"
webui_img_files.files = ../../retroshare-gui/src/gui/images/logo/logo_splash.png
INSTALLS += webui_img_files
create_webfiles.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_
QMAKE_EXTRA_TARGETS += create_webfiles
PRE_TARGETDEPS += create_webfiles
#create_webfiles.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_
#QMAKE_EXTRA_TARGETS += create_webfiles
#POST_TARGETDEPS += create_webfiles
# create dummy files
system(webui-src/make-src/init.sh .)
#QMAKE_POST_LINK=sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_
WEBUI_SRC_SCRIPT = webui-src/make-src/build.sh
WEBUI_SRC_HTML = $$WEBUI_SRC_SCRIPT
WEBUI_SRC_HTML += webui-src/app/assets/index.html
WEBUI_SRC_JS = $$WEBUI_SRC_SCRIPT
WEBUI_SRC_JS += webui-src/app/accountselect.js
WEBUI_SRC_JS += webui-src/app/adddownloads.js
WEBUI_SRC_JS += webui-src/app/addidentity.js
WEBUI_SRC_JS += webui-src/app/addpeer.js
WEBUI_SRC_JS += webui-src/app/chat.js
WEBUI_SRC_JS += webui-src/app/createlogin.js
WEBUI_SRC_JS += webui-src/app/downloads.js
WEBUI_SRC_JS += webui-src/app/forums.js
WEBUI_SRC_JS += webui-src/app/home.js
WEBUI_SRC_JS += webui-src/app/identities.js
WEBUI_SRC_JS += webui-src/app/main.js
WEBUI_SRC_JS += webui-src/app/menudef.js
WEBUI_SRC_JS += webui-src/app/menu.js
WEBUI_SRC_JS += webui-src/app/mithril.js
WEBUI_SRC_JS += webui-src/app/mithril.min.js
WEBUI_SRC_JS += webui-src/app/peers.js
WEBUI_SRC_JS += webui-src/app/retroshare.js
WEBUI_SRC_JS += webui-src/app/search.js
WEBUI_SRC_JS += webui-src/app/searchresult.js
WEBUI_SRC_JS += webui-src/app/servicecontrol.js
WEBUI_SRC_JS += webui-src/app/settings.js
WEBUI_SRC_JS += webui-src/app/waiting.js
WEBUI_SRC_CSS = $$WEBUI_SRC_SCRIPT
WEBUI_SRC_CSS += webui-src/app/green-black.scss
WEBUI_SRC_CSS += webui-src/app/_reset.scss
WEBUI_SRC_CSS += webui-src/app/_chat.sass
WEBUI_SRC_CSS += webui-src/app/main.sass
create_webfiles_html.output = webui/index.html
create_webfiles_html.input = WEBUI_SRC_HTML
create_webfiles_html.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_ index.html .
create_webfiles_html.variable_out = OBJECTS
create_webfiles_html.CONFIG = combine no_link
create_webfiles_js.output = webui/app.js
create_webfiles_js.input = WEBUI_SRC_JS
create_webfiles_js.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_ app.js .
create_webfiles_js.variable_out = OBJECTS
create_webfiles_js.CONFIG = combine no_link
create_webfiles_css.output = webui/app.css
create_webfiles_css.input = WEBUI_SRC_CSS
create_webfiles_css.commands = sh $$_PRO_FILE_PWD_/webui-src/make-src/build.sh $$_PRO_FILE_PWD_ app.css .
create_webfiles_css.variable_out = OBJECTS
create_webfiles_css.CONFIG = combine no_link
QMAKE_EXTRA_COMPILERS += create_webfiles_html create_webfiles_js create_webfiles_css
}
win32{
@ -44,9 +100,10 @@ win32{
MAKE_SRC=$$PRO_PATH\\webui-src\\make-src
}
create_webfiles.commands = $$MAKE_SRC\\build.bat $$PRO_PATH
QMAKE_EXTRA_TARGETS += create_webfiles
PRE_TARGETDEPS += create_webfiles
#create_webfiles.commands = $$MAKE_SRC\\build.bat $$PRO_PATH
#QMAKE_EXTRA_TARGETS += create_webfiles
#PRE_TARGETDEPS += create_webfiles
QMAKE_POST_LINK=$$MAKE_SRC\\build.bat $$PRO_PATH
# create dummy files
system($$MAKE_SRC\\init.bat .)

View File

@ -2,7 +2,7 @@
# create webfiles from sources at compile time (works without npm/node.js)
if [ "$1" = "" ];then
if [ "$1" = "" ]; then
publicdest=../../webui
src=..
else
@ -10,19 +10,25 @@ else
src=$1/webui-src
fi
if [ -d "$publicdest" ]; then
if [ "$2" = "" ]; then
if [ -d "$publicdest" ]; then
echo remove existing $publicdest
rm $publicdest -R
fi
fi
echo mkdir $publicdest
mkdir $publicdest
if [ ! -d "$publicdest" ]; then
echo mkdir $publicdest
mkdir $publicdest
fi
echo building app.js
echo - copy template.js ...
cp $src/make-src/template.js $publicdest/app.js
if [ "$2" = "" ]||[ "$2" = "app.js" ]; then
echo building app.js
echo - copy template.js ...
cp $src/make-src/template.js $publicdest/app.js
for filename in $src/app/*.js; do
for filename in $src/app/*.js; do
fname=$(basename "$filename")
fname="${fname%.*}"
echo - adding $fname ...
@ -30,14 +36,27 @@ for filename in $src/app/*.js; do
cat $filename >> $publicdest/app.js
echo >> $publicdest/app.js
echo }\)\; >> $publicdest/app.js
done
done
fi
echo building app.css
cat $src/app/green-black.scss >> $publicdest/app.css
cat $src/make-src/main.css >> $publicdest/app.css
cat $src/make-src/chat.css >> $publicdest/app.css
if [ "$2" = "" ]||[ "$2" = "app.css" ]; then
echo building app.css
cat $src/app/green-black.scss >> $publicdest/app.css
cat $src/make-src/main.css >> $publicdest/app.css
cat $src/make-src/chat.css >> $publicdest/app.css
fi
echo copy index.html
cp $src/app/assets/index.html $publicdest/index.html
if [ "$2" = "" ]||[ "$2" = "index.html" ]; then
echo copy index.html
cp $src/app/assets/index.html $publicdest/index.html
fi
if [ "$2" != "" ]&&[ "$3" != "" ]; then
if [ ! -d "$3/webui" ]; then
echo mkdir $3/webui
mkdir $3/webui
fi
echo copy $2 nach $3/webui/$2
cp $publicdest/$2 $3/webui/$2
fi
echo build.sh complete