[migrator] Add -api-diff-data-dir option to override the default location for the migrator's platform + version specific api diff json files

This is useful for testing the migrator with different versions of the api diff data.
This commit is contained in:
Nathan Hawes
2018-05-31 09:23:24 -07:00
parent 4b037e2b00
commit 42b22fbe38
14 changed files with 167 additions and 4 deletions

View File

@@ -956,9 +956,16 @@ static bool ParseMigratorArgs(MigratorOptions &Opts,
auto &Triple = LangOpts.Target;
bool isSwiftVersion3 = LangOpts.isSwiftVersion3();
llvm::SmallString<128> basePath;
if (auto DataDir = Args.getLastArg(OPT_api_diff_data_dir)) {
basePath = DataDir->getValue();
} else {
basePath = ResourcePath;
llvm::sys::path::append(basePath, "migrator");
}
bool Supported = true;
llvm::SmallString<128> dataPath(ResourcePath);
llvm::sys::path::append(dataPath, "migrator");
llvm::SmallString<128> dataPath(basePath);
if (Triple.isMacOSX())
llvm::sys::path::append(dataPath,
@@ -975,8 +982,7 @@ static bool ParseMigratorArgs(MigratorOptions &Opts,
else
Supported = false;
if (Supported) {
llvm::SmallString<128> authoredDataPath(ResourcePath);
llvm::sys::path::append(authoredDataPath, "migrator");
llvm::SmallString<128> authoredDataPath(basePath);
llvm::sys::path::append(authoredDataPath,
getScriptFileName("overlay", isSwiftVersion3));
// Add authored list first to take higher priority.