Skip to content

Declare custom Package.swift template and its properties #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: next-release
Choose a base branch
from

Conversation

ge-org
Copy link
Owner

@ge-org ge-org commented Nov 29, 2020

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

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

@ge-org ge-org marked this pull request as draft November 29, 2020 17:52
@ge-org ge-org added this to the 2.1.x milestone Nov 29, 2020
@sebarthel89
Copy link

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

@ge-org
Copy link
Owner Author

ge-org commented Dec 1, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants