Skip to content

Update Readme and jitpack configs #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Analytics-Kotlin
[![](https://jitpack.io/v/segmentio/analytics-kotlin.svg)](https://jitpack.io/#segmentio/analytics-kotlin)

The hassle-free way to add Segment analytics to your kotlin app (Android/JVM).

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
Expand Down Expand Up @@ -28,17 +30,39 @@ supplant our `analytics-android` library.

## Installation
For our pilot phase, we will be using [jitpack](https://jitpack.io/#segmentio/analytics-kotlin) to distribute the library
<details open>
<summary>Android</summary>
<br>
In your app's build.gradle file add the following

```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.segmentio:analytics-kotlin:1.0.0'
implementation 'com.github.segmentio.analytics-kotlin:android:+'
}
```

</details>

<details>
<summary>JVM</summary>
<br>

In your app's build.gradle file add the following
```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.segmentio.analytics-kotlin:core:+'
}
```
</details>

### Permissions
Ensure that you add these permissions to your `AndroidManifest.xml`
```xml
Expand Down Expand Up @@ -77,7 +101,7 @@ Analytics("SEGMENT_API_KEY", applicationContext) {
}
```

Generic
JVM
```kotlin
Analytics("SEGMENT_API_KEY") {
collectDeviceId = true
Expand Down
4 changes: 3 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ dependencies {
// Add Roboelectric dependencies.
testImplementation 'org.robolectric:robolectric:4.5'
testImplementation 'androidx.test:core:1.3.0'
}
}

apply from: rootProject.file('gradle/jitpack-android.gradle')
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ buildscript {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.5'

// For jitpack publishing of android library
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

Expand Down
4 changes: 3 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ dependencies {

testImplementation platform("org.junit:junit-bom:5.7.2")
testImplementation "org.junit.jupiter:junit-jupiter"
}
}

apply from: rootProject.file('gradle/jitpack-core.gradle')
26 changes: 26 additions & 0 deletions gradle/jitpack-android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Needed for Jitpack (ref: https://github.com/jitpack/gradle-modular/blob/6816f11/build.gradle)
apply plugin: 'com.github.dcendents.android-maven'

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// Attach Javadocs and Sources jar
artifacts {
archives sourcesJar
archives javadocJar
}
18 changes: 18 additions & 0 deletions gradle/jitpack-core.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Needed for Jitpack (ref: https://github.com/jitpack/gradle-modular/blob/6816f11/build.gradle)
apply plugin: 'maven'

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// Attach Javadocs and Sources jar
artifacts {
archives sourcesJar
archives javadocJar
}