Make -rest an optional param to the Thrift PHP compiler

Summary: You rarely need the generated REST stuff

Reviewed By: jwang

Test Plan: Gen falcon code without REST part


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665150 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Slee 2007-07-06 00:30:21 +00:00
parent 7ef673345b
commit 756b1d1b07
3 changed files with 16 additions and 5 deletions

View File

@ -581,7 +581,9 @@ void t_php_generator::generate_service(t_service* tservice) {
// Generate the three main parts of the service (well, two for now in PHP)
generate_service_interface(tservice);
generate_service_rest(tservice);
if (rest_) {
generate_service_rest(tservice);
}
generate_service_client(tservice);
generate_service_helpers(tservice);
generate_service_processor(tservice);

View File

@ -21,9 +21,10 @@
*/
class t_php_generator : public t_oop_generator {
public:
t_php_generator(t_program* program, bool binary_inline=false) :
t_php_generator(t_program* program, bool binary_inline=false, bool rest=false) :
t_oop_generator(program),
binary_inline_(binary_inline) {
binary_inline_(binary_inline),
rest_(rest) {
if (binary_inline_) {
T_PHP_DIR = "gen-phpi";
} else {
@ -161,6 +162,11 @@ class t_php_generator : public t_oop_generator {
*/
bool binary_inline_;
/**
* Generate a REST handler class
*/
bool rest_;
};
#endif

View File

@ -124,6 +124,7 @@ bool gen_py = false;
bool gen_xsd = false;
bool gen_php = false;
bool gen_phpi = false;
bool gen_rest = false;
bool gen_perl = false;
bool gen_erl = false;
bool gen_recurse = false;
@ -526,14 +527,14 @@ void generate(t_program* program) {
if (gen_php) {
pverbose("Generating PHP\n");
t_php_generator* php = new t_php_generator(program, false);
t_php_generator* php = new t_php_generator(program, false, gen_rest);
php->generate_program();
delete php;
}
if (gen_phpi) {
pverbose("Generating PHP-inline\n");
t_php_generator* phpi = new t_php_generator(program, true);
t_php_generator* phpi = new t_php_generator(program, true, gen_rest);
phpi->generate_program();
delete phpi;
}
@ -627,6 +628,8 @@ int main(int argc, char** argv) {
gen_php = true;
} else if (strcmp(arg, "-phpi") == 0) {
gen_phpi = true;
} else if (strcmp(arg, "-rest") == 0) {
gen_rest = true;
} else if (strcmp(arg, "-py") == 0) {
gen_py = true;
} else if (strcmp(arg, "-rb") == 0) {