blob: aaba73d297b173de6d8913b7ea65d8d339703609 [file] [log] [blame]
atoulme425b6c82008-11-24 14:00:27 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007-2008 Eclipse Foundation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Antoine Toulme, Intalio Inc. bug 248845: Refactoring generate1.php into different files with a functional approach
11*******************************************************************************/
12
13/*
14 * Documentation: http://wiki.eclipse.org/Babel_/_Server_Tool_Specification#Outputs
15 */
16
atoulme425b6c82008-11-24 14:00:27 +000017ini_set("memory_limit", "64M");
atoulme3ac52612009-02-02 13:14:39 +000018require(dirname(__FILE__) . "/../system/backend_functions.php");
19
20global $addon;
21$context = $addon->callHook('context');
22
atoulme12882d52009-01-26 18:39:17 +000023require(dirname(__FILE__) . "/../system/dbconnection.class.php");
24require(dirname(__FILE__) . "/../system/feature.class.php");
atoulme425b6c82008-11-24 14:00:27 +000025$dbc = new DBConnection();
26$dbh = $dbc->connect();
27
atoulme3ac52612009-02-02 13:14:39 +000028
29$work_dir = $addon->callHook('babel_working');
atoulme425b6c82008-11-24 14:00:27 +000030
31$work_context_dir = $work_dir . $context . "_feature/";
32$tmp_dir = $work_context_dir . "tmp/";
33$output_dir = $work_context_dir . "output/";
34$features_dir = $work_context_dir . "features/";
35
36exec("rm -rf $work_context_dir*");
37exec("mkdir -p $output_dir");
atoulmea5563692008-12-01 11:25:57 +000038exec("mkdir -p $features_dir");
atoulme425b6c82008-11-24 14:00:27 +000039
atoulmedd1ac3c2008-12-03 12:51:19 +000040//iterate over all the release trains
atoulmecab9de92008-11-24 15:04:02 +000041foreach(ReleaseTrain::all() as $train) {
atoulmedd1ac3c2008-12-03 12:51:19 +000042 // create a dedicated folder for each of them
atoulmea5563692008-12-01 11:25:57 +000043 exec("mkdir -p $features_dir/$train->id");
atoulmedd1ac3c2008-12-03 12:51:19 +000044 // create the output folder for temporary artifacts
atoulme425b6c82008-11-24 14:00:27 +000045 $output_dir_for_train = "$output_dir/$train->id/";
atoulmedd1ac3c2008-12-03 12:51:19 +000046 // iterate over each language
atoulmedfee65f2008-11-24 14:59:26 +000047 foreach(Language::all() as $lang) {
atoulmedd1ac3c2008-12-03 12:51:19 +000048 // create a new feature object
atoulme425b6c82008-11-24 14:00:27 +000049 $feature = new Feature($lang, $train, $tmp_dir, $output_dir_for_train);
atoulmedd1ac3c2008-12-03 12:51:19 +000050 // make it generate itself
atoulme425b6c82008-11-24 14:00:27 +000051 $feature->generateAll();
atoulmedd1ac3c2008-12-03 12:51:19 +000052 // now zip it directly
atoulmea5563692008-12-01 11:25:57 +000053 $featureZip = $feature->zip("$features_dir/$train->id");
atoulmedd1ac3c2008-12-03 12:51:19 +000054 // output the creation of the feature notification
atoulmea5563692008-12-01 11:25:57 +000055 echo "Feature created here: $featureZip\n";
atoulme425b6c82008-11-24 14:00:27 +000056 }
57}