Skip to content

Commit c8d65a2

Browse files
authored
Initial commit
0 parents  commit c8d65a2

File tree

53 files changed

+1534
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1534
-0
lines changed

Diff for: .github/CONTRIBUTING.md

Whitespace-only changes.

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: triage
6+
assignees: bsneed
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Do '...'
16+
2. '....'
17+
3. See error
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots**
23+
If applicable, add screenshots to help explain your problem.
24+
25+
**Platform (please complete the following information):**
26+
- Library Version in use: [e.g. 0.0.5]
27+
- Platform being tested: [e.g. Android]
28+
- Integrations in use: [e.g. Firebase, Amplitude]
29+
30+
**Additional context**
31+
Add any other context about the problem here.

Diff for: .github/ISSUE_TEMPLATE/feature_request.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: triage
6+
assignees: prayansh
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

Diff for: .github/ISSUE_TEMPLATE/pull_request_template.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Purpose
2+
_Describe the problem or feature in addition to a link to the issues._
3+
4+
## Approach
5+
_How does this change address the problem?_
6+
7+
#### Open Questions and Pre-Merge TODOs
8+
- [ ] Use github checklists. When solved, check the box and explain the answer.
9+
10+
## Learning
11+
_Describe the research stage_
12+
13+
_Links to blog posts, patterns, libraries or addons used to solve this problem_

Diff for: .github/workflows/build.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
permissions: write-all
11+
12+
jobs:
13+
cancel_previous:
14+
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: styfle/[email protected]
18+
with:
19+
workflow_id: ${{ github.event.workflow.id }}
20+
21+
build:
22+
23+
needs: cancel_previous
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Grant execute permission for gradlew
29+
run: chmod +x gradlew
30+
- name: cache gradle dependencies
31+
uses: actions/cache@v2
32+
with:
33+
path: |
34+
~/.gradle/caches
35+
~/.gradle/wrapper
36+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37+
restore-keys: |
38+
${{ runner.os }}-gradle-
39+
- name: Run Tests
40+
run: ./gradlew check

Diff for: .github/workflows/release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
-
8+
permissions: write-all
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
environment: deployment
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Get tag
17+
id: vars
18+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
19+
- name: Verify tag
20+
run: |
21+
VERSION=$(grep VERSION_NAME gradle.properties | awk -F= '{ print $2 }' | sed "s/-SNAPSHOT//")
22+
if [ "${{ steps.vars.outputs.tag }}" != "$VERSION" ]; then {
23+
echo "Tag ${{ steps.vars.outputs.tag }} does not match the package version ($VERSION)"
24+
exit 1
25+
} fi
26+
27+
- name: Grant execute permission for gradlew
28+
run: chmod +x gradlew
29+
- name: cache gradle dependencies
30+
uses: actions/cache@v2
31+
with:
32+
path: |
33+
~/.gradle/caches
34+
~/.gradle/wrapper
35+
key: ${{ runner.os }}-gradle-core-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
36+
restore-keys: |
37+
${{ runner.os }}-gradle-core-
38+
- name: Publush release to sonatype
39+
run: ./gradlew publishToSonatype -Prelease closeAndReleaseSonatypeStagingRepository
40+
env:
41+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
42+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
43+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
44+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}
45+
SIGNING_PRIVATE_KEY_BASE64: ${{ secrets.SIGNING_PRIVATE_KEY_BASE64 }}
46+
47+
- name: create release
48+
run: |
49+
curl \
50+
-X POST \
51+
-H "Authorization: token $GITHUB_TOKEN" \
52+
https://api.github.com/repos/${{github.repository}}/releases \
53+
-d '{"tag_name": "${{ env.RELEASE_VERSION }}", "name": "${{ env.RELEASE_VERSION }}", "body": "Release of version ${{ env.RELEASE_VERSION }}", "draft": false, "prerelease": false, "generate_release_notes": true}'
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

Diff for: .github/workflows/snapshot.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Snapshot
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
snapshot:
9+
runs-on: ubuntu-latest
10+
environment: deployment
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Grant execute permission for gradlew
14+
run: chmod +x gradlew
15+
- name: cache gradle dependencies
16+
uses: actions/cache@v2
17+
with:
18+
path: |
19+
~/.gradle/caches
20+
~/.gradle/wrapper
21+
key: ${{ runner.os }}-gradle-core-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
22+
restore-keys: |
23+
${{ runner.os }}-gradle-core-
24+
- name: Publush snapshot to sonatype
25+
run: ./gradlew publishToSonatype
26+
env:
27+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
28+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
29+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
30+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}
31+
SIGNING_PRIVATE_KEY_BASE64: ${{ secrets.SIGNING_PRIVATE_KEY_BASE64 }}

Diff for: .gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
7+
.idea
8+
lib/build
9+
local.properties

Diff for: README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// add badges and stuff here
2+
3+
# Destination
4+
5+
## Getting Started
6+
7+
1. Create repo from this template. The name of the repo should follow this pattern `project-language-destination`. For example `analytics-kotlin-firebase`
8+
2. In `settings.gralde.kts`, change `rootProject.name` to match your repo name.
9+
3. In `gradle.properties`, update the fields with `<>` brackets
10+
4. Delete `com.segment.analytics.kotlin.destinations.Destination.kt`
11+
5. Create a directory with the destination name under `com.segment.analytics.kotlin.destinations`. For example Firebase, `com.segment.analytics.kotlin.destinations.firebase`
12+
6. Create your destination class under the directory created in step 5. For example Firebase, `com.segment.analytics.kotlin.destinations.firebase.Firebase.kt`
13+
7. update Android manifest with your package name. For example Firebase
14+
```xml
15+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
16+
package="com.segment.analytics.kotlin.destinations.firebase">
17+
```
18+
8. Implement destination
19+
9. Add tests
20+
21+
22+
## License
23+
```
24+
MIT License
25+
26+
Copyright (c) 2021 Segment
27+
28+
Permission is hereby granted, free of charge, to any person obtaining a copy
29+
of this software and associated documentation files (the "Software"), to deal
30+
in the Software without restriction, including without limitation the rights
31+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32+
copies of the Software, and to permit persons to whom the Software is
33+
furnished to do so, subject to the following conditions:
34+
35+
The above copyright notice and this permission notice shall be included in all
36+
copies or substantial portions of the Software.
37+
38+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44+
SOFTWARE.
45+
```

Diff for: RELEASING.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Update Version
2+
=========
3+
1. Update VERSION_CODE in `gradle.properties`
4+
2. Update VERSION_NAME in `gradle.properties`
5+
6+
Releasing
7+
=========
8+
9+
1. Create a new branch called `release/X.Y.Z`
10+
2. `git checkout -b release/X.Y.Z`
11+
3. Change the version in `gradle.properties` to your desired release version (see `Update Version`)
12+
4. `git commit -am "Create release X.Y.Z."` (where X.Y.Z is the new version)
13+
5. `git tag -a X.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version)
14+
6. Upgrade to next version by changing version in `gradle.properties`
15+
7. `git commit -am "Prepare snapshot X.Y.Z-SNAPSHOT"`
16+
8. `git push && git push --tags`
17+
9. Create a PR to merge the new branch into `master`
18+
10. The CI pipeline will recognize the tag and upload, close and promote the artifacts automatically, and generate changelog automatically
19+
20+
Example (stable release)
21+
========
22+
1. Current VERSION_NAME in `gradle.properties` = 1.3.0
23+
2. `git checkout -b release/1.3.1`
24+
3. Change VERSION_NAME = 1.3.1 (next higher version)
25+
4. Update CHANGELOG.md
26+
5. `git commit -am "Create release 1.3.1`
27+
6. `git tag -a 1.3.1 -m "Version 1.3.1"`
28+
6. `git push && git push --tags`
29+
7. Change VERSION_NAME = 1.3.2 (next higher version)
30+
8. `git commit -am "Prepare snapshot 1.3.2-SNAPSHOT"`
31+
9. `git push && git push --tags`
32+
10. Merging PR master will create a snapshot release 1.3.2-SNAPSHOT and tag push will create stable release 1.3.1

Diff for: build.gradle.kts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
val GROUP: String by project
2+
val VERSION_NAME: String by project
3+
4+
group = GROUP
5+
version = getVersionName()
6+
7+
plugins {
8+
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
9+
id("org.jetbrains.kotlin.jvm") version "1.6.0"
10+
11+
// Apply the java-library plugin for API and implementation separation.
12+
`java-library`
13+
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
14+
15+
}
16+
17+
buildscript {
18+
repositories {
19+
// Use JCenter for resolving dependencies.
20+
mavenCentral()
21+
google()
22+
gradlePluginPortal()
23+
}
24+
dependencies {
25+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0")
26+
classpath("org.jetbrains.kotlin:kotlin-serialization:1.6.0")
27+
classpath("com.android.tools.build:gradle:7.0.4")
28+
}
29+
}
30+
31+
allprojects {
32+
repositories {
33+
mavenCentral()
34+
google()
35+
gradlePluginPortal()
36+
}
37+
}
38+
39+
nexusPublishing {
40+
repositories {
41+
sonatype()
42+
}
43+
}
44+
45+
fun getVersionName() =
46+
if (hasProperty("release"))
47+
VERSION_NAME
48+
else
49+
"$VERSION_NAME-SNAPSHOT"

Diff for: gradle.properties

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app"s APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=true
20+
# Kotlin code style for this project: "official" or "obsolete":
21+
kotlin.code.style=official
22+
23+
# Deployment variables
24+
GROUP=com.segment.analytics.kotlin.destinations
25+
26+
VERSION_CODE=<100>
27+
VERSION_NAME=<1.0.0>
28+
29+
POM_ARTIFACT_ID=<destination>
30+
POM_NAME=<destination>
31+
POM_DESCRIPTION=<Destination Description>
32+
33+
POM_URL=https://github.com/segmentio/<analytics-kotlin-destination>
34+
POM_SCM_URL=https://github.com/segmentio/<analytics-kotlin-destination>
35+
POM_SCM_CONNECTION=scm:git:git://github.com/segmentio/<analytics-kotlin-destination>.git
36+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/segmentio/<analytics-kotlin-destination>.git
37+
38+
POM_LICENCE_NAME=The MIT License (MIT)
39+
POM_LICENCE_URL=http://opensource.org/licenses/MIT
40+
POM_LICENCE_DIST=repo
41+
42+
POM_DEVELOPER_ID=segmentio
43+
POM_DEVELOPER_NAME=Segment, Inc.

Diff for: gradle/wrapper/gradle-wrapper.jar

58.1 KB
Binary file not shown.

Diff for: gradle/wrapper/gradle-wrapper.properties

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)