Skip to content

Commit a33adb6

Browse files
author
Konrad Stanik
committed
Updated README.md according to versioning logic changes applied.
Introduced upToNextMajor, upToNextMinor, branch and revision versioning strategies.
1 parent 53b4f00 commit a33adb6

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,26 @@ plugins {
2222
1. Define multiplatform targets (`macos`, `ios`, `tvos`, `watchos`).
2323
2. Declare a `spm` section with all the necessary package dependencies for each platform.
2424
3. Add package dependencies with URL link, version and name. This name would be used as an import in the Kotlin project.
25+
Plugin supports all package versioning strategies described here: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html
26+
and provides convenient methods to define them:
27+
28+
```
29+
fun fromVersion(version: String)
30+
31+
fun exactVersion(version: String)
32+
33+
fun versionRange(minVersion: String, maxVersion: String)
34+
35+
fun versionClosedRange(minVersion: String, maxVersion: String)
2536
37+
fun upToNextMajor(version: String)
38+
39+
fun upToNextMinor(version: String)
40+
41+
fun branch(branchName: String)
42+
43+
fun revision(ref: String)
44+
```
2645
`build.gradle.kts` example:
2746

2847
```kotlin
@@ -34,7 +53,7 @@ plugins {
3453
dependencies {
3554
packages(
3655
url = "https://github.com/AFNetworking/AFNetworking.git",
37-
version = "4.0.0",
56+
version = exactVersion("4.0.0"),
3857
name = "AFNetworking"
3958
)
4059
}

example/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ kotlin {
1818
dependencies {
1919
packages(
2020
url = "https://github.com/AFNetworking/AFNetworking.git",
21-
version = exactVersion("4.0.1"),
21+
version = exactVersion("4eaec5b"),
2222
name = "AFNetworking"
2323
)
2424
}

plugin-build/plugin/src/main/java/com/github/pagr0m/kotlin/native/spm/entity/impl/DependencyManager.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ class DependencyManager {
3636

3737
fun versionClosedRange(minVersion: String, maxVersion: String) = "\"$minVersion\"...\"$maxVersion\""
3838

39+
fun upToNextMajor(version: String) = ".upToNextMajor(from: \"$version\")"
40+
41+
fun upToNextMinor(version: String) = ".upToNextMinor(from: \"$version\")"
42+
43+
fun branch(branchName: String) = ".branch(\"$branchName\")"
44+
45+
fun revision(ref: String) = ".revision(\"$ref\")"
46+
3947
data class Package(
4048
@Input val url: String,
4149
@Input @Optional val version: String? = null,

0 commit comments

Comments
 (0)