Skip to content

Commit

Permalink
Merge pull request #509 from splendo/feature/#235-use-composite-build…
Browse files Browse the repository at this point in the history
…-in-example-project

Feature/#235 use composite build in example project
  • Loading branch information
thoutbeckers authored May 11, 2022
2 parents dc206c2 + 2e8f1ef commit 08b3b2c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 248 deletions.
2 changes: 1 addition & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ For example if the version in `ext.gradle` is `1.1` and `feature/123_fix_bug` is

Before doing any publishing, make sure that changes are working with the one available in [Nexus Repository Manager](`oss.sonatype.org`). Test both on Android and iOS example app just adding the following code inside the `local.properties` file:
```
kaluga.exampleAsRoot=true
kaluga.exampleEmbeddingMethod=composite
kaluga.exampleMavenRepo=https://oss.sonatype.org/service/local/repositories/comsplendo-REPO_NUMBER/content/
kaluga.libraryVersion=LIBRARY_VERSION
```
Expand Down
84 changes: 0 additions & 84 deletions cloudbuild.yaml

This file was deleted.

29 changes: 3 additions & 26 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,9 @@ apply from: "../../gradle/android_compose.gradle"
gradle.ext.component_type = gradle.ext.component_type_default

dependencies {

if (gradle.ext.example_as_root) {
// if the example is the root we use a maven dependency instead of the project
implementation "com.splendo.kaluga:architecture-compose:$gradle.ext.library_version"
implementation "com.splendo.kaluga:resources-compose:$gradle.ext.library_version"
implementation project(':shared')
}
else {
implementation project(':shared')
implementation project(":base-permissions")
implementation project(":location-permissions")
implementation project(":bluetooth-permissions")
implementation project(":camera-permissions")
implementation project(":contacts-permissions")
implementation project(":microphone-permissions")
implementation project(":storage-permissions")
implementation project(":notifications-permissions")
implementation project(":calendar-permissions")
implementation project(":logging")
implementation project(":alerts")
implementation project(":hud")
implementation project(":architecture")
implementation project(":architecture-compose")
implementation project(":resources")
implementation project(":resources-compose")
}
implementation "com.splendo.kaluga:architecture-compose:$gradle.ext.library_version"
implementation "com.splendo.kaluga:resources-compose:$gradle.ext.library_version"
implementation project(':shared')

implementation "androidx.fragment:fragment-ktx:$gradle.androidx_fragment_version"
implementation "com.google.android.gms:play-services-location:$gradle.play_services_version"
Expand Down
83 changes: 4 additions & 79 deletions example/ios/Supporting Files/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,85 +43,10 @@ apply("../../../gradle/ext.gradle")

val ext = (gradle as ExtensionAware).extra

if (!(ext["example_as_root"] as Boolean)) {

include(":alerts")
project(":alerts").projectDir = file("../../../alerts")

include(":architecture")
project(":architecture").projectDir = file("../../../architecture")

include(":architecture-compose")
project(":architecture-compose").projectDir = file("../../../architecture-compose")

include(":base")
project(":base").projectDir = file("../../../base")

include(":bluetooth")
project(":bluetooth").projectDir = file("../../../bluetooth")

include(":beacons")
project(":beacons").projectDir = file("../../../beacons")

include(":date-time-picker")
project(":date-time-picker").projectDir = file("../../../date-time-picker")

include(":hud")
project(":hud").projectDir = file("../../../hud")

include(":keyboard")
project(":keyboard").projectDir = file("../../../keyboard")

include(":links")
project(":links").projectDir = file("../../../links")

include(":location")
project(":location").projectDir = file("../../../location")

include(":logging")
project(":logging").projectDir = file("../../../logging")

include(":base-permissions")
project(":base-permissions").projectDir = file("../../../base-permissions")

include(":location-permissions")
project(":location-permissions").projectDir = file("../../../location-permissions")

include(":bluetooth-permissions")
project(":bluetooth-permissions").projectDir = file("../../../bluetooth-permissions")

include(":camera-permissions")
project(":camera-permissions").projectDir = file("../../../camera-permissions")

include(":contacts-permissions")
project(":contacts-permissions").projectDir = file("../../../contacts-permissions")

include(":microphone-permissions")
project(":microphone-permissions").projectDir = file("../../../microphone-permissions")

include(":storage-permissions")
project(":storage-permissions").projectDir = file("../../../storage-permissions")

include(":notifications-permissions")
project(":notifications-permissions").projectDir = file("../../../notifications-permissions")

include(":calendar-permissions")
project(":calendar-permissions").projectDir = file("../../../calendar-permissions")

include(":resources")
project(":resources").projectDir = file("../../../resources")

include(":resources-compose")
project(":resources-compose").projectDir = file("../../../resources-compose")

include(":review")
project(":review").projectDir = file("../../../review")

include(":system")
project(":system").projectDir = file("../../../system")

include(":test-utils")
project(":test-utils").projectDir = file("../../../test-utils")
when (ext["example_embedding_method"] ) {
"composite" -> {
includeBuild("../../..")
}
}

include(":android")
Expand Down
2 changes: 1 addition & 1 deletion example/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The example app can load the main components either through your (local) maven r

The advantage of using a gradle module is that you can edit the source of components and run them in the example right away, without needing to publish them to maven first.

By default maven is not used for resolving dependencies (instead the individual kaluga modules are imported as project modules). To enable using maven usage put the property `kaluga.exampleAsRoot=true` in the `local.properties` file in the root of the project (this file is already generated by your IDE normally).
By default kaluga dependency is included as a composite build. You also can put the property `kaluga.exampleEmbeddingMethod=composite` in the `local.properties` file in the root of the project (this file is already generated by your IDE normally) to specify it explicitly. To enable maven use `kaluga.exampleEmbeddingMethod=maven`.

You can also set the `kaluga.exampleMavenRepo` property to specify which maven repo to look in. By default this is `mavenLocal()` (this can also be used by explicitly setting the value `local`). For example to set this to the sonatype snapshot repository use:

Expand Down
74 changes: 24 additions & 50 deletions example/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,30 @@ kotlin {
val ext = (gradle as ExtensionAware).extra

dependencies {
if (!(ext["example_as_root"] as Boolean)) {
api(project(":alerts", ""))
api(project(":architecture", ""))
api(project(":base", ""))
api(project(":bluetooth", ""))
api(project(":beacons", ""))
api(project(":date-time-picker", ""))
api(project(":hud", ""))
api(project(":keyboard", ""))
api(project(":links", ""))
api(project(":location", ""))
api(project(":logging", ""))
api(project(":base-permissions", ""))
api(project(":location-permissions", ""))
api(project(":bluetooth-permissions", ""))
api(project(":camera-permissions", ""))
api(project(":contacts-permissions", ""))
api(project(":microphone-permissions", ""))
api(project(":storage-permissions", ""))
api(project(":notifications-permissions", ""))
api(project(":calendar-permissions", ""))
api(project(":resources", ""))
api(project(":review", ""))
api(project(":system", ""))
} else {
val libraryVersion = ext["library_version"]
api("com.splendo.kaluga:alerts:$libraryVersion")
api("com.splendo.kaluga:architecture:$libraryVersion")
api("com.splendo.kaluga:base:$libraryVersion")
api("com.splendo.kaluga:bluetooth:$libraryVersion")
api("com.splendo.kaluga:beacons:$libraryVersion")
api("com.splendo.kaluga:date-time-picker:$libraryVersion")
api("com.splendo.kaluga:hud:$libraryVersion")
api("com.splendo.kaluga:keyboard:$libraryVersion")
api("com.splendo.kaluga:links:$libraryVersion")
api("com.splendo.kaluga:location:$libraryVersion")
api("com.splendo.kaluga:logging:$libraryVersion")
api("com.splendo.kaluga:resources:$libraryVersion")
api("com.splendo.kaluga:review:$libraryVersion")
api("com.splendo.kaluga:system:$libraryVersion")
api("com.splendo.kaluga:base-permissions:$libraryVersion")
api("com.splendo.kaluga:location-permissions:$libraryVersion")
api("com.splendo.kaluga:bluetooth-permissions:$libraryVersion")
api("com.splendo.kaluga:camera-permissions:$libraryVersion")
api("com.splendo.kaluga:contacts-permissions:$libraryVersion")
api("com.splendo.kaluga:microphone-permissions:$libraryVersion")
api("com.splendo.kaluga:storage-permissions:$libraryVersion")
api("com.splendo.kaluga:notifications-permissions:$libraryVersion")
api("com.splendo.kaluga:calendar-permissions:$libraryVersion")
}
val libraryVersion = ext["library_version"]
api("com.splendo.kaluga:alerts:$libraryVersion")
api("com.splendo.kaluga:architecture:$libraryVersion")
api("com.splendo.kaluga:base:$libraryVersion")
api("com.splendo.kaluga:bluetooth:$libraryVersion")
api("com.splendo.kaluga:beacons:$libraryVersion")
api("com.splendo.kaluga:date-time-picker:$libraryVersion")
api("com.splendo.kaluga:hud:$libraryVersion")
api("com.splendo.kaluga:keyboard:$libraryVersion")
api("com.splendo.kaluga:links:$libraryVersion")
api("com.splendo.kaluga:location:$libraryVersion")
api("com.splendo.kaluga:logging:$libraryVersion")
api("com.splendo.kaluga:resources:$libraryVersion")
api("com.splendo.kaluga:review:$libraryVersion")
api("com.splendo.kaluga:system:$libraryVersion")
api("com.splendo.kaluga:base-permissions:$libraryVersion")
api("com.splendo.kaluga:location-permissions:$libraryVersion")
api("com.splendo.kaluga:bluetooth-permissions:$libraryVersion")
api("com.splendo.kaluga:camera-permissions:$libraryVersion")
api("com.splendo.kaluga:contacts-permissions:$libraryVersion")
api("com.splendo.kaluga:microphone-permissions:$libraryVersion")
api("com.splendo.kaluga:storage-permissions:$libraryVersion")
api("com.splendo.kaluga:notifications-permissions:$libraryVersion")
api("com.splendo.kaluga:calendar-permissions:$libraryVersion")
}
}
}
Expand Down
13 changes: 6 additions & 7 deletions gradle/ext.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (propFile.exists()) {
}

String libraryVersionLocalProperties = props["kaluga.libraryVersion"]
String exampleAsRootLocalProperties = props["kaluga.exampleAsRoot"]
String exampleEmbeddingMethodLocalProperties = props["kaluga.exampleEmbeddingMethod"]
String exampleMavenRepoLocalProperties = props["kaluga.exampleMavenRepo"]
String kotlinVersion = getProperty("kaluga.kotlinVersion")

Expand Down Expand Up @@ -80,13 +80,12 @@ gradle.ext {
component_type = component_type_default
}

if (System.env.containsKey("EXAMPLE_AS_ROOT")) {
gradle.ext.example_as_root = Boolean.parseBoolean(System.env.EXAMPLE_AS_ROOT)
logger.lifecycle "System env EXAMPLE_AS_ROOT set to $System.env.EXAMPLE_AS_ROOT, using $gradle.ext.example_as_root"
if (System.env.containsKey("EXAMPLE_EMBEDDING_METHOD")) {
gradle.ext.example_embedding_method = System.env.EXAMPLE_EMBEDDING_METHOD
logger.lifecycle "System env EXAMPLE_EMBEDDING_METHOD set to $System.env.EXAMPLE_EMBEDDING_METHOD, using $gradle.ext.example_embedding_method"
} else {
// load some more from local.properties or set defaults.
gradle.ext.example_as_root = exampleAsRootLocalProperties?.toBoolean() ?: false
logger.lifecycle "local.properties read (kaluga.exampleAsRoot=$exampleAsRootLocalProperties, using $gradle.ext.example_as_root)"
gradle.ext.example_embedding_method = exampleEmbeddingMethodLocalProperties ?: "composite"
logger.lifecycle "local.properties read (kaluga.exampleEmbeddingMethod=$exampleEmbeddingMethodLocalProperties, using $gradle.ext.example_embedding_method)"
}

if (System.env.containsKey("EXAMPLE_MAVEN_REPO")) {
Expand Down

0 comments on commit 08b3b2c

Please sign in to comment.