try to add awx/ui_next/build dir

This commit is contained in:
Hao Liu
2023-03-07 21:34:29 -05:00
parent c312351134
commit 1b4d95b3b1
2 changed files with 47 additions and 23 deletions

2
.gitignore vendored
View File

@@ -157,10 +157,10 @@ use_dev_supervisor.txt
*.unison.tmp *.unison.tmp
*.# *.#
/awx/ui/.ui-built /awx/ui/.ui-built
/awx/ui_next/.ui-built
/Dockerfile /Dockerfile
/_build/ /_build/
/_build_kube_dev/ /_build_kube_dev/
/Dockerfile.kube-dev /Dockerfile.kube-dev
awx/ui_next/src awx/ui_next/src
awx/ui_next/build

View File

@@ -1,12 +1,21 @@
## UI_NEXT_MKFILE_PATH: Path to this Makefile
UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
UI_NEXT_MKFILE_DIR := $(dir $(UI_NEXT_MKFILE_PATH))
UI_NEXT_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_MKFILE_DIR))
# NOTE: UI_NEXT_DIR swallowed the / because we want to be able to run `make src` from the ui_next dir ## UI_NEXT_DIR_ABS: Absolute path to the directory containing this Makefile
UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)src UI_NEXT_DIR_ABS := $(dir $(UI_NEXT_MKFILE_PATH))
UI_NEXT_BUILD_DIR := $(UI_NEXT_DIR)build
# Path to your local clone of the UI_NEXT repo ## UI_NEXT_REL_DIR: Relative path to the directory containing this Makefile
# NOTE: UI_NEXT_REL_DIR swallowed the / because we want to be able to run `make src` from the ui_next dir
UI_NEXT_REL_DIR := $(subst $(CURDIR)/,, $(UI_NEXT_DIR_ABS))
## UI_NEXT_SRC_DIR: Path to the ui_next src directory
UI_NEXT_SRC_DIR := $(UI_NEXT_REL_DIR)src
## UI_NEXT_BUILD_DIR: Path to the ui_next build directory
UI_NEXT_BUILD_DIR := $(UI_NEXT_REL_DIR)build
## Path to your local clone of the UI_NEXT repo
# NOTE: This does not work with docker-compose development environment
UI_NEXT_LOCAL ?= UI_NEXT_LOCAL ?=
# Git repo and branch to the UI_NEXT repo # Git repo and branch to the UI_NEXT repo
@@ -18,14 +27,14 @@ UI_NEXT_GIT_BRANCH ?= main
# therefore we have to commit the build directory to source control # therefore we have to commit the build directory to source control
# so that make docker-compose will be able to start up uwsgi # so that make docker-compose will be able to start up uwsgi
# UI_NEXT_BUILT_FILE is here so that we can use it as the non-phony build target # UI_NEXT_BUILT_FILE is here so that we can use it as the non-phony build target
UI_NEXT_BUILT_FILE = $(UI_NEXT_DIR).ui-built UI_NEXT_BUILT_FILE = $(UI_NEXT_REL_DIR).ui-built
.PHONY: ui_next/clone-https .PHONY: ui_next/clone-https
## Shallow clone the ui_next repo via https skip if UI_NEXT_GIT_REPO_HTTPS is undefined ## Shallow clone the ui_next repo via https skip if UI_NEXT_GIT_REPO_HTTPS is undefined
ui_next/clone-https: ui_next/clone-https:
@if [ -z "$(UI_NEXT_GIT_REPO_HTTPS)" ]; then \ @if [ -z "$(UI_NEXT_GIT_REPO_HTTPS)" ]; then \
echo "SKIP: ui_next/clone-https. UI_NEXT_GIT_REPO_HTTPS is not set."; \ echo "SKIP: ui_next/clone-https. UI_NEXT_GIT_REPO_HTTPS is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ elif [ -d $(UI_NEXT_SRC_DIR) ]; then \
echo "SKIP: ui_next/clone-https. $(UI_NEXT_SRC_DIR) already exists."; \ echo "SKIP: ui_next/clone-https. $(UI_NEXT_SRC_DIR) already exists."; \
else \ else \
git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \ git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \
@@ -36,18 +45,18 @@ ui_next/clone-https:
ui_next/clone-ssh: ui_next/clone-ssh:
@if [ -z "$(UI_NEXT_GIT_REPO_SSH)" ]; then \ @if [ -z "$(UI_NEXT_GIT_REPO_SSH)" ]; then \
echo "SKIP: ui_next/clone-ssh. UI_NEXT_GIT_REPO_SSH is not set."; \ echo "SKIP: ui_next/clone-ssh. UI_NEXT_GIT_REPO_SSH is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ elif [ -d $(UI_NEXT_SRC_DIR) ]; then \
echo "SKIP: ui_next/clone-ssh. $(UI_NEXT_SRC_DIR) already exists."; \ echo "SKIP: ui_next/clone-ssh. $(UI_NEXT_SRC_DIR) already exists."; \
else \ else \
git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \ git clone --depth 1 --branch $(UI_NEXT_GIT_BRANCH) $(UI_NEXT_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \
fi fi
.PHONY: ui_next/link-local .PHONY: ui_next/link-local
## Link to a existing local clone of ui_next repo. ## Link to a existing local clone of ui_next repo. If method will not be able to build inside docker-compose environment
ui_next/link-local: ui_next/link-local:
@if [ -z "$(UI_NEXT_LOCAL)" ]; then \ @if [ -z "$(UI_NEXT_LOCAL)" ]; then \
echo "SKIP: ui_next/link-local. UI_NEXT_LOCAL is not set."; \ echo "SKIP: ui_next/link-local. UI_NEXT_LOCAL is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ elif [ -d $(UI_NEXT_SRC_DIR) ]; then \
echo "SKIP: ui_next/link-local. $(UI_NEXT_SRC_DIR) already exists."; \ echo "SKIP: ui_next/link-local. $(UI_NEXT_SRC_DIR) already exists."; \
else \ else \
ln -s $(UI_NEXT_LOCAL) $(UI_NEXT_SRC_DIR); \ ln -s $(UI_NEXT_LOCAL) $(UI_NEXT_SRC_DIR); \
@@ -56,30 +65,44 @@ ui_next/link-local:
.PHONY: ui_next/src .PHONY: ui_next/src
## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https. ## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https.
ui_next/src: ui_next/src:
@if [ -d "$(UI_NEXT_SRC_DIR)" ]; then \ @if [ -d $(UI_NEXT_SRC_DIR) ]; then \
echo "SKIP: ui_next. $(UI_NEXT_SRC_DIR) already exists."; \ echo "SKIP: ui_next. $(UI_NEXT_SRC_DIR) already exists."; \
else \ else \
$(MAKE) ui_next/link-local ui_next/clone-ssh ui_next/clone-https; \ $(MAKE) ui_next/link-local ui_next/clone-ssh ui_next/clone-https; \
fi fi
## Alias for ui_next, will not run if ui_next already exist ## Alias for ui_next, will not run if ui_next/src already exist
$(UI_NEXT_SRC_DIR): $(UI_NEXT_SRC_DIR):
$(MAKE) ui_next/src $(MAKE) ui_next/src
$(UI_NEXT_SRC_DIR)/build:
$(MAKE) ui_next/src/build
.PHONY: ui_next/build .PHONY: ui_next/build
## Build ui_next from source ## Build ui_next from source
ui_next/src/build: ui_next/src ui_next/src/build: $(UI_NEXT_SRC_DIR) $(UI_NEXT_SRC_DIR)/node_modules/webpack
cd $(UI_NEXT_SRC_DIR) && \ @cd $(UI_NEXT_SRC_DIR) && npm run build:awx
npm install webpack && \
npm run build:awx
## Install webpack if does not exist.
ui_next/src/node_modules/webpack: $(UI_NEXT_SRC_DIR)
@if [ -d $(UI_NEXT_SRC_DIR)/node_modules/webpack ]; then \
echo "SKIP: ui_next/src/node_modules/webpack. $(UI_NEXT_SRC_DIR)/node_modules/webpack already exists."; \
else \
cd $(UI_NEXT_SRC_DIR) && npm install webpack; \
fi
## Alias for ui_next/src/node_modules/webpack. will not run if webpack already exist
$(UI_NEXT_SRC_DIR)/node_modules/webpack:
$(MAKE) ui_next/src/node_modules/webpack
.PHONY: ui_next/build .PHONY: ui_next/build
## Copy ui_next/src/build to ui_next/build ## Copy ui_next/src/build to ui_next/build
ui_next/build: ui_next/src/build ui_next/build: $(UI_NEXT_SRC_DIR)/build
cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_BUILD_DIR) @cp -r $(UI_NEXT_SRC_DIR)/build $(UI_NEXT_DIR_ABS) &&\
touch $(UI_NEXT_BUILT_FILE) touch $(UI_NEXT_BUILT_FILE)
## non PHONY target for ui_next/build. Will not run if build already exist ## Alias for ui_next/build. Will not run if .ui-built file already exist
$(UI_NEXT_BUILT_FILE): $(UI_NEXT_BUILT_FILE):
$(MAKE) ui_next/build $(MAKE) ui_next/build
@@ -88,8 +111,9 @@ $(UI_NEXT_BUILT_FILE):
$(UI_NEXT_BUILD_DIR): $(UI_NEXT_BUILD_DIR):
$(MAKE) ui_next/build $(MAKE) ui_next/build
## Alias for ui_next/clean .PHONY: $(UI_NEXT_REL_DIR)clean
$(UI_NEXT_DIR)clean: ## Alias for ui_next/clean.
$(UI_NEXT_REL_DIR)clean:
rm -rf $(UI_NEXT_SRC_DIR) rm -rf $(UI_NEXT_SRC_DIR)
rm -rf $(UI_NEXT_BUILD_DIR) rm -rf $(UI_NEXT_BUILD_DIR)