File:  [mozdev] / converter / src / build.php
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Fri Oct 1 20:14:54 2010 UTC (8 years, 4 months ago) by bogdan
Branches: MAIN
CVS tags: HEAD
switched to php

#!/usr/bin/php
<?php

$output="converter_current.xpi";
if (!chdir(dirname(__FILE__)."/chrome")) {
	echo "Directory ".dirname(__FILE__)."/chrome not found; exiting.\n";
	exit(1);
}

$jar_files=array(
	"content/converter_conversions.js",
	"content/converter_init.js",
	"content/converter_core.js",
	"content/converter_iface.js",
	"content/converter_util.js",
	"content/converter_regression.js",
	"content/converter_tz.js",
	"content/converter_prefs.js",
	"content/converter_prefs_gui.js",
	"content/converter_prefs_iface.js",
	"content/converter_currency.js",
	"content/converter_currency_iface.js",
	"content/converter_premium.js",
	"content/converterOverlay.xul",
	"content/converterPrefDialog.xul",
	"content/custom_conversion.xul",
	"skin/classic/cv_stat_on.png",
	"skin/classic/cv_stat_off.png",
	"skin/classic/cv_stat_progress.png",
	"skin/classic/cv_stat_denied.png",
	"skin/classic/pref_fullpage_icon.png",
	"skin/classic/pref_fullpage_menu.png",
	"skin/classic/pref_selection_menu.png",
	"skin/classic/1cm.png",
	"skin/classic/clock.png",
	"skin/classic/converter_24x24.png",
	"skin/classic/converter.png",
	"skin/classic/menu_feedback.png",
	"skin/classic/menu_homepage.png",
	"skin/classic/menu_options.png",
	"skin/classic/menu_custom_conversion.png",
	"skin/classic/menu_buy_premium.png",
	"skin/classic/pref_enable_currency.png",
	"skin/classic/pref_custom_convert_selection.png",
	"skin/classic/pref_detail.png",
	"skin/classic/pref_one_way.png",
	"skin/classic/pref_auto_convert.png",
	"skin/classic/pref_ws.png",
	"skin/classic/custom_conversion_header.png",
	"LICENSE.txt",
);
$xpi_files=array(
	"chrome.manifest",
	"install.rdf",
	"chrome/converter.jar"
);

$ok=true;
foreach($jar_files as $file) {
	if (!is_file($file) || !is_readable($file)) {
		echo "[JAR] File $file doesn't exist or can't be read.\n";
		$ok=false;
	}
}
if (!$ok) {
	echo "Exiting.\n";
	exit(2);
}

$zip="zip converter.jar ".implode(" ",$jar_files);

exec($zip,$out,$rc);
if ($rc) {
	echo "[JAR] Failed zipping; exiting.\n";
	exit(3);
}

chdir(dirname(__FILE__));
foreach($xpi_files as $file) {
	if (!is_file($file) || !is_readable($file)) {
		echo "[XPI] File $file doesn't exist or can't be read.\n";
		$ok=false;
	}
}
if (!$ok) {
	echo "Exiting.\n";
	exit(4);
}

$zip="zip $output ".implode(" ",$xpi_files);
exec($zip,$out,$rc);
if ($rc) {
	echo "[XPI] Failed zipping; exiting.\n";
	exit(5);
}
echo "Build done -- XPI file: $output\n";
if (copy($output,"/var/www/html/projects.moongate.ro/".$output)) {
	echo "Also copied under http://projects.moongate.ro/$output\n";
}
unlink("chrome/converter.jar");
echo "Clean exit.\n";

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>