Skip to content

Commit 2867437

Browse files
committed
chore: rework dependency resolution and add integration guide to the README
1 parent 190982a commit 2867437

File tree

11 files changed

+55
-49
lines changed

11 files changed

+55
-49
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ The Kotlin Composable Architecture is a companion library for the amazing [Swift
77

88
⚠️ **Please note that this repository is a work in progress; there is no stable release available.**
99

10+
## Getting started
11+
12+
Until there is no stable release available, the easiest way to integrate the library into your project is to use [Gradle's `includeBuild()` feature](https://publicobject.com/2021/03/11/includebuild/).
13+
14+
```kotlin
15+
// in build.gradle.kts
16+
implementation("composable-architecture:composable-architecture:0.1.0")
17+
```
18+
19+
```kotlin
20+
// in settings.gradle.kts
21+
includeBuild("<PATH TO kotlin-composable-architecture>") {
22+
dependencySubstitution {
23+
substitute(module("composable-architecture:composable-architecture"))
24+
.with(project(":composable-architecture"))
25+
}
26+
}
27+
```
28+
1029
## What is the Composable Architecture?
1130

1231
This library provides a few core tools that can be used to build applications of varying purpose and complexity. It provides compelling stories that you can follow to solve many problems you encounter day-to-day when building applications, such as:

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ allprojects {
2626

2727
kotlinOptions.jvmTarget = "1.8"
2828
}
29+
30+
project.version = "0.1.0"
2931
}
3032

3133
tasks.register<Delete>("clean") {

buildSrc/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ repositories {
1212
jcenter()
1313
}
1414

15-
private val properties = Properties().apply { File("gradle.properties").inputStream().use { load(it) } }
15+
private val properties = Properties()
16+
.apply { File(rootDir.parentFile, "gradle.properties").inputStream().use { load(it) } }
1617

1718
val androidToolsBuildVersion = properties.getProperty("androidToolsBuildVersion")
1819
val kotlinVersion = properties.getProperty("kotlinVersion")

buildSrc/gradle.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
@file:Suppress("HasPlatformType")
2-
1+
import org.gradle.api.Project
32
import java.io.File
43
import java.util.Properties
54

6-
private val properties = Properties().apply { File("gradle.properties").inputStream().use { load(it) } }
7-
85
// Versions
9-
val androidToolsBuildVersion = properties.getProperty("androidToolsBuildVersion")
10-
val androidxActivityVersion = properties.getProperty("androidxActivityVersion")
11-
val androidxAppcompatVersion = properties.getProperty("androidxAppcompatVersion")
12-
val androidxConstraintLayoutVersion = properties.getProperty("androidxConstraintLayoutVersion")
13-
val androidxCoreVersion = properties.getProperty("androidxCoreVersion")
14-
val androidxDynamicAnimationVersion = properties.getProperty("androidxDynamicAnimationVersion")
15-
val androidxEspressoVersion = properties.getProperty("androidxEspressoVersion")
16-
val androidxJunitVersion = properties.getProperty("androidxJunitVersion")
17-
val androidxLifecycleVersion = properties.getProperty("androidxLifecycleVersion")
18-
val androidxRecyclerviewVersion = properties.getProperty("androidxRecyclerviewVersion")
19-
val arrowVersion = properties.getProperty("arrowVersion")
20-
val coroutinesVersion = properties.getProperty("coroutinesVersion")
21-
val junitVersion = properties.getProperty("junitVersion")
22-
val kotlinComposeVersion = properties.getProperty("kotlinComposeVersion")
23-
val kotlinVersion = properties.getProperty("kotlinVersion")
24-
val moshiVersion = properties.getProperty("moshiVersion")
25-
val okhttpVersion = properties.getProperty("okhttpVersion")
26-
val retrofitVersion = properties.getProperty("retrofitVersion")
6+
val Project.androidToolsBuildVersion: String get() = props.getProperty("androidToolsBuildVersion")
7+
val Project.androidxActivityVersion: String get() = props.getProperty("androidxActivityVersion")
8+
val Project.androidxAppcompatVersion: String get() = props.getProperty("androidxAppcompatVersion")
9+
val Project.androidxConstraintLayoutVersion: String get() = props.getProperty("androidxConstraintLayoutVersion")
10+
val Project.androidxCoreVersion: String get() = props.getProperty("androidxCoreVersion")
11+
val Project.androidxDynamicAnimationVersion: String get() = props.getProperty("androidxDynamicAnimationVersion")
12+
val Project.androidxEspressoVersion: String get() = props.getProperty("androidxEspressoVersion")
13+
val Project.androidxJunitVersion: String get() = props.getProperty("androidxJunitVersion")
14+
val Project.androidxLifecycleVersion: String get() = props.getProperty("androidxLifecycleVersion")
15+
val Project.androidxRecyclerviewVersion: String get() = props.getProperty("androidxRecyclerviewVersion")
16+
val Project.arrowVersion: String get() = props.getProperty("arrowVersion")
17+
val Project.coroutinesVersion: String get() = props.getProperty("coroutinesVersion")
18+
val Project.junitVersion: String get() = props.getProperty("junitVersion")
19+
val Project.kotlinComposeVersion: String get() = props.getProperty("kotlinComposeVersion")
20+
val Project.kotlinVersion: String get() = props.getProperty("kotlinVersion")
21+
val Project.moshiVersion: String get() = props.getProperty("moshiVersion")
22+
val Project.okhttpVersion: String get() = props.getProperty("okhttpVersion")
23+
val Project.retrofitVersion: String get() = props.getProperty("retrofitVersion")
2724

2825
// Android
29-
val androidCompileSdkVersion = properties.getProperty("androidCompileSdkVersion").toInt()
30-
val androidMinSdkVersion = properties.getProperty("androidMinSdkVersion").toInt()
31-
val androidTargetSdkVersion = properties.getProperty("androidTargetSdkVersion").toInt()
26+
val Project.androidCompileSdkVersion: Int get() = props.getProperty("androidCompileSdkVersion").toInt()
27+
val Project.androidMinSdkVersion: Int get() = props.getProperty("androidMinSdkVersion").toInt()
28+
val Project.androidTargetSdkVersion: Int get() = props.getProperty("androidTargetSdkVersion").toInt()
29+
30+
private val Project.props: Properties
31+
get() = Properties().apply { File(rootDir, "gradle.properties").inputStream().use { load(it) } }

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ kotlin.code.style=official
88
android.useAndroidX=true
99

1010
# Versions
11-
androidToolsBuildVersion=7.0.0-alpha05
11+
androidToolsBuildVersion=4.1.3
1212
androidxActivityVersion=1.1.0
1313
androidxAppcompatVersion=1.2.0
1414
androidxConstraintLayoutVersion=2.0.4

gradle/wrapper/gradle-wrapper.jar

293 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fi
130130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133-
133+
134134
JAVACMD=`cygpath --unix "$JAVACMD"`
135135

136136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,29 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

8772

8873
@rem Execute Gradle
89-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
9075

9176
:end
9277
@rem End local scope for the variables with windows NT shell

0 commit comments

Comments
 (0)