Skip to content

Commit 1f2fac3

Browse files
authored
Update Readme and jitpack configs (#15)
* add configs for jitpack publishing * try changes for android * update README.md * update README.md * update README.md
1 parent 7be234e commit 1f2fac3

File tree

6 files changed

+79
-4
lines changed

6 files changed

+79
-4
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Analytics-Kotlin
2+
[![](https://jitpack.io/v/segmentio/analytics-kotlin.svg)](https://jitpack.io/#segmentio/analytics-kotlin)
3+
24
The hassle-free way to add Segment analytics to your kotlin app (Android/JVM).
35

46
NOTE: This project is currently in the Pilot phase and is covered by Segment's [First Access & Beta Preview Terms](https://segment.com/legal/first-access-beta-preview/). We encourage you
@@ -28,17 +30,39 @@ supplant our `analytics-android` library.
2830

2931
## Installation
3032
For our pilot phase, we will be using [jitpack](https://jitpack.io/#segmentio/analytics-kotlin) to distribute the library
33+
<details open>
34+
<summary>Android</summary>
35+
<br>
3136
In your app's build.gradle file add the following
37+
3238
```groovy
3339
repositories {
3440
maven { url 'https://jitpack.io' }
3541
}
3642
3743
dependencies {
38-
implementation 'com.github.segmentio:analytics-kotlin:1.0.0'
44+
implementation 'com.github.segmentio.analytics-kotlin:android:+'
3945
}
4046
```
4147

48+
</details>
49+
50+
<details>
51+
<summary>JVM</summary>
52+
<br>
53+
54+
In your app's build.gradle file add the following
55+
```groovy
56+
repositories {
57+
maven { url 'https://jitpack.io' }
58+
}
59+
60+
dependencies {
61+
implementation 'com.github.segmentio.analytics-kotlin:core:+'
62+
}
63+
```
64+
</details>
65+
4266
### Permissions
4367
Ensure that you add these permissions to your `AndroidManifest.xml`
4468
```xml
@@ -77,7 +101,7 @@ Analytics("SEGMENT_API_KEY", applicationContext) {
77101
}
78102
```
79103

80-
Generic
104+
JVM
81105
```kotlin
82106
Analytics("SEGMENT_API_KEY") {
83107
collectDeviceId = true

android/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ dependencies {
7575
// Add Roboelectric dependencies.
7676
testImplementation 'org.robolectric:robolectric:4.5'
7777
testImplementation 'androidx.test:core:1.3.0'
78-
}
78+
}
79+
80+
apply from: rootProject.file('gradle/jitpack-android.gradle')

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ buildscript {
1616
// NOTE: Do not place your application dependencies here; they belong
1717
// in the individual module build.gradle files
1818
classpath 'com.google.gms:google-services:4.3.5'
19+
20+
// For jitpack publishing of android library
21+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1922
}
2023
}
2124

core/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ dependencies {
2727

2828
testImplementation platform("org.junit:junit-bom:5.7.2")
2929
testImplementation "org.junit.jupiter:junit-jupiter"
30-
}
30+
}
31+
32+
apply from: rootProject.file('gradle/jitpack-core.gradle')

gradle/jitpack-android.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Needed for Jitpack (ref: https://github.com/jitpack/gradle-modular/blob/6816f11/build.gradle)
2+
apply plugin: 'com.github.dcendents.android-maven'
3+
4+
task sourcesJar(type: Jar) {
5+
classifier = 'sources'
6+
from android.sourceSets.main.java.srcDirs
7+
}
8+
9+
task javadoc(type: Javadoc) {
10+
failOnError false
11+
source = android.sourceSets.main.java.sourceFiles
12+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
13+
classpath += configurations.compile
14+
}
15+
16+
// build a jar with javadoc
17+
task javadocJar(type: Jar, dependsOn: javadoc) {
18+
classifier = 'javadoc'
19+
from javadoc.destinationDir
20+
}
21+
22+
// Attach Javadocs and Sources jar
23+
artifacts {
24+
archives sourcesJar
25+
archives javadocJar
26+
}

gradle/jitpack-core.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Needed for Jitpack (ref: https://github.com/jitpack/gradle-modular/blob/6816f11/build.gradle)
2+
apply plugin: 'maven'
3+
4+
task sourcesJar(type: Jar, dependsOn: classes) {
5+
classifier = 'sources'
6+
from sourceSets.main.allSource
7+
}
8+
9+
task javadocJar(type: Jar, dependsOn: javadoc) {
10+
classifier = 'javadoc'
11+
from javadoc.destinationDir
12+
}
13+
14+
// Attach Javadocs and Sources jar
15+
artifacts {
16+
archives sourcesJar
17+
archives javadocJar
18+
}

0 commit comments

Comments
 (0)