Skip to content

Commit

Permalink
ucc_ui_lib: update build scripts and circle ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
harshpatel-crest committed Feb 25, 2021
1 parent ef5c95a commit a949f40
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 36 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
- poetry-cache-{{ checksum "poetry.lock" }}
- restore_cache:
keys:
- npm-deps-{{ checksum "splunk_add_on_ucc_framework/UCC-UI-lib/package-lock.json" }}
- yarn-packages-{{ checksum "splunk_add_on_ucc_framework/ucc_ui_lib/yarn.lock" }}
- run:
name: Install Tools
command: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
mkdir ~/.npm-global || true
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm install -g bower
npm install -g yarn
- run:
name: Build
command: |
Expand All @@ -38,7 +38,7 @@ jobs:
- save_cache:
paths:
- ~/.npm-global # location depends on npm version
key: npm-deps-{{ checksum "splunk_add_on_ucc_framework/UCC-UI-lib/package-lock.json" }}
key: yarn-packages-{{ checksum "splunk_add_on_ucc_framework/ucc_ui_lib/yarn.lock" }}
- store_artifacts:
path: dist
- store_artifacts:
Expand Down Expand Up @@ -80,15 +80,15 @@ jobs:
- poetry-cache-{{ checksum "poetry.lock" }}
- restore_cache:
keys:
- npm-deps-{{ checksum "splunk_add_on_ucc_framework/UCC-UI-lib/package-lock.json" }}
- yarn-packages-{{ checksum "splunk_add_on_ucc_framework/ucc_ui_lib/yarn.lock" }}
- run:
name: Install Tools
command: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
mkdir ~/.npm-global || true
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm install -g bower
npm install -g yarn
- run:
name: Build
command: |
Expand All @@ -105,7 +105,7 @@ jobs:
- save_cache:
paths:
- ~/.npm-global # location depends on npm version
key: npm-deps-{{ checksum "splunk_add_on_ucc_framework/UCC-UI-lib/package-lock.json" }}
key: yarn-packages-{{ checksum "splunk_add_on_ucc_framework/ucc_ui_lib/yarn.lock" }}
- store_artifacts:
path: dist
- store_artifacts:
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@
package/.idea
.idea/
*.log
splunk_add_on_ucc_framework/UCC-UI-lib/node_modules/*
splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/SplunkWebCore/node_modules/*
splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/lodash/*
splunk_add_on_ucc_framework/UCC-UI-lib/build/*
dist/*

*.egg-info
output
splunk_add_on_ucc_framework/UCC-UI-lib/bower_components/SplunkWebCore/npm-shrinkwrap.json
tests/.DS_Store
pip-wheel-metadata/UNKNOWN.dist-info/top_level.txt
pip-wheel-metadata/UNKNOWN.dist-info/METADATA
Expand Down
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Source: https://github.com/splunk/addonfactory-ucc-generator
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
Files: splunk_add_on_ucc_framework/UCC-UI-lib/*
Files: splunk_add_on_ucc_framework/ucc_ui_lib/*
Copyright: 202 Splunk Inc. <addonfactory@splunk.com>
License: Apache-2.0

Expand Down
23 changes: 3 additions & 20 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,16 @@
import os
import shutil

def setup_env():
logger.info("Setting up Environment")
install_npm_dependencies = "npm install -g bower"
os.system(install_npm_dependencies)
os.chdir(os.path.join(sourcedir, "UCC-UI-lib", "bower_components", "SplunkWebCore"))
os.system("npm install")



def generate_static_files():
logger.info("Generating Static files")
os.chdir(os.path.join(sourcedir, "UCC-UI-lib"))
os.system("npm install")
os.system("bower install")
os.system("npm run build")
src = os.path.join(sourcedir, "UCC-UI-lib", "package", "appserver", "templates", "redirect.html")
dest = os.path.join(sourcedir, "UCC-UI-lib", "build", "appserver", "templates", "redirect.html")
shutil.copy(src, dest)
src = os.path.join(sourcedir, "UCC-UI-lib", "data", "redirect_page.js")
dest = os.path.join(sourcedir, "UCC-UI-lib", "build", "appserver", "static", "js", "build", "redirect_page.js")
shutil.copy(src, dest)
os.chdir(os.path.join(sourcedir, "ucc_ui_lib"))
os.system("yarn run setup")


def migrate_package():
logger.info("Exporting generated Package.")
src = os.path.join(os.path.join(sourcedir, "UCC-UI-lib", "build"))
src = os.path.join(os.path.join(sourcedir, "ucc_ui_lib", "stage"))
dest = os.path.join(os.path.join(sourcedir, "package"))
if os.path.exists(dest):
shutil.rmtree(dest, ignore_errors=True)
Expand All @@ -41,6 +25,5 @@ def migrate_package():


def build_ucc():
setup_env()
generate_static_files()
migrate_package()
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ description = "Splunk Add-on SDK formerly UCC is a build and code generation fra
authors = ["rfaircloth-splunk <rfaircloth@splunk.com>"]
exclude = [
"build.py",
"splunk_add_on_ucc_framework/UCC-UI-lib/bower_components",
"splunk_add_on_ucc_framework/UCC-UI-lib/config",
"splunk_add_on_ucc_framework/UCC-UI-lib/node_modules",
"splunk_add_on_ucc_framework/UCC-UI-lib/testes",
"splunk_add_on_ucc_framework/ucc_ui_lib/",
]
include = [
"splunk_add_on_ucc_framework/package",
Expand Down

0 comments on commit a949f40

Please sign in to comment.