Skip to content

Commit 1a7f4c5

Browse files
Merge pull request #953 from square/sedwards/targets-property
Add Property for Target Selection
2 parents d1439ac + dccc253 commit 1a7f4c5

File tree

5 files changed

+53
-21
lines changed

5 files changed

+53
-21
lines changed

RELEASING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
```
1313
NOTE: If you have any unexpected errors in the build or tests and they are related to non-jvm
1414
targets you may need to update your XCode or other iOS tools. See note in the workflow-core and
15-
workflow-runtime modules.
15+
workflow-runtime modules. Alternatively you can specify only the target you care about (while
16+
developing - do not do this for actual releases) with the property `workflow.targets` which is
17+
set to any of `kmp`, `jvm`, `ios`, or `js`.
1618

1719
1. Update your tags.
1820
```bash

workflow-core/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ are `jvm`, `ios`, and `iosSimulatorSimulatorArm64`. If you are having issues wit
99
ensure you have the correct version of XCode installed and can launch a simulator as it's specified
1010
in the gradle build file (Currently iPhone 14).
1111

12+
You can also choose to specify your targets for build and test with the property `workflow.targets`
13+
as either `kmp`, `jvm`, `ios`, `js`. The default is `kmp` (all the targets). Set this in your
14+
global `~/.gradle/gradle.properties` or specify the property in your gradle command, e.g.:
15+
16+
```bash
17+
./gradlew build -Pworkflow.targets=jvm
18+
```
19+
1220
## Notes on Dispatchers
1321

1422
_Dispatchers control what threads/pools coroutines are run on. [See here for more information.][1]_

workflow-core/build.gradle.kts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ plugins {
66
}
77

88
kotlin {
9-
iosWithSimulatorArm64()
10-
jvm { withJava() }
11-
js { browser() }
9+
val targets = project.findProperty("workflow.targets") ?: "kmp"
10+
if (targets == "kmp" || targets == "ios") {
11+
iosWithSimulatorArm64()
12+
}
13+
if (targets == "kmp" || targets == "jvm") {
14+
jvm { withJava() }
15+
}
16+
if (targets == "kmp" || targets == "js") {
17+
js { browser() }
18+
}
1219
}
1320

1421
dependencies {

workflow-runtime/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ This module is a Kotlin Multiplatform module. The targets currently included for
88
are `jvm`, `ios`, and `iosSimulatorSimulatorArm64`. If you are having issues with the tests,
99
ensure you have the correct version of XCode installed and can launch a simulator as it's specified
1010
in the gradle build file (Currently iPhone 14).
11+
12+
You can also choose to specify your targets for build and test with the property `workflow.targets`
13+
as either `kmp`, `jvm`, `ios`, `js`. The default is `kmp` (all the targets). Set this in your
14+
global `~/.gradle/gradle.properties` or specify the property in your gradle command, e.g.:
15+
16+
```bash
17+
./gradlew build -Pworkflow.targets=jvm
18+
```

workflow-runtime/build.gradle.kts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,37 @@ plugins {
99
}
1010

1111
kotlin {
12-
iosWithSimulatorArm64()
13-
jvm {
14-
compilations {
15-
val main by getting
12+
val targets = project.findProperty("workflow.targets") ?: "kmp"
13+
if (targets == "kmp" || targets == "ios") {
14+
iosWithSimulatorArm64()
15+
}
16+
if (targets == "kmp" || targets == "jvm") {
17+
jvm {
18+
compilations {
19+
val main by getting
1620

17-
create("workflowNode") {
18-
val workflowNodeCompilation: KotlinJvmCompilation = this
19-
kotlinOptions {
20-
// Associating compilations allows us to access declarations with `internal` visibility.
21-
// It's the new version of the "-Xfriend-paths=___" compiler argument.
22-
// https://youtrack.jetbrains.com/issue/KTIJ-7662/IDE-support-internal-visibility-introduced-by-associated-compilations
23-
workflowNodeCompilation.associateWith(main)
24-
}
25-
defaultSourceSet {
26-
dependencies {
27-
implementation(libs.kotlinx.benchmark.runtime)
21+
create("workflowNode") {
22+
val workflowNodeCompilation: KotlinJvmCompilation = this
23+
kotlinOptions {
24+
// Associating compilations allows us to access declarations with `internal` visibility.
25+
// It's the new version of the "-Xfriend-paths=___" compiler argument.
26+
// https://youtrack.jetbrains.com/issue/KTIJ-7662/IDE-support-internal-visibility-introduced-by-associated-compilations
27+
workflowNodeCompilation.associateWith(main)
28+
}
29+
defaultSourceSet {
30+
dependencies {
31+
implementation(libs.kotlinx.benchmark.runtime)
2832

29-
implementation(main.compileDependencyFiles + main.output.classesDirs)
33+
implementation(main.compileDependencyFiles + main.output.classesDirs)
34+
}
3035
}
3136
}
3237
}
3338
}
3439
}
35-
js { browser() }
40+
if (targets == "kmp" || targets == "js") {
41+
js { browser() }
42+
}
3643
}
3744

3845
dependencies {

0 commit comments

Comments
 (0)