root/trunk/build/buildjtpl.php

Revision 1142, 2.5 kB (checked in by laurentj, 3 weeks ago)

Worked on jtpl standalone : added a new object for the configuration, replacing the constant for better flexibility

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 'WITH_TESTS'=>array(
26     "includes tests",
27     false,
28     ),
29 'VERSION'=> array(
30     false,
31     'SVN',
32     '',
33     ),
34 'IS_NIGHTLY'=> array(
35     false,
36     false,
37     ),
38 'SVN_REVISION'=> array(
39     false,
40     ),
41 'JTPL_STANDALONE'=> array(
42     false,
43     '1',
44     ),
45 );
46
47 include(dirname(__FILE__).'/lib/jBuild.inc.php');
48
49 //----------------- Preparation des variables d'environnement
50
51 Env::setFromFile('VERSION','lib/jelix/tpl/VERSION', true);
52 $SVN_REVISION = Subversion::revision();
53
54 $IS_NIGHTLY = (strpos($VERSION,'SVN') !== false);
55
56 if($IS_NIGHTLY){
57     $PACKAGE_NAME='jtpl-'.str_replace('SVN', '', $VERSION);
58     if(substr($PACKAGE_NAME,-1,1) == '.')
59       $PACKAGE_NAME = substr($PACKAGE_NAME,0,-1);
60     $VERSION = str_replace('SVN', $SVN_REVISION, $VERSION);
61 }
62 else {
63     $PACKAGE_NAME='jtpl-'.$VERSION;
64 }
65
66 if($PACKAGE_TAR_GZ || $PACKAGE_ZIP ){
67     $BUILD_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH).$PACKAGE_NAME.'/';
68 }else{
69     $BUILD_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH);
70 }
71
72
73 //----------------- Génération des sources
74
75 //... creation des repertoires
76 jBuildUtils::createDir($BUILD_TARGET_PATH);
77
78 //... execution des manifests
79 jManifest::process('build/manifests/jtpl-standalone.mn', '.', $BUILD_TARGET_PATH, ENV::getAll());
80
81 if($WITH_TESTS) {
82     jManifest::process('build/manifests/jtpl-standalone-tests.mn', '.', $BUILD_TARGET_PATH, ENV::getAll());
83 }
84
85
86
87 file_put_contents($BUILD_TARGET_PATH.'/VERSION', $VERSION);
88
89 //... packages
90
91 if($PACKAGE_TAR_GZ){
92     exec('tar czf '.$MAIN_TARGET_PATH.'/'.$PACKAGE_NAME.'.tar.gz -C '.$MAIN_TARGET_PATH.' '.$PACKAGE_NAME);
93 }
94
95 if($PACKAGE_ZIP){
96     chdir($MAIN_TARGET_PATH);
97     exec('zip -r '.$PACKAGE_NAME.'.zip '.$PACKAGE_NAME);
98     chdir(dirname(__FILE__));
99 }
100
101 exit(0);
102 ?>
Note: See TracBrowser for help on using the browser.
Download in other formats: Plain Text Original Format