Skip to content

Commit 81fed6c

Browse files
author
arayama-kyo
committed
fix 考慮外
1 parent c7b7bd9 commit 81fed6c

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

Sources/RanasaCore/Actions/DynamicAction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public extension DynamicAction {
1818
guard let archived = try fileCheck(path: path, log?.indented()),
1919
archived == .dynamicBinary
2020
else {
21-
log?(.normal, "\(libName) is not thin static library")
21+
log?(.normal, "\(libName) is not thin dynamic library")
2222
return
2323
}
2424

@@ -35,7 +35,7 @@ public extension DynamicAction {
3535
case .alreadyProcessed:
3636
log?(.verbose, "Found LC_BUILD_VERSION, try vtool replace IOSSIMULATOR(7)")
3737
let renamed = current.addingComponent(libName + "_old")
38-
try rename(current: path, destination: renamed)
38+
try rename(current: path, destination: renamed, log?.indented())
3939
try vRewriteBinary(
4040
input: renamed,
4141
output: path,

Sources/RanasaCore/Actions/StaticAction.swift

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public extension StaticAction {
1414
getFiles: GetFiles = .live(),
1515
fileCheck: FileCheck = .live(),
1616
rename: MoveItem = .live(),
17-
rewriteBinary: TransmogrifierEdit = .live()
17+
rewriteBinary: TransmogrifierEdit = .live(),
18+
vRewriteBinary: VToolEdit = .live()
1819
) -> Self {
1920
.init { current, libName, minos, sdk, log in
2021
guard let archived = try fileCheck(path: current.addingComponent(libName), log?.indented()),
@@ -32,19 +33,34 @@ public extension StaticAction {
3233
log?(.normal, "\(objectPath.string) is not Mach-O 64 Object")
3334
return
3435
}
35-
do { try rewriteBinary(rewritePath: objectPath, minos: minos, sdk: sdk, linkType: .static, log?.indented()) }
36+
do {
37+
try rewriteBinary(
38+
rewritePath: objectPath,
39+
minos: minos,
40+
sdk: sdk,
41+
linkType: .static,
42+
log?.indented())
43+
}
3644
catch let error as TransmogrifierError {
3745
switch error {
3846
case .alreadyProcessed:
39-
log?.indented().callAsFunction(.verbose, "- 🍎 \(objectPath.string) is already simulator object")
47+
log?(.verbose, "Found LC_BUILD_VERSION, try vtool replace IOSSIMULATOR(7)")
48+
let renamed = Path(objectPath.string + "_old")
49+
try rename(current: objectPath, destination: renamed, log?.indented())
50+
try vRewriteBinary(
51+
input: renamed,
52+
output: objectPath,
53+
minos: minos,
54+
sdk: sdk,
55+
log?.indented())
4056
case .noSupportedFormat(let message):
4157
log?.indented().callAsFunction(.verbose, message)
42-
fatalError(message)
58+
throw error
4359
case .noCorrectBinary(let message):
4460
log?.indented().callAsFunction(.verbose, message)
45-
fatalError(message)
61+
throw error
4662
default:
47-
fatalError("Unintentional errors, Path not found")
63+
throw error
4864
}
4965
} catch {
5066
throw error

Sources/RanasaCore/Actions/VToolEdit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public extension VToolEdit {
1717
runShellCommand: RunShellCommand = .live()
1818
) -> Self {
1919
.init { input, output, minos, sdk, log in
20-
log?(.normal, "[Rewrite Dynamic Library]")
20+
log?(.normal, "[Rewrite LC_Build_Version]")
2121
log?(.verbose, "- input: \(input.string)")
2222
log?(.verbose, "- output: \(output.string)")
2323

0 commit comments

Comments
 (0)