Fix tests for Jenkins that always build for iOS
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable
This commit is contained in:
parent
ae7c0abbc2
commit
1dbf4c643d
@ -22,7 +22,13 @@ struct Twine: ParsableCommand {
|
|||||||
|
|
||||||
static let toolName = "Twine"
|
static let toolName = "Twine"
|
||||||
static let defaultExtensionName = "String"
|
static let defaultExtensionName = "String"
|
||||||
static let twineExecutable = "\(FileManager.default.homeDirectoryForCurrentUser.relativePath)/scripts/twine/twine"
|
static let twineExecutable: String = {
|
||||||
|
#if os(macOS)
|
||||||
|
"\(FileManager.default.homeDirectoryForCurrentUser.relativePath)/scripts/twine/twine"
|
||||||
|
#else
|
||||||
|
fatalError("This command should run on Mac only")
|
||||||
|
#endif
|
||||||
|
}()
|
||||||
|
|
||||||
// MARK: - Command Options
|
// MARK: - Command Options
|
||||||
|
|
||||||
|
@ -13,34 +13,12 @@ public class Shell {
|
|||||||
ProcessInfo.processInfo.environment
|
ProcessInfo.processInfo.environment
|
||||||
}
|
}
|
||||||
|
|
||||||
// @discardableResult
|
|
||||||
// public static func shell(launchPath: String = "/usr/bin/env", _ args: String...) -> (terminationStatus: Int32, output: String?) {
|
|
||||||
// let task = Process()
|
|
||||||
// task.launchPath = launchPath
|
|
||||||
// task.arguments = args
|
|
||||||
//
|
|
||||||
// var currentEnv = ProcessInfo.processInfo.environment
|
|
||||||
// for (key, value) in environment {
|
|
||||||
// currentEnv[key] = value
|
|
||||||
// }
|
|
||||||
// task.environment = currentEnv
|
|
||||||
//
|
|
||||||
// let pipe = Pipe()
|
|
||||||
// task.standardOutput = pipe
|
|
||||||
// try? task.run()
|
|
||||||
// task.waitUntilExit()
|
|
||||||
//
|
|
||||||
// let data = pipe.fileHandleForReading.readDataToEndOfFile()
|
|
||||||
//
|
|
||||||
// guard let output: String = String(data: data, encoding: .utf8) else {
|
|
||||||
// return (terminationStatus: task.terminationStatus, output: nil)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (terminationStatus: task.terminationStatus, output: output)
|
|
||||||
// }
|
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public static func shell(launchPath: String = "/usr/bin/env", _ args: [String]) -> (terminationStatus: Int32, output: String?) {
|
public static func shell(
|
||||||
|
launchPath: String = "/usr/bin/env",
|
||||||
|
_ args: [String]
|
||||||
|
) -> (terminationStatus: Int32, output: String?) {
|
||||||
|
#if os(macOS)
|
||||||
let task = Process()
|
let task = Process()
|
||||||
task.launchPath = launchPath
|
task.launchPath = launchPath
|
||||||
task.arguments = args
|
task.arguments = args
|
||||||
@ -63,5 +41,8 @@ public class Shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (terminationStatus: task.terminationStatus, output: output)
|
return (terminationStatus: task.terminationStatus, output: output)
|
||||||
|
#else
|
||||||
|
fatalError("Shell is only available on Mac")
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,11 @@ public extension String {
|
|||||||
|
|
||||||
func replaceTiltWithHomeDirectoryPath() -> Self {
|
func replaceTiltWithHomeDirectoryPath() -> Self {
|
||||||
// See NSString.expandingTildeInPath
|
// See NSString.expandingTildeInPath
|
||||||
|
#if os(macOS)
|
||||||
replacingOccurrences(of: "~", with: "\(FileManager.default.homeDirectoryForCurrentUser.relativePath)")
|
replacingOccurrences(of: "~", with: "\(FileManager.default.homeDirectoryForCurrentUser.relativePath)")
|
||||||
|
#else
|
||||||
|
fatalError("This command should run on Mac only")
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func colorComponent() -> (alpha: String, red: String, green: String, blue: String) {
|
func colorComponent() -> (alpha: String, red: String, green: String, blue: String) {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Created by Loris Perret on 06/12/2023.
|
// Created by Loris Perret on 06/12/2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@ -135,3 +137,5 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
|||||||
XCTAssertEqual(propertyEvent.adaptForXCTest(), expectEvent.adaptForXCTest())
|
XCTAssertEqual(propertyEvent.adaptForXCTest(), expectEvent.adaptForXCTest())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Created by Thibaut Schmitt on 06/09/2022.
|
// Created by Thibaut Schmitt on 06/09/2022.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
import ToolCore
|
import ToolCore
|
||||||
@ -58,7 +60,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
extensionName: "GenAnalytics")
|
extensionName: "GenAnalytics")
|
||||||
// Expect Analytics
|
// Expect Analytics
|
||||||
let expect = """
|
let expect = """
|
||||||
// Generated by ResgenSwift.Analytics 1.2
|
// Generated by ResgenSwift.Analytics \(ResgenSwiftVersion)
|
||||||
|
|
||||||
import FirebaseAnalytics
|
import FirebaseAnalytics
|
||||||
|
|
||||||
@ -229,7 +231,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
extensionName: "GenAnalytics")
|
extensionName: "GenAnalytics")
|
||||||
// Expect Analytics
|
// Expect Analytics
|
||||||
let expect = """
|
let expect = """
|
||||||
// Generated by ResgenSwift.Analytics 1.2
|
// Generated by ResgenSwift.Analytics \(ResgenSwiftVersion)
|
||||||
|
|
||||||
import MatomoTracker
|
import MatomoTracker
|
||||||
|
|
||||||
@ -422,7 +424,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
extensionName: "GenAnalytics")
|
extensionName: "GenAnalytics")
|
||||||
// Expect Analytics
|
// Expect Analytics
|
||||||
let expect = """
|
let expect = """
|
||||||
// Generated by ResgenSwift.Analytics 1.2
|
// Generated by ResgenSwift.Analytics \(ResgenSwiftVersion)
|
||||||
|
|
||||||
import MatomoTracker
|
import MatomoTracker
|
||||||
import FirebaseAnalytics
|
import FirebaseAnalytics
|
||||||
@ -633,3 +635,5 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest())
|
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Created by Loris Perret on 06/12/2023.
|
// Created by Loris Perret on 06/12/2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@ -70,3 +72,5 @@ final class AnalyticsSectionTests: XCTestCase {
|
|||||||
XCTAssertFalse(match3)
|
XCTAssertFalse(match3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -14,9 +14,8 @@ final class ResgenCLITests: XCTestCase {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mac Catalyst won't have `Process`, but it is supported for executables.
|
// Process available on Mac only
|
||||||
#if !targetEnvironment(macCatalyst)
|
#if os(macOS)
|
||||||
|
|
||||||
let fooBinary = productsDirectory.appendingPathComponent("ResgenSwift")
|
let fooBinary = productsDirectory.appendingPathComponent("ResgenSwift")
|
||||||
|
|
||||||
let process = Process()
|
let process = Process()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user