DEVTOOLS-186 Exporter les images de resgen en svg #12
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -1,6 +1,6 @@
|
|||||||
library "openiumpipeline"
|
library "openiumpipeline"
|
||||||
|
|
||||||
env.DEVELOPER_DIR="/Applications/Xcode-15.3.0.app/Contents/Developer"
|
env.DEVELOPER_DIR="/Applications/Xcode-15.4.0.app/Contents/Developer"
|
||||||
//env.SIMULATOR_DEVICE_TYPES="iPad--7th-generation-"
|
//env.SIMULATOR_DEVICE_TYPES="iPad--7th-generation-"
|
||||||
env.IS_PACKAGE_SWIFT=1
|
env.IS_PACKAGE_SWIFT=1
|
||||||
env.TARGETS_MACOS=1
|
env.TARGETS_MACOS=1
|
||||||
|
@ -68,8 +68,15 @@ class XcassetsGenerator {
|
|||||||
let output3x = "\(imagesetPath)/\(parsedImage.name)@3x.\(OutputImageExtension.png.rawValue)"
|
let output3x = "\(imagesetPath)/\(parsedImage.name)@3x.\(OutputImageExtension.png.rawValue)"
|
||||||
|
|
||||||
// Check if we need to convert image
|
// Check if we need to convert image
|
||||||
guard self.shouldGenerate(inputImagePath: imageData.path, xcassetImagePath: output1x) else {
|
|
||||||
//print("\(parsedImage.name) -> Not regenerating")
|
var needToGenerateForSvg = false
|
||||||
|
|
||||||
|
if imageData.ext == "svg" && !parsedImage.imageExtensions.contains(.png) {
|
||||||
|
needToGenerateForSvg = true
|
||||||
|
}
|
||||||
|
|
||||||
|
guard self.shouldGenerate(inputImagePath: imageData.path, xcassetImagePath: output1x, needToGenerateForSvg: needToGenerateForSvg) else {
|
||||||
|
print("\(parsedImage.name) -> Not regenerating")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +90,15 @@ class XcassetsGenerator {
|
|||||||
print(error.description)
|
print(error.description)
|
||||||
Images.exit(withError: error)
|
Images.exit(withError: error)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
do {
|
||||||
|
let documentsDirectory = try fileManager.contentsOfDirectory(atPath: imagesetPath)
|
||||||
|
for filePath in documentsDirectory {
|
||||||
|
try fileManager.removeItem(atPath: "\(imagesetPath)/\(filePath)")
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
print("Error deleting previous assets")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let convertArguments = parsedImage.convertArguments
|
let convertArguments = parsedImage.convertArguments
|
||||||
@ -181,8 +197,8 @@ class XcassetsGenerator {
|
|||||||
|
|
||||||
// MARK: - Helpers: bypass generation
|
// MARK: - Helpers: bypass generation
|
||||||
|
|
||||||
private func shouldGenerate(inputImagePath: String, xcassetImagePath: String) -> Bool {
|
private func shouldGenerate(inputImagePath: String, xcassetImagePath: String, needToGenerateForSvg: Bool) -> Bool {
|
||||||
if forceGeneration {
|
if forceGeneration || needToGenerateForSvg {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user