Skip to content

Commit 9437adc

Browse files
authored
Merge pull request #24871 from nkcsgexi/rename-arg-digester
api-digester: rename argument `-compare-sdk` to `-generate-migration-script`. SR-10489
2 parents e932198 + bfed404 commit 9437adc

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

test/api-digester/apinotes-migrator-gen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: %empty-directory(%t.module-cache)
55
// RUN: %api-digester -dump-sdk -module APINotesTest -o %t.dump1.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -swift-version 5 -I %S/Inputs/APINotesLeft
66
// RUN: %api-digester -dump-sdk -module APINotesTest -o %t.dump2.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -swift-version 5 -I %S/Inputs/APINotesRight
7-
// RUN: %api-digester -compare-sdk --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result -json
7+
// RUN: %api-digester -generate-migration-script --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result -json
88
// RUN: diff -u %S/Outputs/apinotes-migrator-gen.json %t.result
9-
// RUN: %api-digester -compare-sdk --input-paths %t.dump2.json -input-paths %t.dump1.json -o %t.result -json
9+
// RUN: %api-digester -generate-migration-script --input-paths %t.dump2.json -input-paths %t.dump1.json -o %t.result -json
1010
// RUN: diff -u %S/Outputs/apinotes-migrator-gen-revert.json %t.result

test/api-digester/macro-gen-json.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// RUN: %swift -emit-module -o %t.mod/macrogenright.swiftmodule %S/Inputs/macro-gen-right.swift -parse-as-library
66
// RUN: %api-digester -dump-sdk -module macrogenleft -o %t.dump1.json -module-cache-path %t.module-cache -sdk %t.sdk -I %t.mod
77
// RUN: %api-digester -dump-sdk -module macrogenright -o %t.dump2.json -module-cache-path %t.module-cache -sdk %t.sdk -I %t.mod
8-
// RUN: %api-digester -compare-sdk --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result -json
8+
// RUN: %api-digester -generate-migration-script --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result -json
99
// RUN: diff -u %S/Outputs/macro-gen.json %t.result

test/api-digester/macro-gen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// RUN: %swift -emit-module -o %t.mod/macrogenright.swiftmodule %S/Inputs/macro-gen-right.swift -parse-as-library
66
// RUN: %api-digester -dump-sdk -module macrogenleft -o %t.dump1.json -module-cache-path %t.module-cache -sdk %t.sdk -swift-version 4 -I %t.mod
77
// RUN: %api-digester -dump-sdk -module macrogenright -o %t.dump2.json -module-cache-path %t.module-cache -sdk %t.sdk -swift-version 5 -I %t.mod
8-
// RUN: %api-digester -compare-sdk --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result
8+
// RUN: %api-digester -generate-migration-script --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result
99
// RUN: diff -u %S/Outputs/macro-gen.def %t.result

tools/swift-api-digester/swift-api-digester.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace {
4141
None,
4242
DumpSDK,
4343
DumpSwiftModules,
44-
CompareSDKs,
44+
MigratorGen,
4545
DiagnoseSDKs,
4646
// The following two are for testing purposes
4747
DeserializeDiffItems,
@@ -141,9 +141,9 @@ Action(llvm::cl::desc("Mode:"), llvm::cl::init(ActionType::None),
141141
clEnumValN(ActionType::DumpSwiftModules,
142142
"dump-swift",
143143
"dump swift modules in SDK"),
144-
clEnumValN(ActionType::CompareSDKs,
145-
"compare-sdk",
146-
"Compare SDK content in JSON file"),
144+
clEnumValN(ActionType::MigratorGen,
145+
"generate-migration-script",
146+
"Compare SDK content in JSON file and generate migration script"),
147147
clEnumValN(ActionType::DiagnoseSDKs,
148148
"diagnose-sdk",
149149
"Diagnose SDK content in JSON file"),
@@ -2128,9 +2128,10 @@ static void populateAliasChanges(NodeMap &AliasMap, DiffVector &AllItems,
21282128
}
21292129
}
21302130

2131-
static int compareSDKs(StringRef LeftPath, StringRef RightPath,
2132-
StringRef DiffPath,
2133-
llvm::StringSet<> &IgnoredRemoveUsrs, CheckerOptions Opts) {
2131+
static int generateMigrationScript(StringRef LeftPath, StringRef RightPath,
2132+
StringRef DiffPath,
2133+
llvm::StringSet<> &IgnoredRemoveUsrs,
2134+
CheckerOptions Opts) {
21342135
if (!fs::exists(LeftPath)) {
21352136
llvm::errs() << LeftPath << " does not exist\n";
21362137
return 1;
@@ -2395,7 +2396,7 @@ int main(int argc, char *argv[]) {
23952396
case ActionType::DumpSDK:
23962397
return (prepareForDump(argv[0], InitInvok, Modules)) ? 1 :
23972398
dumpSDKContent(InitInvok, Modules, options::OutputFile, Opts);
2398-
case ActionType::CompareSDKs:
2399+
case ActionType::MigratorGen:
23992400
case ActionType::DiagnoseSDKs: {
24002401
if (options::SDKJsonPaths.size() != 2) {
24012402
llvm::errs() << "Only two SDK versions can be compared\n";
@@ -2407,9 +2408,10 @@ int main(int argc, char *argv[]) {
24072408
if (readFileLineByLine(options::ProtReqWhiteList, protocolWhitelist))
24082409
return 1;
24092410
}
2410-
if (options::Action == ActionType::CompareSDKs)
2411-
return compareSDKs(options::SDKJsonPaths[0], options::SDKJsonPaths[1],
2412-
options::OutputFile, IgnoredUsrs, Opts);
2411+
if (options::Action == ActionType::MigratorGen)
2412+
return generateMigrationScript(options::SDKJsonPaths[0],
2413+
options::SDKJsonPaths[1],
2414+
options::OutputFile, IgnoredUsrs, Opts);
24132415
else
24142416
return diagnoseModuleChange(options::SDKJsonPaths[0],
24152417
options::SDKJsonPaths[1],

0 commit comments

Comments
 (0)