multiplatform-swiftpackage icon indicating copy to clipboard operation
multiplatform-swiftpackage copied to clipboard

Declare custom Package.swift template and its properties

Open ge-org opened this issue 4 years ago • 2 comments

DSL Syntax

import com.chromaticnoise.multiplatformswiftpackage.dsl.TemplateKey.*

multiplatformSwiftPackage {
    packageTemplate(File(project.projectDir, "custom-package.template")) {
        packageName = "customized" // some properties can be accessed directly
        set("myProp", "my custom value") // custom key/value pairs can be added
        set(ToolsVersion, "42") // all default keys can be accessed in type-safe manner
    }
}

TODOs

  • [x] Tests
  • [ ] Throw exception if template file does not exist
  • [ ] Verify that generated swift package file is valid (or at least parseable by Swift)
  • [x] Expose default keys as public enum
  • [ ] Update README
  • [ ] Update CHANGELOG

ge-org avatar Nov 29 '20 17:11 ge-org

Looking forward to this PR. I tried to import a created swift package, but it failed by not finding a Package.swift .

SomeProject has no Package.swift manifest

sebarthel89 avatar Dec 01 '20 15:12 sebarthel89

Hi @sebarthel89,

how did you add the Package.swift file to the project? This should already be possible without this PR. It should work by executing ./gradlew createSwiftPackage and then dragging the swiftpackage folder into the Xcode project. Then add the XCFramework to the Frameworks, Libraries, and Embedded Content section in the project settings.

ge-org avatar Dec 01 '20 17:12 ge-org