From 0a6ae559fd1dea5cc4b94561785657e968e0c8e0 Mon Sep 17 00:00:00 2001 From: zeners Date: Sat, 30 Apr 2016 14:21:09 +0200 Subject: [PATCH] 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 --- libresapi/src/libresapi.pro | 83 +++++++++++++++++++---- libresapi/src/webui-src/make-src/build.sh | 67 +++++++++++------- 2 files changed, 113 insertions(+), 37 deletions(-) diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index 39fca750e..a0d840754 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -15,19 +15,75 @@ INCLUDEPATH += ../../libretroshare/src unix { webui_files.path = "$${DATA_DIR}/webui" - webui_files.files = webui/* - INSTALLS += webui_files + 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 + 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 .) diff --git a/libresapi/src/webui-src/make-src/build.sh b/libresapi/src/webui-src/make-src/build.sh index f96674cae..425119a72 100755 --- a/libresapi/src/webui-src/make-src/build.sh +++ b/libresapi/src/webui-src/make-src/build.sh @@ -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,34 +10,53 @@ else src=$1/webui-src fi -if [ -d "$publicdest" ]; then - echo remove existing $publicdest - rm $publicdest -R +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 - fname=$(basename "$filename") - fname="${fname%.*}" - echo - adding $fname ... - echo require.register\(\"$fname\", function\(exports, require, module\) { >> $publicdest/app.js - cat $filename >> $publicdest/app.js - echo >> $publicdest/app.js - echo }\)\; >> $publicdest/app.js -done + for filename in $src/app/*.js; do + fname=$(basename "$filename") + fname="${fname%.*}" + echo - adding $fname ... + echo require.register\(\"$fname\", function\(exports, require, module\) { >> $publicdest/app.js + cat $filename >> $publicdest/app.js + echo >> $publicdest/app.js + echo }\)\; >> $publicdest/app.js + 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