Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • oss/utilities/webservice-echoserver
1 result
Show changes
Showing
with 989 additions and 0 deletions
#############################################################################################
#############################################################################################
##
## DEPLOY TOOLS
##
#############################################################################################
#############################################################################################
UPLOAD_TOOL_URL ?= s3://download.schukai.com/tools/$(COMPONENT_SLUG)/
.PHONY: deploy
## compile and deploy to S3
deploy: compile
$(QUIET) AWS_PROFILE=$(AWS_PROFILE) find $(BUILD_PATH) -iname $(COMPONENT_SLUG)-* -exec $(AWS) s3 cp {} $(UPLOAD_TOOL_URL) \;
.PHONY: overview-to-s3
## overview-to-s3
overview-to-s3:
$(QUIET) AWS_PROFILE=$(AWS_PROFILE) $(AWS) s3 cp $(WEB_PATH)/index.html $(UPLOAD_TOOL_URL)
$(QUIET) AWS_PROFILE=$(AWS_PROFILE) $(AWS) s3 cp $(WEB_PATH)/index.css $(UPLOAD_TOOL_URL)
$(QUIET) AWS_PROFILE=$(AWS_PROFILE) $(AWS) s3 cp $(WEB_PATH)/index.js $(UPLOAD_TOOL_URL)
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## DOCMAN-TARGETS
##
#############################################################################################
#############################################################################################
ifeq ($(DOCMAN_BIN),)
$(error "$(DOCMAN_BIN) is not installed. Please check your makefile and include the docman.mk")
endif
$(DOCMAN_BIN):
$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
$(QUIET) $(WGET) -O $(DOCMAN_BIN) http://download.schukai.com/tools/docman/docman-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
$(QUIET) $(CHMOD) u+x $(DOCMAN_BIN)
$(PROJECT_ROOT)deployment/build/manual.html: $(DOCMAN_BIN)
$(DOCMAN_BIN) document html --config $(PROJECT_ROOT)documentation/config.yaml
$(PROJECT_ROOT)deployment/build/manual.pdf: $(DOCMAN_BIN)
$(DOCMAN_BIN) document pdf --config $(PROJECT_ROOT)documentation/config.yaml
.PHONY: build-doc-pdf
## creating the documentation in pdf format
build-doc-pdf: $(PROJECT_ROOT)deployment/build/manual.pdf
.PHONY: build-doc-html
## creating the documentation in html format
build-doc-html: $(PROJECT_ROOT)deployment/build/manual.html
.PHONY: build-doc
## creating the documentation in pdf and html format
build-doc: build-doc-pdf build-doc-html
#############################################################################################
#############################################################################################
##
## GIT-TARGETS
##
#############################################################################################
#############################################################################################
ifeq ($(GIT),)
$(error $(ERRORMARKER) Git is not defined, check your Makefile if git.mk is included)
endif
## Current Branch-GIT_TAG
GIT_TAG := -
## Git Commit GIT_MESSAGE for git-push
GIT_MESSAGE := current status
.PHONY: git-branch
## create new branch (use GIT_TAG-Variable)
git-branch:
$(QUIET) export BRANCH="b$(GIT_TAG)/$(shell uuidgen --random)" ; \
$(QUIET) $(GIT) checkout -b $${BRANCH} && \
RESULT=$$($(GIT) push origin $$BRANCH 2>&1) && \
RESULT2=$$($(GIT) branch --set-upstream-to=origin/$$BRANCH $$BRANCH) && \
GITLABURL=$$(echo "$$RESULT" | tr '\n' '\#' | grep -o 'remote\:\s*https:\/\/gitlab\.schukai\.com[^ ]*' | cut -d " " -f2-9 | sed -e 's/^[ \t]*//') && \
if $(OPENBROWSER) ; then google-chrome --profile-directory="Default" $$GITLABURL ; fi
.PHONY: git-to-master
## git checkout master, fetch and merge
git-to-master:
$(QUIET) $(GIT) checkout master && $(GIT) fetch -pP && $(GIT) merge
.PHONY: git-push-to-server
## git push changes to server
git-push-to-server:
$(QUIET) $(GIT) add -A
$(QUIET) $(GIT) commit -m"$(GIT_MESSAGE)"
$(QUIET) $(GIT) push
.PHONY: git-push
## git create branch and push changes to server
git-push: git-branch git-push-to-server
.PHONY: git-tag
## git create version tag
git-tag:
$(QUIET) $(GIT) tag -a "$(COMPONENT_VERSION)" -m "release $(COMPONENT_VERSION)"
.PHONY: git-prune-remote
## removes your local remote tracking branches where the branch no longer exists on the remote
git-prune-remote:
$(QUIET) $(GIT) remote prune origin
.PHONY: git-prune-local
## deletes local merged branches except the master branch
git-prune-local:
$(QUIET) $(GIT) branch --merged master | grep -v '^[ *]*master$$' | xargs git branch -d
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## BUILD GO
##
#############################################################################################
#############################################################################################
ifeq ($(GO),)
$(error $(ERRORMARKER) Go is not defined, check your Makefile if go.mk is included)
endif
GO_RELEASE_PACKAGE_NAME ?= main
.PHONY: compile
## Compiling for every OS and Platform
compile: next-patch-version
$(ECHOMARKER) "Compiling for every OS and Platform"
$(ECHO) "Version: $(PROJECT_VERSION)"
$(ECHO) "Build: $(PROJECT_BUILD_DATE)"
$(QUIET) cd $(SOURCE_PATH) ; \
GO111MODULE=on GOOS=linux GOARCH=arm $(GO) build -ldflags "-X $(GO_RELEASE_PACKAGE_NAME).version=$(PROJECT_VERSION) -X $(GO_RELEASE_PACKAGE_NAME).build=$(PROJECT_BUILD_DATE)" -o $(BUILD_PATH)$(COMPONENT_SLUG)-linux-arm ; \
GOOS=linux GOARCH=amd64 $(GO) build -ldflags "-X $(GO_RELEASE_PACKAGE_NAME).version=$(PROJECT_VERSION) -X $(GO_RELEASE_PACKAGE_NAME).build=$(PROJECT_BUILD_DATE)" -o $(BUILD_PATH)$(COMPONENT_SLUG)-linux-amd64 ; \
GOOS=linux GOARCH=arm64 $(GO) build -ldflags "-X $(GO_RELEASE_PACKAGE_NAME).version=$(PROJECT_VERSION) -X $(GO_RELEASE_PACKAGE_NAME).build=$(PROJECT_BUILD_DATE)" -o $(BUILD_PATH)$(COMPONENT_SLUG)-linux-arm64 ; \
GOOS=linux GOARCH=386 $(GO) build -ldflags "-X $(GO_RELEASE_PACKAGE_NAME).version=$(PROJECT_VERSION) -X $(GO_RELEASE_PACKAGE_NAME).build=$(PROJECT_BUILD_DATE)" -o $(BUILD_PATH)$(COMPONENT_SLUG)-linux-386 ; \
GOOS=windows GOARCH=amd64 $(GO) build -ldflags "-X $(GO_RELEASE_PACKAGE_NAME).version=$(PROJECT_VERSION) -X $(GO_RELEASE_PACKAGE_NAME).build=$(PROJECT_BUILD_DATE)" -o $(BUILD_PATH)$(COMPONENT_SLUG)-windows ; \
cd $(PROJECT_ROOT);
#############################################################################################
#############################################################################################
##
## GET LICENSES
##
#############################################################################################
#############################################################################################
ifeq ($(GO),)
$(error $(ERRORMARKER) Go is not defined, check your Makefile if go.mk is included)
endif
GO_MOD_FILE := $(SOURCE_PATH)go.mod
GO_LICENSES_BIN := $(shell command -v go-licenses)
ifeq ($(GO_LICENSES_BIN),)
$(shell $(GO) install github.com/google/go-licenses@latest)
GO_LICENSES_BIN := $(shell command -v go-licenses 2> /dev/null)
EXECUTABLES = $(EXECUTABLES:-) go-licenses;
endif
ifeq ($(shell test -e $(GO_MOD_FILE) && echo -n yes),yes)
GO_CURRENT_MODULE := $(shell cat $(GO_MOD_FILE) | head -n1 | cut -d" " -f2)
endif
.PHONY: go-fetch-licenses
## Fetch licenses for all modules
go-fetch-licenses:
ifeq ($(GO_CURRENT_MODULE),)
$(QUIET) $(ECHOERRORMARKER) "no go.mod file found, skipping fetching licenses"
else
$(ECHOMARKER) "Fetch licenses"
$(QUIET) cd $(SOURCE_PATH); $(GO_LICENSES_BIN) save $(GO_CURRENT_MODULE) $(GO_LICENSES_IGNORE_PACKAGES) --force --save_path $(DOCUMENTATION_PATH)licenses/ ; cd -
endif
#############################################################################################
#############################################################################################
##
## HELP-TARGETS
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.DEFAULT_GOAL := help
.PHONY: print
## Print Path
print:
$(ECHO) "THIS_MAKEFILE: $(THIS_MAKEFILE)"
$(ECHO) "THIS_MAKEFILE_PATH: $(THIS_MAKEFILE_PATH)"
$(ECHO) "PROJECT_ROOT: $(PROJECT_ROOT)"
# Add a comment to the public targets so that it appears
# in this help Use two # characters for a help comment
.PHONY: help
help:
@printf "${COMMENT}Usage:${RESET}\n"
@printf " make [target] [arg=\"val\"...]\n\n"
@printf "${COMMENT}Available targets:${RESET}\n"
@awk '/^[a-zA-Z\-\\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${INFO}%-22s${RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
@printf "\n${COMMENT}Available arguments:${RESET}\n\n"
@awk '/^(([a-zA-Z\-\\_0-9\.@]+)\s[?:]?=)/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${INFO}%-22s${RESET} %s (Default: %s)\n", $$1, helpMessage, $$3; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
#############################################################################################
#############################################################################################
##
## INIT-STANDARD
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-go-lib
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init go lib project
init-go-lib: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE
$(ECHOMARKER) "Run init-go-lib"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## INIT-STANDARD
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-go-utilities
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init go utilities project
init-go-utilities: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE
$(ECHOMARKER) "Run init-go-utilities"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## INIT-WEBCOMPONENTS
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-platform-part
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init standard project
init-platform-part: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(PROJECT_ROOT)package.json $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE
$(ECHOMARKER) "Run init-webapp"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## BUILD PACKAGE JSON
##
#############################################################################################
#############################################################################################
define PLATFORM_PARTS_BUILD_PACKAGE_CONTENT
{
"name": "@alvine/$(COMPONENT_SLUG)",
"version": "0.1.0",
"description": "$(COMPONENT_NAME)",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/alvine/application/platform-apps/parts/$(COMPONENT_SLUG).git"
},
"scripts": {
"build-and-publish": "script/build-and-publish.sh",
"semantic-release": "semantic-release",
"build": "vite --config ./vite.config.js build",
"preview": "vite --config ./vite.config.js preview",
"dev": "vite --config ./vite.config.js"
},
"type": "module",
"author": "schukai GmbH",
"license": "see LICENSE file",
"dependencies": {
"@schukai/component-form": "^2.0.2",
"@schukai/component-notify": "^2.0.0",
"@schukai/component-state": "^2.0.1",
"@schukai/component-style": "^0.6.1",
"@schukai/monster": "^2.0.16"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.4.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/gitlab": "^9.4.2",
"cli-real-favicon": "^0.0.8",
"@semantic-release/npm": "^9.0.1",
"autoprefixer": "^10.4.13",
"btoa": "^1.2.1",
"c8": "^7.12.0",
"chai": "^4.3.6",
"glob": "^8.0.3",
"chai-dom": "^1.11.0",
"clean-jsdoc-theme": "^4.1.6",
"create-polyfill-service-url": "^2.2.6",
"crypt": "^0.0.2",
"cssnano": "^5.1.14",
"esbuild": "^0.14.53",
"flow-bin": "^0.184.0",
"fs": "^0.0.1-security",
"graphviz": "^0.0.9",
"jsdoc": "^3.6.11",
"jsdoc-external-example": "github:volker-schukai/jsdoc-external-example",
"jsdom": "^19.0.0",
"jsdom-global": "^3.0.2",
"mocha": "^10.0.0",
"postcss": "^8.4.19",
"postcss-color-mod-function": "^3.0.3",
"postcss-fluid": "^1.4.2",
"postcss-for": "^2.1.1",
"postcss-import": "^15.0.0",
"postcss-mixins": "^9.0.4",
"postcss-nesting": "^10.2.0",
"postcss-normalize": "^10.0.1",
"postcss-responsive-type": "^1.0.0",
"postcss-strip-units": "^2.0.1",
"process": "^0.11.10",
"semantic-release": "^19.0.5",
"sinon": "^14.0.0",
"url": "^0.11.0",
"url-exist": "3.0.0",
"util": "^0.12.4",
"vite": "^3.2.3",
"vite-plugin-banner": "^0.6.1",
"vite-plugin-mkcert": "^1.10.1",
"vite-plugin-minify": "^1.5.2"
}
}
endef
export PLATFORM_PARTS_BUILD_PACKAGE_CONTENT
$(PROJECT_ROOT)package.json:
$(QUIET) $(ECHO) "$$PLATFORM_PARTS_BUILD_PACKAGE_CONTENT" >> $@
######
#############################################################################################
#############################################################################################
##
## INIT-STANDARD
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-standard
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init standard project
init-standard: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE
$(ECHOMARKER) "Run init-standard"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## INIT-WEBCOMPONENTS
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: init-webcomponent
# The default directories are defined in the
# directories-standard.mk file, but all other
# targets can define directories as well.
$(PROJECT_DIRECTORIES):
$(foreach path,$(PROJECT_DIRECTORIES),\
$(shell $(MKDIR) -p $(path)))
## init standard project
init-webcomponent: $(PROJECT_DIRECTORIES) $(PROJECT_ROOT).gitignore $(DEVELOPMENT_PATH)package.json $(APPLICATION_PATH)package.json $(PROJECT_ROOT)README.md $(LICENSE_PATH)LICENSE $(APPLICATION_PATH)LICENSE
$(ECHOMARKER) "Run init-webcomponent"
$(ECHO) "Done"
#############################################################################################
#############################################################################################
##
## LICENSE
##
#############################################################################################
#############################################################################################
export LICENSE_FILE_CONTENT
$(LICENSE_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_FILE_CONTENT" >> $@
export LICENSE_AGPL_FILE_CONTENT
$(APPLICATION_PATH)LICENSE:
$(QUIET) $(ECHO) "$$LICENSE_AGPL_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## README
##
#############################################################################################
#############################################################################################
export README_FILE_CONTENT
$(PROJECT_ROOT)README.md:
$(QUIET) $(ECHO) "$$README_FILE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## PACKAGE JSON
##
#############################################################################################
#############################################################################################
define WEBCOMPONENTS_PACKAGE_CONTENT
{
"name": "component-$(COMPONENT_SLUG)",
"version": "0.1.0",
"description": "component $(COMPONENT_NAME)",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/libraries/javascript/web-components/$(COMPONENT_SLUG).git"
},
"keywords": [
"web",
"dom",
"css",
"mobile-first",
"app",
"front-end",
"ui",
"form",
"templates",
"schukai",
"component",
"web-component",
"monster"
],
"dependencies": {
"@popperjs/core": "^2.9.2",
"@schukai/monster": "^2.0.8"
},
"main": "source/component.mjs",
"module": "source/component.mjs",
"type": "module",
"homepage": "https://monsterjs.org/",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/libraries/javascript/web-components/$(COMPONENT_SLUG).git"
},
"author": "schukai GmbH",
"license": "AGPL 3.0"
}
endef
export WEBCOMPONENTS_PACKAGE_CONTENT
$(APPLICATION_PATH)package.json:
$(QUIET) $(ECHO) "$$WEBCOMPONENTS_PACKAGE_CONTENT" >> $@
#############################################################################################
#############################################################################################
##
## BUILD PACKAGE JSON
##
#############################################################################################
#############################################################################################
define WEBCOMPONENTS_BUILD_PACKAGE_CONTENT
{
"name": "component-$(COMPONENT_SLUG)",
"version": "0.1.0",
"description": "component $(COMPONENT_NAME)",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/libraries/javascript/web-components/$(COMPONENT_SLUG).git"
},
"scripts": {
"test": "npx mocha --recursive test/cases/",
"web-test": "script/web-test.sh",
"publish": "script/release-and-publish.sh",
"build-doc": "script/build-doc.sh"
},
"type": "module",
"author": "schukai GmbH",
"license": "see LICENSE file",
"dependencies": {
"@popperjs/core": "^2.11.2",
"@schukai/monster": "^2.0.8"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.4.0",
"btoa": "^1.2.1",
"c8": "^7.12.0",
"chai": "^4.3.6",
"chai-dom": "^1.11.0",
"clean-jsdoc-theme": "^4.1.6",
"create-polyfill-service-url": "^2.2.6",
"crypt": "^0.0.2",
"esbuild": "^0.14.53",
"flow-bin": "^0.184.0",
"fs": "^0.0.1-security",
"graphviz": "^0.0.9",
"jsdoc": "^3.6.11",
"jsdoc-external-example": "github:volker-schukai/jsdoc-external-example",
"jsdoc-plantuml": "^1.0.2",
"jsdom": "^19.0.0",
"jsdom-global": "^3.0.2",
"mocha": "^10.0.0",
"node-plantuml": "^0.9.0",
"sinon": "^14.0.0",
"url": "^0.11.0",
"url-exist": "3.0.0",
"util": "^0.12.4"
}
}
endef
export WEBCOMPONENTS_BUILD_PACKAGE_CONTENT
$(DEVELOPMENT_PATH)package.json:
$(QUIET) $(ECHO) "$$WEBCOMPONENTS_BUILD_PACKAGE_CONTENT" >> $@
######
#############################################################################################
#############################################################################################
##
## JEKYLL-TARGETS
##
#############################################################################################
#############################################################################################
JEKYLL_VERSION := snapshot
JEKYLL_BIN := $(ALVINE_VENDOR_PATH)jekyll-$(JEKYLL_VERSION).phar
JEKYLL_PUBKEY := $(JEKYLL_BIN).pubkey
$(JEKYLL_PUBKEY):
$(MKDIR) -p $(ALVINE_VENDOR_PATH)
$(WGET) -O $(JEKYLL_PUBKEY) http://download.alvine.io/phar/jekyll-$(JEKYLL_VERSION).phar.pubkey
$(JEKYLL_BIN): $(JEKYLL_PUBKEY)
$(MKDIR) -p $(ALVINE_VENDOR_PATH)
$(WGET) -O $(JEKYLL_BIN) http://download.alvine.io/phar/jekyll-$(JEKYLL_VERSION).phar
$(CHMOD) u+x $(JEKYLL_BIN)
.PHONY: run-jekyll
## run jekyll
run-jekyll: init $(JEKYLL_BIN) $(JEKYLL_PUBKEY) $(TEMP_PATH)jekyll.lock
$(ECHOMARKER) "Jekyll finished"
.PHONY: run-jekyll-force
## run jekyll (-f)
run-jekyll-force: init $(JEKYLL_BIN) $(JEKYLL_PUBKEY)
$(RM) $(TEMP_PATH)jekyll.lock
$(MAKE) run-jekyll
$(ECHOMARKER) "Jekyll finished"
$(TEMP_PATH)jekyll.lock: $(THIS_DIR).jekyll
$(ECHOMARKER) "Run Jekyll"
$(JEKYLL_BIN) fetch --force
$(JEKYLL_BIN) update
touch $(TEMP_PATH)jekyll.lock
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## JSDOC-TARGETS
##
#############################################################################################
#############################################################################################
FIXBROKENPLANTUML := $(NODE_MODULES_DIR)jsdoc-plantuml/fixBrokenNodeJS.js
.PHONY: jsdoc-build
## generate js api docs
jsdoc-build: $(DOCUMENTATION_CONFIG_PATH)jsdoc.json $(FIXBROKENPLANTUML).fixed
$(ECHOMARKER) "create api doc"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run build-doc
$(FIXBROKENPLANTUML).fixed:
$(ECHOMARKER) "fix broken plantuml"
$(QUIET) chmod u+x $(FIXBROKENPLANTUML)
$(QUIET) $(NODE) $(FIXBROKENPLANTUML)
$(QUIET) $(TOUCH) $(FIXBROKENPLANTUML).fixed
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## BUILD NODE
##
#############################################################################################
#############################################################################################
SPONGE ?= sponge
EXECUTABLES = $(EXECUTABLES:-) $(SPONGE);
.PHONY: node-build
## Build Node Components
node-build: $(NODE_MODULES_MODIFIED) $(NODE_PACKAGES)
$(ECHOMARKER) "Building Node Components"
$(ECHO) "Version: $(PROJECT_VERSION)"
$(ECHO) "Source Path: $(SOURCE_PATH)"
$(QUIET) $(JQ) '.version = "$(PROJECT_VERSION)"' $(PACKAGE_JSON) | $(SPONGE) $(PACKAGE_JSON)
$(QUIET) for p in $(NODE_PACKAGES); do $(JQ) '.version = "$(PROJECT_VERSION)"' $${p} | $(SPONGE) $${p}; done
$(QUIET) $(SCRIPTS_PATH)update-version.sh
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run --if-present build
#############################################################################################
#############################################################################################
##
## BUILD NODE
##
#############################################################################################
#############################################################################################
.PHONY: node-test
## Test JS Components
node-test: $(NODE_MODULES_MODIFIED)
$(ECHOMARKER) "Test Node Components"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run test
.PHONY: node-web-test
## Test JS Components
node-web-test: $(NODE_MODULES_MODIFIED)
$(ECHOMARKER) "Test Node Components"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run web-test
#############################################################################################
#############################################################################################
##
## NPM
##
#############################################################################################
#############################################################################################
.PHONY: npm-publish-major
## release major version of package
npm-publish-major:
$(ECHOMARKER) "release major version"
$(QUIET) $(MAKE) tag-major-version
$(QUIET) $(MAKE) node-build
$(QUIET) $(MAKE) node-test
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run publish
.PHONY: npm-publish-minor
## release minor version of package
npm-publish-minor:
$(ECHOMARKER) "release minor version"
$(QUIET) $(MAKE) tag-minor-version
$(QUIET) $(MAKE) node-build
$(QUIET) $(MAKE) node-test
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run publish
.PHONY: npm-publish-patch
## release patch version of package
npm-publish-patch:
$(ECHOMARKER) "release patch version"
$(QUIET) $(MAKE) tag-patch-version
$(QUIET) $(MAKE) node-build
$(QUIET) $(MAKE) node-test
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run publish
#############################################################################################
#############################################################################################
##
## RUN NPM BUILD, TEST AND DEV TASKS
##
#############################################################################################
#############################################################################################
.PHONY: npm-dev
## run npm dev server
npm-dev:
$(ECHOMARKER) "start npm dev server"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run dev
.PHONY: npm-build
## build npm project
npm-build:
$(ECHOMARKER) "build npm project"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run build
.PHONY: npm-preview
## preview npm project
npm-preview:
$(ECHOMARKER) "preview npm project"
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run build
$(QUIET) $(NPM) --prefix $(NODE_ROOT_DIR) run preview
#############################################################################################
#############################################################################################
##
## PHPUNIT
##
#############################################################################################
#############################################################################################
# path and binaries
PARALLEL ?= parallel
EXECUTABLES = $(EXECUTABLES:-) $(PARALLEL);
PHPUNIT_PATH := $(VENDOR_PATH)phpunit/
PHPUNIT_BIN := $(PHPUNIT_PATH)phpunit
PHPUNIT_SCRIPT_PATH := $(BUILD_PATH)/script
ifeq ($(shell command -v $(PARALLEL) 2> /dev/null),)
$(error "parallel is not installed. Please install parallel")
endif
ifneq ($(shell test -d $(PHPUNIT_SCRIPT_PATH) && echo -n yes),yes)
$(shell mkdir -p $(PHPUNIT_SCRIPT_PATH))
endif
define UNITTEST_SH_SCRIPT
#!/bin/bash
BIN=$$1
BOOTSTRAP=$$2
CONFIG=$$3
TESTFILES=$$4
export DOCOVERAGE=true
groups=$$($${BIN} \
--list-groups \
--bootstrap $${BOOTSTRAP} \
--configuration $${CONFIG} \
development/tests/ | sed -n -e '/^ - /p' | cut -d"-" -f2 | tr -d ' ')
parallel \
$${BIN} \
--group {} \
--configuration $${CONFIG} \
--whitelist application/source/ \
--bootstrap $${BOOTSTRAP} \
$${TESTFILES} ::: $${groups}
endef
export UNITTEST_SH_SCRIPT
$(PHPUNIT_SCRIPT_PATH)/unittests.sh:
$(QUIET) $(ECHO) "$$UNITTEST_SH_SCRIPT" >> $@
$(CHMOD) u+x $(PHPUNIT_SCRIPT_PATH)/unittests.sh
$(PHPUNIT_BIN):
$(MKDIR) -p $(PHPUNIT_PATH)
$(WGET) -O $(PHPUNIT_BIN) https://phar.phpunit.de/phpunit-9.phar
$(CHMOD) u+x $(PHPUNIT_BIN)
$(CHMOD) u+x $(PHPUNIT_SCRIPT_PATH)/unittests.sh
.PHONY: run-phpunit-tests
## run PHPUNIT Tests
run-phpunit-tests: $(PHPUNIT_SCRIPT_PATH)/unittests.sh $(PHPUNIT_BIN)
$(BUILD_SCRIPTS_PATH)unittests.sh "$(PHPUNIT_BIN)" "$(TEST_PATH)script/bootstrap.inc.php" "$(TEST_PATH)config/phpunit.xml" "$(TEST_PATH)"
#############################################################################################
#############################################################################################
##
## REQMAN-TARGETS
##
#############################################################################################
#############################################################################################
# @TODO not working, check if this is a bug in this definition!!!
ifeq ($(REQMAN_BIN),)
$(error "$(REQMAN_BIN) is not installed. Please check your makefile and include the reqman.mk")
endif
$(REQMAN_BIN):
$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
$(QUIET) $(WGET) -O $(REQMAN_BIN) http://download.schukai.com/tools/reqman/reqman-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
$(QUIET) $(CHMOD) u+x $(REQMAN_BIN)
$(PROJECT_ROOT)deployment/build/manual.html: $(DOCMAN_BIN)
$(REQMAN_BIN) print html --config $(PROJECT_ROOT)requirement/config.yaml
$(PROJECT_ROOT)deployment/build/manual.pdf: $(DOCMAN_BIN)
$(REQMAN_BIN) print pdf --config $(PROJECT_ROOT)requirement/config.yaml
.PHONY: build-req-pdf
## creating the requirement in pdf format
build-req-pdf: $(PROJECT_ROOT)deployment/build/requirement.pdf
.PHONY: build-req-html
## creating the requirement in html format
build-req-html: $(PROJECT_ROOT)deployment/build/requirement.html
.PHONY: build-req
## creating the requirement in pdf and html format
build-req: build-req-pdf build-req-html
#############################################################################################
#############################################################################################
##
## INIT-TARGETS
##
#############################################################################################
#############################################################################################
ifeq ($(GIT),)
$(error $(ERRORMARKER) Git is not defined, check your Makefile if git.mk is included)
endif
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY: update-makefiles
ifeq ($(QUIET),)
_COPYVERBOSE = -v
endif
## update standard makefiles
update-makefiles:
$(ECHOMARKER) "update standard makefiles"
$(QUIET) $(eval TEMPD := $(shell mktemp -d))
$(QUIET) $(GIT) clone --quiet --depth=1 https://gitlab.schukai.com/schukai/utilities/makefile.git/ "$(TEMPD)"
$(QUIET) $(CP) -r $(_COPYVERBOSE) $(TEMPD)/makefiles/* $(MAKEFILE_IMPORT_PATH)
$(QUIET) $(CP) -r $(_COPYVERBOSE) $(TEMPD)/Makefile $(PROJECT_ROOT)Makefile.example
$(QUIET) $(RM) -rf $(TEMPD)