Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions Sources/SkipBuild/Commands/TranspileCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,37 @@ struct TranspileCommand: TranspilePhase, StreamingCommand {
}

func generateGradleProperties() throws {
// TODO: assemble these from skip.yml settings
let gradlePropertiesPath = moduleRootPath.parentDirectory.appending(component: "gradle.properties")
let gradePropertiesContents = FrameworkProjectLayout.defaultGradleProperties()

let defaultPropertiesString = FrameworkProjectLayout.defaultGradleProperties()
var properties: [String: String] = [:]

for line in defaultPropertiesString.components(separatedBy: .newlines) {
let trimmed = line.trimmingCharacters(in: .whitespaces)
if trimmed.isEmpty || trimmed.hasPrefix("#") {
continue
}
let parts = trimmed.split(separator: "=", maxSplits: 1)
if parts.count == 2 {
let key = String(parts[0]).trimmingCharacters(in: .whitespaces)
let value = String(parts[1]).trimmingCharacters(in: .whitespaces)
properties[key] = value
}
}

// Merge with custom properties from skip.yml (custom properties override defaults)
if let customProperties = skipConfig.gradleProperties {
for (key, value) in customProperties {
properties[key] = value
}
}

var gradePropertiesContents = ""
for (key, value) in properties.sorted(by: { $0.key < $1.key }) {
gradePropertiesContents += "\(key)=\(value)\n"
}
gradePropertiesContents += "\n"

try writeChanges(tag: "gradle config", to: gradlePropertiesPath, contents: gradePropertiesContents.utf8Data, readOnly: true)
}
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/SkipBuild/SkipConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ struct SkipConfig : Codable {

/// The native toolchain info
var toolchain: SkipToolchain?

/// Custom gradle.properties key-value pairs
var gradleProperties: [String: String]?
}

struct TranspilationConfig : Codable {
Expand Down