Skip to content

Commit

Permalink
import raw files from GMF2.5.77 templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mki-c2c committed Sep 22, 2020
1 parent 0cd29fa commit cd85dfc
Show file tree
Hide file tree
Showing 12 changed files with 1,235 additions and 564 deletions.
134 changes: 134 additions & 0 deletions geoportal/CONST_Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
export PACKAGE = geoportailv3

TEMPLATE_EXCLUDE += $(PACKAGE)_geoportal/static/lib
FIND_OPTS = $(foreach ELEM, $(TEMPLATE_EXCLUDE),-path ./$(ELEM) -prune -o) -type f

ifneq ($(NGEO_INTERFACES), "")
DEFAULT_WEB_RULE += $(NGEO_OUTPUT_FILES)
endif
ifneq ($(NGEO_API), "")
DEFAULT_WEB_RULE += $(NGEO_API_OUTPUT_FILES)
endif

MO_FILES = $(addprefix geoportailv3_geoportal/locale/,$(addsuffix /LC_MESSAGES/geoportailv3_geoportal-client.mo, $(LANGUAGES)))

WEB_RULE ?= $(DEFAULT_WEB_RULE)

DEFAULT_BUILD_RULES ?= $(WEB_RULE) \
alembic.ini \
alembic.yaml \
build-api \
$(MO_FILES)


# Make rules
BUILD_RULES ?= $(filter-out $(DISABLE_BUILD_RULES),$(DEFAULT_BUILD_RULES))

OUTPUT_DIR = $(PACKAGE)_geoportal/static/build

# ngeo
NODE_ENV ?= production
export NODE_ENV
NO_DEV_SERVER ?= TRUE
export NO_DEV_SERVER
APP_OUTPUT_DIR = /etc/static-ngeo
GCC_JS_FILES = $(shell find /usr/lib/node_modules/openlayers/src/ol /usr/lib/node_modules/ngeo/src /usr/lib/node_modules/ol-cesium/src -type f -name '*.js' 2> /dev/null)
APP_JS_FILES = $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.js' 2> /dev/null)
HTML_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.html' 2> /dev/null)
SASS_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.scss' 2> /dev/null)
CSS_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.css' 2> /dev/null)
ANGULAR_LOCALES_FILES = $(addprefix $(APP_OUTPUT_DIR)/angular-locale_, $(addsuffix .js, $(LANGUAGES)))
NGEO_OUTPUT_FILES = $(ANGULAR_LOCALES_FILES)

NGEO_API_OUTPUT_JS_FILE ?= $(APP_OUTPUT_DIR)/api.js.tmpl
NGEO_API_OUTPUT_FILES += $(NGEO_API_OUTPUT_JS_FILE) $(APP_OUTPUT_DIR)/api.css


ifdef CI
WEBPACK_ARGS ?= --debug
else
WEBPACK_ARGS ?= --progress --debug
endif

VALIDATE_PY_FOLDERS = admin/$(PACKAGE)_admin \
$(PACKAGE)_geoportal/*.py $(PACKAGE)_geoportal/lib \
$(PACKAGE)_geoportal/scripts $(PACKAGE)_geoportal/views
VALIDATE_PY_TEST_FOLDERS = $(PACKAGE)_geoportal/tests

PY_FILES = $(shell find $(PACKAGE) -type f -name '*.py' -print 2> /dev/null)

# Templates


# Disabling Make built-in rules to speed up execution time
.SUFFIXES:

.PHONY: build
build: $(BUILD_RULES)

.PHONY: checks
checks: flake8 eslint

.PHONY: flake8
flake8:
flake8 $(PACKAGE)

.PHONY: eslint
eslint: $(APP_JS_FILES)
eslint $?

.PHONY: eslint-fix
eslint-fix: $(APP_JS_FILES)
eslint --fix $?

# Server localisation

.PRECIOUS: %.mo
%.mo: %.po
msgfmt -o $@ $<

# ngeo

.PHONY: build-ngeo
build-ngeo: $(NGEO_OUTPUT_FILES)

$(APP_OUTPUT_DIR)/angular-locale_%.js: /usr/lib/node_modules/ngeo/package.json language_mapping
mkdir --parent $(dir $@)
rm --force $@
cp /opt/angular-locale/angular-locale_`(grep $* language_mapping || echo $*) | cut --delimiter = --fields 2 | tr --delete '\r\n'`.js $@

$(APP_OUTPUT_DIR)/images/: /usr/lib/node_modules/jquery-ui/themes/base/images
mkdir --parent $@
cp -r $</* $@

.PRECIOUS: $(APP_OUTPUT_DIR)/vendor%
$(APP_OUTPUT_DIR)/vendor%: /opt/vendor%
cp $< $@

apps: webpack.apps.js
rm --force $(addprefix $(APP_OUTPUT_DIR)/, $(addsuffix .*, $(NGEO_INTERFACES)))
webpack $(WEBPACK_ARGS)
for interface in $(NGEO_INTERFACES); \
do \
mv $(APP_OUTPUT_DIR)/$${interface}.html $(APP_OUTPUT_DIR)/$${interface}.html.tmpl; \
ls -1 $(APP_OUTPUT_DIR)/$${interface}.*.css|while read file; \
do \
mv $${file} $${file}.tmpl; \
done; \
done

# API

.PHONY: build-api
build-api: $(NGEO_API_OUTPUT_FILES)

$(APP_OUTPUT_DIR)/api.js.tmpl: webpack.api.js $(PACKAGE)_geoportal/static-ngeo/api/index.js
webpack --config webpack.api.js $(WEBPACK_ARGS)
cp $(APP_OUTPUT_DIR)/api.js $(APP_OUTPUT_DIR)/api.js_
sed --in-place --expression='s/\$$/$${DOLLAR}/g' $(APP_OUTPUT_DIR)/api.js
sed --in-place --expression='s#{FULL_ENTRY_POINT}#$${VISIBLE_WEB_PROTOCOL}://$${VISIBLE_WEB_HOST}$${VISIBLE_ENTRY_POINT}#g' $(APP_OUTPUT_DIR)/api.js
mv $(APP_OUTPUT_DIR)/api.js $@


$(APP_OUTPUT_DIR)/api.css: $(PACKAGE)_geoportal/static-ngeo/api/api.css
cp $< $@
Loading

0 comments on commit cd85dfc

Please sign in to comment.