This commit is contained in:
Hao Liu
2023-02-27 18:48:48 -05:00
parent 3316cfab3a
commit dd41f4e2e6
3 changed files with 36 additions and 37 deletions

View File

@@ -6,7 +6,7 @@ recursive-include awx/templates *.html
recursive-include awx/api/templates *.md *.html *.yml
recursive-include awx/ui/build *.html
recursive-include awx/ui/build *
recursive-include awx/ui_next/src/build *
recursive-include awx/ui_next/build *
recursive-include awx/playbooks *.yml
recursive-include awx/lib/site-packages *
recursive-include awx/plugins *.ps1

View File

@@ -85,7 +85,7 @@ USE_TZ = True
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'ui', 'build', 'static'),
os.path.join(BASE_DIR, 'ui_next', 'src', 'build'),
os.path.join(BASE_DIR, 'ui_next', 'build'),
os.path.join(BASE_DIR, 'static'),
]
@@ -298,7 +298,7 @@ TEMPLATES = [
os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'ui', 'build'),
os.path.join(BASE_DIR, 'ui', 'public'),
os.path.join(BASE_DIR, 'ui_next', 'src', 'build', 'awx'),
os.path.join(BASE_DIR, 'ui_next', 'build', 'awx'),
],
},
]

View File

@@ -1,80 +1,79 @@
ui_next_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
ui_next_dir := $(shell realpath --relative-to $(CURDIR) $(dir $(ui_next_mkfile_path)))
UI_NEXT_MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
UI_NEXT_DIR := $(shell realpath --relative-to $(CURDIR) $(dir $(UI_NEXT_MKFILE_PATH)))
ANSIBLE_UI_DIR ?= $(ui_next_dir)/src
UI_NEXT_SRC_DIR := $(UI_NEXT_DIR)/src
ANSIBLE_UI_GIT_REPO_HTTPS ?=
ANSIBLE_UI_GIT_REPO_SSH ?=
ANSIBLE_UI_GIT_BRANCH ?= main
UI_NEXT_SRC_GIT_REPO_HTTPS ?=
UI_NEXT_SRC_GIT_REPO_SSH ?=
UI_NEXT_SRC_GIT_BRANCH ?= main
ANSIBLE_UI_LOCAL ?=
UI_NEXT_LOCAL ?=
.PHONY: ui_next/clone-https
## Shallow clone the ui_next repo via https skip if ANSIBLE_UI_GIT_REPO_HTTPS is undefined
## Shallow clone the ui_next repo via https skip if UI_NEXT_SRC_GIT_REPO_HTTPS is undefined
ui_next/clone-https:
@if [ -z "$(ANSIBLE_UI_GIT_REPO_HTTPS)" ]; then \
echo "SKIP: ui_next/clone-https. ANSIBLE_UI_GIT_REPO_HTTPS is not set."; \
elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \
echo "SKIP: ui_next/clone-https. $(ANSIBLE_UI_DIR) already exists."; \
@if [ -z "$(UI_NEXT_SRC_GIT_REPO_HTTPS)" ]; then \
echo "SKIP: ui_next/clone-https. UI_NEXT_SRC_GIT_REPO_HTTPS is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \
echo "SKIP: ui_next/clone-https. $(UI_NEXT_SRC_DIR) already exists."; \
else \
git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_HTTPS) $(ANSIBLE_UI_DIR) || true; \
git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_HTTPS) $(UI_NEXT_SRC_DIR) || true; \
fi
.PHONY: ui_next/clone-ssh
## Shallow clone the ui_next repo via ssh.
ui_next/clone-ssh:
@if [ -z "$(ANSIBLE_UI_GIT_REPO_SSH)" ]; then \
echo "SKIP: ui_next/clone-ssh. ANSIBLE_UI_GIT_REPO_SSH is not set."; \
elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \
echo "SKIP: ui_next/clone-ssh. $(ANSIBLE_UI_DIR) already exists."; \
@if [ -z "$(UI_NEXT_SRC_GIT_REPO_SSH)" ]; then \
echo "SKIP: ui_next/clone-ssh. UI_NEXT_SRC_GIT_REPO_SSH is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \
echo "SKIP: ui_next/clone-ssh. $(UI_NEXT_SRC_DIR) already exists."; \
else \
git clone --depth 1 --branch $(ANSIBLE_UI_GIT_BRANCH) $(ANSIBLE_UI_GIT_REPO_SSH) $(ANSIBLE_UI_DIR) || true; \
git clone --depth 1 --branch $(UI_NEXT_SRC_GIT_BRANCH) $(UI_NEXT_SRC_GIT_REPO_SSH) $(UI_NEXT_SRC_DIR) || true; \
fi
.PHONY: ui_next/link-local
## Link to a existing local clone of ui_next repo.
ui_next/link-local:
@if [ -z "$(ANSIBLE_UI_LOCAL)" ]; then \
echo "SKIP: ui_next/link-local. ANSIBLE_UI_LOCAL is not set."; \
elif [ -d "$(ANSIBLE_UI_DIR)" ]; then \
echo "SKIP: ui_next/link-local. $(ANSIBLE_UI_DIR) already exists."; \
@if [ -z "$(UI_NEXT_LOCAL)" ]; then \
echo "SKIP: ui_next/link-local. UI_NEXT_LOCAL is not set."; \
elif [ -d "$(UI_NEXT_SRC_DIR)" ]; then \
echo "SKIP: ui_next/link-local. $(UI_NEXT_SRC_DIR) already exists."; \
else \
ln -s $(ANSIBLE_UI_LOCAL) $(ANSIBLE_UI_DIR); \
ln -s $(UI_NEXT_LOCAL) $(UI_NEXT_SRC_DIR); \
fi
.PHONY: ui_next
## Try to link to a local clone of ui_next repo if it exist otherwise clone via ssh than https.
ui_next:
@if [ -d "$(ANSIBLE_UI_DIR)" ]; then \
echo "SKIP: ui_next. $(ANSIBLE_UI_DIR) already exists."; \
@if [ -d "$(UI_NEXT_SRC_DIR)" ]; then \
echo "SKIP: ui_next. $(UI_NEXT_SRC_DIR) already exists."; \
else \
$(MAKE) ui_next/link-local ui_next/clone-ssh ui_next/clone-https; \
fi
## Alias for ui_next, will not run if ui_next already exist
$(ANSIBLE_UI_DIR):
$(UI_NEXT_SRC_DIR):
$(MAKE) ui_next
.PHONY: ui_next/build
## Build ui_next
ui_next/build: ui_next
cd $(ANSIBLE_UI_DIR) && \
cd $(UI_NEXT_SRC_DIR) && \
npm install webpack && \
npm run build:awx
npm run build:awx && \
mv build ../
## Alias for ui_next/build, will not run if build already exist
$(ANSIBLE_UI_DIR)/build:
$(UI_NEXT_DIR)/build:
$(MAKE) ui_next/build
.PHONY: ui_next/clean
## Clean ui_next
ui_next/clean:
rm -rf $(UI_NEXT_BUILD_FLAG_FILE)
rm -rf $(ANSIBLE_UI_DIR)
ui_next/clean: ui_next/clean/build
rm -rf $(UI_NEXT_SRC_DIR)
.PHONY: ui_next/clean/build
## Clean ui_next build
ui_next/clean/build:
rm -rf $(UI_NEXT_BUILD_FLAG_FILE)
rm -rf $(ANSIBLE_UI_DIR)/build
rm -rf $$(UI_NEXT_DIR)/build