root/trunk/build/buildapp.php

Revision 826, 2.4 kB (checked in by laurentj, 8 months ago)

BUILD: changed version number in the trunk

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 $BUILD_OPTIONS = array(
11 'MAIN_TARGET_PATH'=> array(
12     "main directory where sources will be copied"// signification (false = option cachée)
13     '_dist',                                        // valeur par défaut (boolean = option booleene)
14     '',                                             // regexp pour la valeur ou vide=tout (seulement pour option non booleene)
15     ),
16 'APPNAME'=> array(
17     "The name of the app you want to generate (testapp)",
18     '',
19     '/testapp/',
20     ),
21 'PACKAGE_TAR_GZ'=>array(
22     "create a tar.gz package",
23     false,
24     ),
25 'PACKAGE_ZIP'=>array(
26     "create a zip package",
27     false,
28     ),
29 'VERSION'=> array(
30     false,
31     '',
32     '',
33     ),
34 'IS_NIGHTLY'=> array(
35     false,
36     false,
37     ),
38 'SVN_REVISION'=> array(
39     false,
40     ),
41 );
42 include(dirname(__FILE__).'/lib/jBuild.inc.php');
43
44 //----------------- Preparation des variables d'environnement
45
46 if(!$APPNAME){
47     die("Error: APPNAME is empty");
48 }
49 $APPDIR = jBuildUtils::normalizeDir($APPNAME);
50 $MAIN_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH);
51
52 Env::setFromFile('VERSION',$APPDIR.'/VERSION',true);
53 $SVN_REVISION = Subversion::revision($APPDIR);
54
55 $IS_NIGHTLY = (strpos($VERSION,'SVN') !== false);
56
57 if($IS_NIGHTLY){
58     $PACKAGE_NAME=$APPNAME.'-'.str_replace('SVN', '', $VERSION);
59     if(substr($PACKAGE_NAME,-1,1) == '.')
60       $PACKAGE_NAME = substr($PACKAGE_NAME,0,-1);
61     $VERSION = str_replace('SVN', $SVN_REVISION, $VERSION);
62 }
63 else {
64     $PACKAGE_NAME=$APPNAME.'-'.$VERSION;
65 }
66
67
68 if($PACKAGE_TAR_GZ || $PACKAGE_ZIP ){
69     //$MAIN_TARGET_PATH = jBuildUtils::normalizeDir($MAIN_TARGET_PATH).$PACKAGE_NAME;
70 }
71
72 //----------------- Génération des sources
73
74 //... creation des repertoires
75 jBuildUtils::createDir($MAIN_TARGET_PATH);
76
77 //... execution des manifests
78 jManifest::process('build/manifests/'.$APPNAME.'.mn', '.', $MAIN_TARGET_PATH, ENV::getAll());
79
80
81 file_put_contents($MAIN_TARGET_PATH.$APPDIR.'/VERSION', $VERSION);
82
83 //... packages
84
85 if($PACKAGE_TAR_GZ){
86     exec('tar czf '.$MAIN_TARGET_PATH.$PACKAGE_NAME.'.tar.gz -C '.$MAIN_TARGET_PATH.' '.$APPNAME);
87 }
88
89 if($PACKAGE_ZIP){
90     chdir($MAIN_TARGET_PATH);
91     exec('zip -r '.$PACKAGE_NAME.'.zip '.$APPNAME);
92     chdir(dirname(__FILE__));
93 }
94
95 exit(0);
96 ?>
Note: See TracBrowser for help on using the browser.
Download in other formats: Plain Text Original Format