root/branches/1.0.x/build/buildjtpl.php

Revision 421, 2.2 kB (checked in by laurentj, 2 years ago)

ticket #167: jtpl and jbuildtools build are not generated at the right place

Line 
1 <?php
2 /**
3 * @package     jelix
4 * @author      Jouanneau Laurent
5 * @contributor
6 * @copyright   2006-2007 Jouanneau laurent
7 * @link        http://www.jelix.org
8 * @licence     GNU General Public Licence see LICENCE file or http://www.gnu.org/licenses/gpl.html
9 */
10
11 $BUILD_OPTIONS = array(
12 'MAIN_TARGET_PATH'=> array(
13     "main directory where sources will be copied"// signification (false = option cachée)
14     '_dist',                                        // valeur par défaut (boolean = option booleene)
15     '',                                             // regexp pour la valeur ou vide=tout (seulement pour option non booleene)
16     ),
17 'PACKAGE_TAR_GZ'=>array(
18     "create a tar.gz package",
19     false,
20     ),
21 'PACKAGE_ZIP'=>array(
22     "create a zip package",
23     false,
24     ),
25 'VERSION'=> array(
26     false,
27     'SVN',
28     '',
29     ),
30 'IS_NIGHTLY'=> array(
31     false,
32     false,
33     ),
34 'SVN_REVISION'=> array(
35     false,
36     ),
37 'JTPL_STANDALONE'=> array(
38     false,
39     '1',
40     ),
41 );
42
43 include(dirname(__FILE__).'/lib/jBuild.inc.php');
44
45 //----------------- Preparation des variables d'environnement
46
47 Env::setFromFile('VERSION','lib/jelix/tpl/VERSION', true);
48 $SVN_REVISION = Subversion::revision();
49
50 if($VERSION == 'SVN'){
51     $VERSION = 'SVN-'.$SVN_REVISION;
52     $IS_NIGHTLY = true;
53 }else{
54     $IS_NIGHTLY = false;
55 }
56
57 if($PACKAGE_TAR_GZ || $PACKAGE_ZIP ){
58     if($IS_NIGHTLY)
59         $PACKAGE_NAME = 'jtpl-nightly';
60     else
61         $PACKAGE_NAME = 'jtpl-'.$VERSION;
62
63     $BUILD_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH).$PACKAGE_NAME.'/';
64 }else{
65     $BUILD_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH);
66 }
67
68
69 //----------------- Génération des sources
70
71 //... creation des repertoires
72 jBuildUtils::createDir($BUILD_TARGET_PATH);
73
74 //... execution des manifests
75 jManifest::process('build/manifests/jtpl-standalone.mn', '.', $BUILD_TARGET_PATH, ENV::getAll());
76
77
78 file_put_contents($BUILD_TARGET_PATH.'/VERSION', $VERSION);
79
80 //... packages
81
82 if($PACKAGE_TAR_GZ){
83     exec('tar czf '.$MAIN_TARGET_PATH.'/'.$PACKAGE_NAME.'.tar.gz -C '.$MAIN_TARGET_PATH.' '.$PACKAGE_NAME);
84 }
85
86 if($PACKAGE_ZIP){
87     chdir($MAIN_TARGET_PATH);
88     exec('zip -r '.$PACKAGE_NAME.'.zip '.$PACKAGE_NAME);
89     chdir(dirname(__FILE__));
90 }
91
92 exit(0);
93 ?>
Note: See TracBrowser for help on using the browser.
Download in other formats: Plain Text Original Format