Skip to content

Commit 897e2b2

Browse files
committed
Usage instructions
1 parent a9d104b commit 897e2b2

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
A multiplatform Kotlin library for working with date and time.
99

10+
See [Using in your projects](#using-in-your-projects) for the instructions how to setup a dependency in your project.
11+
1012
## Design overview
1113

1214
There are a few guiding principles in the design of `kotlinx-datetime`. First of all, it is pragmatic, focused
@@ -240,6 +242,82 @@ The implementation of date/time types, such as `Instant`, `LocalDateTime`, `Time
240242
formats that are used in practice (in particular, various RFCs).
241243
- [ ] An alternative JVM implementation for Android might be needed.
242244

245+
## Using in your projects
246+
247+
> Note that the library is experimental, and the API is subject to change.
248+
249+
The library is published to [kotlinx](https://bintray.com/kotlin/kotlinx/kotlinx.datetime) bintray repository<!-- and available in jcenter as well-->.
250+
251+
The library depends on the Kotlin Standard Library not lower than `1.4.0`.
252+
253+
### Gradle
254+
255+
- Add the bintray repository:
256+
257+
```kotlin
258+
repositories {
259+
maven(url = "https://kotlin.bintray.com/kotlinx/") // soon will be just jcenter()
260+
}
261+
```
262+
263+
- In multiplatform projects, add a dependency to the commonMain source set dependencies
264+
```kotlin
265+
kotlin {
266+
sourceSets {
267+
commonMain {
268+
dependencies {
269+
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.0")
270+
}
271+
}
272+
}
273+
}
274+
```
275+
276+
- To use the library in a single-platform project, add a dependency to the dependencies block.
277+
278+
```groovy
279+
dependencies {
280+
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.0")
281+
}
282+
```
283+
284+
### Maven
285+
286+
- Add the bintray repository to the `<repositories>` section.
287+
288+
```xml
289+
<repository>
290+
<snapshots>
291+
<enabled>false</enabled>
292+
</snapshots>
293+
<id>kotlinx</id>
294+
<name>kotlinx</name>
295+
<url>https://kotlin.bintray.com/kotlinx/</url>
296+
</repository>
297+
```
298+
<!--
299+
```xml
300+
<repository>
301+
<snapshots>
302+
<enabled>false</enabled>
303+
</snapshots>
304+
<id>jcenter</id>
305+
<name>jcenter</name>
306+
<url>https://jcenter.bintray.com/</url>
307+
</repository>
308+
```
309+
-->
310+
311+
- Add a dependency to the `<dependencies>` element. Note that you need to use the platform-specific `-jvm` artifact in Maven.
312+
313+
```xml
314+
<dependency>
315+
<groupId>org.jetbrains.kotlinx</groupId>
316+
<artifactId>kotlinx-datetime-jvm</artifactId>
317+
<version>0.1.0</version>
318+
</dependency>
319+
```
320+
243321
## Building
244322

245323
Before building, ensure that you have [thirdparty/date](thirdparty/date) submodule initialized and updated.

0 commit comments

Comments
 (0)