Added build script
This commit is contained in:
parent
a1bc59cd96
commit
b1f65bbcfc
54
build.php
Normal file
54
build.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
$plugin = new stdClass;
|
||||||
|
include('version.php');
|
||||||
|
|
||||||
|
$a = explode("_",$plugin->component,2);
|
||||||
|
$plugin->type = $a[0];
|
||||||
|
$plugin->name = $a[1];
|
||||||
|
|
||||||
|
$exclude_paths = [
|
||||||
|
"build", // dir for build zip files
|
||||||
|
"build/*",
|
||||||
|
"build.*",
|
||||||
|
"amd/src",
|
||||||
|
"amd/src/*",
|
||||||
|
".git",
|
||||||
|
".git/*",
|
||||||
|
".gitignore",
|
||||||
|
"*.zip",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Determine some paths
|
||||||
|
$wd = realpath(dirname(__FILE__));
|
||||||
|
$parent = dirname($wd);
|
||||||
|
$plugindirname = basename($wd);
|
||||||
|
$builddir = $wd."/"."build";
|
||||||
|
$zipname = $builddir."/"."{$plugin->name}-{$plugin->version}.zip";
|
||||||
|
|
||||||
|
// create the exclude line
|
||||||
|
$exclude = "-x ";
|
||||||
|
foreach($exclude_paths as $x){
|
||||||
|
$exclude .= "'{$plugindirname}/{$x}' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_dir($builddir)){
|
||||||
|
mkdir($builddir);
|
||||||
|
if(!is_dir($builddir)){
|
||||||
|
print("Cannot access dir '{$builddir}' to store zip files\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(file_exists($zipfile)){
|
||||||
|
print("Zip file '{$zipfile}' already exists. Exiting...\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cwd = getcwd();
|
||||||
|
chdir($parent);
|
||||||
|
|
||||||
|
$cmd = "zip -r '{$zipname}' '{$plugindirname}' {$exclude}";
|
||||||
|
system($cmd);
|
||||||
|
|
||||||
|
chdir($cwd);
|
||||||
|
|
14
build.sh
Normal file
14
build.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
WD=`pwd`
|
||||||
|
|
||||||
|
# run the grunt script in the scripts working directory
|
||||||
|
cd $SCRIPTDIR
|
||||||
|
grunt amd
|
||||||
|
|
||||||
|
# run the build php script
|
||||||
|
php ${SCRIPTDIR}/build.php $@
|
||||||
|
|
||||||
|
|
||||||
|
# return to the working directory
|
||||||
|
cd $WD
|
Loading…
Reference in New Issue
Block a user