diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-09-02 07:23:42 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-09-02 07:23:42 +0900 |
commit | 3ba69dd86d3d2f33cffc47c943552f7a25561293 (patch) | |
tree | 1f8705f47f08a11f629ac1d6e06ca3d3bd6b4daf | |
parent | 79cf00f38734409afad426f5d25c250d49730e25 (diff) | |
download | android_build_kati-3ba69dd86d3d2f33cffc47c943552f7a25561293.tar.gz android_build_kati-3ba69dd86d3d2f33cffc47c943552f7a25561293.tar.bz2 android_build_kati-3ba69dd86d3d2f33cffc47c943552f7a25561293.zip |
[C++] Stop restoring environment variables with --ninja_suffix
Also remove --lunch in m2n. They were mainly for my development
and are not necessary anymore. .kati_env causes an error
message for mmm build in Android repo.
-rw-r--r-- | flags.cc | 1 | ||||
-rw-r--r-- | flags.h | 1 | ||||
-rwxr-xr-x | m2n | 17 | ||||
-rw-r--r-- | main.cc | 2 | ||||
-rw-r--r-- | ninja.cc | 75 |
5 files changed, 0 insertions, 96 deletions
@@ -24,5 +24,4 @@ int g_num_jobs; int g_remote_num_jobs; bool g_detect_android_echo; bool g_gen_regen_rule; -bool g_error_on_env_change; const char* g_ignore_dirty_pattern; @@ -23,7 +23,6 @@ extern int g_num_jobs; extern int g_remote_num_jobs; extern bool g_detect_android_echo; extern bool g_gen_regen_rule; -extern bool g_error_on_env_change; extern const char* g_ignore_dirty_pattern; #endif // FLAGS_H_ @@ -63,13 +63,6 @@ EOF shift ;; - --lunch) - shift; - lunch="$1" - extra_flags+=" --error_on_env_change" - shift - ;; - -*) extra_flags+=" $1" shift @@ -97,12 +90,6 @@ kati=${kati_dir}/ckati ninja_suffix= ninja_suffix_flag= -if [ x"${lunch}" != x"" ]; then - source build/envsetup.sh - lunch ${lunch} - ninja_suffix=-${lunch} -fi - if [ x"${mmm}" != x"" ]; then mk="${mmm}/Android.mk" if [ ! -f ${mk} ]; then @@ -127,10 +114,6 @@ if [ x"${ninja_suffix}" != x"" ]; then ninja_suffix_flag=--ninja_suffix=${ninja_suffix} fi -if [ x"${lunch}" != x"" ]; then - printconfig | grep -v '^=' > .kati_lunch${ninja_suffix} -fi - ${kati} --ninja ${ninja_suffix_flag} --ignore_optional_include=out/%.P --ignore_dirty=out/% --use_find_emulator --detect_android_echo ${goma_flag} ${extra_flags} ${targets} echo @@ -103,8 +103,6 @@ static void ParseCommandLine(int argc, char* argv[], g_dump_kati_stamp = true; } else if (!strcmp(arg, "--detect_android_echo")) { g_detect_android_echo = true; - } else if (!strcmp(arg, "--error_on_env_change")) { - g_error_on_env_change = true; } else if (ParseCommandLineOptionWithArg( "-j", argv, &i, &num_jobs_str)) { g_num_jobs = strtol(num_jobs_str, NULL, 10); @@ -195,7 +195,6 @@ class NinjaGenerator { bool build_all_targets, const string& orig_args) { GenerateNinja(nodes, build_all_targets, orig_args); - GenerateEnvlist(); GenerateShell(); GenerateStamp(); } @@ -543,10 +542,6 @@ class NinjaGenerator { fprintf(fp_, " %.*s", SPF(makefile)); } fprintf(fp_, " %s", kati_binary_.c_str()); - // TODO: Add dependencies to directories read by $(wildcard) - // or $(shell find). - if (!used_envs_.empty()) - fprintf(fp_, " %s", GetEnvlistFilename().c_str()); fprintf(fp_, "\n\n"); } @@ -560,16 +555,6 @@ class NinjaGenerator { ninja_dir_.c_str(), ninja_suffix_.c_str()); } - string GetEnvlistFilename() const { - return StringPrintf("%s/.kati_env%s", - ninja_dir_.c_str(), ninja_suffix_.c_str()); - } - - string GetLunchFilename() const { - return StringPrintf("%s/.kati_lunch%s", - ninja_dir_.c_str(), ninja_suffix_.c_str()); - } - string GetStampFilename() const { return GetStampFilename(ninja_dir_.c_str(), ninja_suffix_.c_str()); } @@ -631,12 +616,6 @@ class NinjaGenerator { fprintf(fp, "\n"); if (ninja_dir_ == ".") fprintf(fp, "cd $(dirname \"$0\")\n"); - if (!ninja_suffix_.empty()) { - fprintf(fp, "if [ -f %s ]; then\n export $(cat %s)\nfi\n", - GetEnvlistFilename().c_str(), GetEnvlistFilename().c_str()); - fprintf(fp, "if [ -f %s ]; then\n export $(cat %s)\nfi\n", - GetLunchFilename().c_str(), GetLunchFilename().c_str()); - } for (const auto& p : ev_->exports()) { if (p.second) { @@ -659,60 +638,6 @@ class NinjaGenerator { PERROR("chmod ninja.sh failed"); } - void GenerateEnvlist() { - if (used_envs_.empty()) - return; - FILE* fp = fopen(GetEnvlistFilename().c_str(), "wb"); - for (const auto& p : used_envs_) { - fprintf(fp, "%s=%s\n", p.first.c_str(), p.second.c_str()); - } - fclose(fp); - } - -#if 0 - void GetCommonPrefixDir(const vector<string>& files, string* o) { - for (const string& file : files) { - size_t l = min(file.size(), o->size()); - for (size_t i = 0; i < l; i++) { - if (file[i] != (*o)[i]) { - size_t index = o->rfind('/', i); - if (index == string::npos) - index = 0; - o->resize(index); - break; - } - } - } - } - - void GetReadDirs(const string& pat, - const vector<string>& files, - unordered_set<string>* dirs) { - string prefix_dir = Dirname(pat).as_string(); - size_t index = prefix_dir.find_first_of("?*[\\"); - if (index != string::npos) { - index = prefix_dir.rfind('/', index); - if (index == string::npos) { - prefix_dir = ""; - } else { - prefix_dir = prefix_dir.substr(0, index); - } - } - - GetCommonPrefixDir(files, &prefix_dir); - if (prefix_dir.empty()) - prefix_dir = "."; - dirs->insert(prefix_dir); - for (const string& file : files) { - StringPiece dir = Dirname(file); - while (dir != prefix_dir) { - dirs->insert(dir.as_string()); - dir = Dirname(dir); - } - } - } -#endif - void GenerateStamp() { FILE* fp = fopen(GetStampFilename().c_str(), "wb"); CHECK(fp); |