Commit 1446640b authored by totten's avatar totten

CRM-15797 - distmaker - Fixes for JS dependencies:

 * Exclude node_modules
 * Include bower_components
 * Include .json, composer.lock, bower.json, package.json
 * DM_NPM should be optional
parent 40b4b107
......@@ -4,11 +4,15 @@ DM_GENFILESDIR= <Set this to directory where generated files should reside>
DM_TMPDIR= <Set this to temporary directory>
DM_TARGETDIR= <Set this to directory where tarballs should land>
DM_NPM= <Set this to your npm binary>
DM_PHP= <Set this to your php binary>
DM_RSYNC= <set this to your rsync binary>
DM_ZIP= <set this to your zip binary>
## Optional
# DM_NPM= <Set this to your npm binary> [default: npm]
# DM_NODE= <Set this to your node binary> [default: node]
# DM_COMPOSER= <Set this to your composer binary> [default: composer]
DM_VERSION= <Set this to whatever the version number should be>
## Git banch/tag name
......
......@@ -156,9 +156,6 @@ case $1 in
esac
## Install npm packages
dm_npm_install "$DM_SOURCEDIR"
## Make sure we have the right branch or tag
dm_git_checkout "$DM_SOURCEDIR" "$DM_REF_CORE"
dm_git_checkout "$DM_SOURCEDIR/packages" "$DM_REF_PACKAGES"
......@@ -168,6 +165,7 @@ dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL"
## Get latest dependencies
dm_generate_vendor "$DM_SOURCEDIR"
dm_generate_bower "$DM_SOURCEDIR"
# Before anything - regenerate DAOs
......
......@@ -45,17 +45,32 @@ function dm_remove_files() {
done
}
## Copy all bower dependencies
function dm_install_bower() {
local repo="$1"
local to="$2"
local excludes_rsync=""
for exclude in .git .svn {T,t}est{,s} {D,d}oc{,s} {E,e}xample{,s} ; do
excludes_rsync="--exclude=${exclude} ${excludes_rsync}"
done
[ ! -d "$to" ] && mkdir "$to"
$DM_RSYNC -avC $excludes_rsync "$repo/./" "$to/./"
}
## Copy all core files
## usage: dm_install_core <core_repo_path> <to_path>
function dm_install_core() {
local repo="$1"
local to="$2"
for dir in css i js PEAR templates bin CRM api extern Reports install settings Civi partials node_modules bower_components ; do
for dir in css i js PEAR templates bin CRM api extern Reports install settings Civi partials ; do
[ -d "$repo/$dir" ] && dm_install_dir "$repo/$dir" "$to/$dir"
done
dm_install_files "$repo" "$to" {agpl-3.0,agpl-3.0.exception,gpl,README,CONTRIBUTORS}.txt
dm_install_files "$repo" "$to" composer.json composer.lock bower.json package.json
mkdir -p "$to/sql"
pushd "$repo" >> /dev/null
......@@ -146,13 +161,8 @@ function dm_install_vendor() {
excludes_rsync="--exclude=${exclude} ${excludes_rsync}"
done
## Note: These small folders have items that previously were not published,
## but there's no real cost to including them, and excluding them seems
## likely to cause confusion as the codebase evolves:
## packages/Files packages/PHP packages/Text
[ ! -d "$to" ] && mkdir "$to"
$DM_RSYNC -avC $excludes_rsync --include=core "$repo/./" "$to/./"
$DM_RSYNC -avC $excludes_rsync "$repo/./" "$to/./"
}
## usage: dm_install_wordpress <wp_repo_path> <to_path>
......@@ -173,12 +183,23 @@ function dm_install_wordpress() {
## Need --exclude=civicrm for self-building on WP site
}
## Generate the "bower_components" folder.
## usage: dm_generate_bower <repo_path>
function dm_generate_bower() {
local repo="$1"
pushd "$repo"
${DM_NPM:-npm} install
${DM_NODE:-node} node_modules/bower/bin/bower install
popd
}
## Generate the composer "vendor" folder
## usage: dm_generate_vendor <repo_path>
function dm_generate_vendor() {
local repo="$1"
pushd "$repo"
composer install
${DM_COMPOSER:-composer} install
popd
}
......@@ -206,11 +227,3 @@ function dm_git_checkout() {
git checkout "$2"
popd
}
## Install npm packages
## usage: dm_npm_install <path>
function dm_npm_install() {
pushd "$1"
$DM_NPM install
popd
}
......@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal6
dm_install_core "$SRC" "$TRG"
dm_install_packages "$SRC/packages" "$TRG/packages"
dm_install_vendor "$SRC/vendor" "$TRG/vendor"
dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
dm_install_drupal "$SRC/drupal" "$TRG/drupal"
# gen tarball
......
......@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal
dm_install_core "$SRC" "$TRG"
dm_install_packages "$SRC/packages" "$TRG/packages"
dm_install_vendor "$SRC/vendor" "$TRG/vendor"
dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
dm_install_drupal "$SRC/drupal" "$TRG/drupal"
# gen tarball
......
......@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Drupal
dm_install_core "$SRC" "$TRG"
dm_install_packages "$SRC/packages" "$TRG/packages"
dm_install_vendor "$SRC/vendor" "$TRG/vendor"
dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
dm_install_drupal "$SRC/drupal" "$TRG/drupal"
# delete packages that distributions on Drupal.org repalce if present
......
......@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm-version.php" Joomla
dm_install_core "$SRC" "$TRG"
dm_install_packages "$SRC/packages" "$TRG/packages"
dm_install_vendor "$SRC/vendor" "$TRG/vendor"
dm_install_bower "$SRC/bower_components" "$TRG/bower_components"
## WTF: It's so good we'll install it twice!
## (The first is probably extraneous, but there could be bugs dependent on it.)
......
......@@ -21,6 +21,7 @@ dm_generate_version "$TRG/civicrm/civicrm/civicrm-version.php" Wordpress
dm_install_core "$SRC" "$TRG/civicrm/civicrm"
dm_install_packages "$SRC/packages" "$TRG/civicrm/civicrm/packages"
dm_install_vendor "$SRC/vendor" "$TRG/civicrm/civicrm/vendor"
dm_install_bower "$SRC/bower_components" "$TRG/civicrm/civicrm/bower_components"
dm_install_wordpress "$SRC/WordPress" "$TRG/civicrm"
# gen tarball
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment