Skip to content

Commit d83c7f5

Browse files
authored
chore: publish to maven central (#9)
* chore: publish to maven central * chore: fix build warning * chore: build improvements
1 parent fa8bcc7 commit d83c7f5

6 files changed

Lines changed: 69 additions & 5 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cmake.sourceDirectory": "${workspaceFolder}/third_party/libcurl-android/boringssl",
3+
"java.configuration.updateBuildConfiguration": "automatic"
4+
}

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<a href="https://discord.gg/bugsplat"><img alt="Join BugSplat on Discord" src="https://img.shields.io/discord/664965194799251487?label=Join%20Discord&logo=Discord&style=social"></a>
1111
</div>
1212

13+
<div align="center">
14+
<a href="https://central.sonatype.com/artifact/com.bugsplat/bugsplat-android"><img alt="Maven Central" src="https://img.shields.io/maven-central/v/com.bugsplat/bugsplat-android"></a>
15+
</div>
16+
1317
<br/>
1418

1519
## Introduction 👋
@@ -36,9 +40,26 @@ To ensure your app is 16KB compatible:
3640

3741
BugSplat supports multiple methods for installing the bugsplat-android library in a project.
3842

39-
### Package Manager
43+
### Gradle (Recommended)
44+
45+
Add the BugSplat dependency to your app's `build.gradle` file:
4046

41-
Coming soon!
47+
```gradle
48+
dependencies {
49+
implementation 'com.bugsplat:bugsplat-android:1.0.0'
50+
}
51+
```
52+
53+
BugSplat is hosted on Maven Central, which is included by default in most Android projects. If needed, ensure `mavenCentral()` is in your `settings.gradle.kts`:
54+
55+
```kotlin
56+
dependencyResolutionManagement {
57+
repositories {
58+
google()
59+
mavenCentral()
60+
}
61+
}
62+
```
4263

4364
### Manual Setup
4465

app/build.gradle

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'com.android.library'
3+
id 'com.vanniktech.maven.publish'
34
}
45

56
android {
@@ -71,6 +72,41 @@ android {
7172
ndkVersion '28.2.13676358'
7273
}
7374

75+
mavenPublishing {
76+
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
77+
signAllPublications()
78+
79+
coordinates("com.bugsplat", "bugsplat-android", "1.0.0")
80+
81+
pom {
82+
name = "BugSplat Android"
83+
description = "BugSplat crash reporting for Android"
84+
url = "https://github.com/BugSplat-Git/bugsplat-android"
85+
inceptionYear = "2024"
86+
87+
licenses {
88+
license {
89+
name = "MIT License"
90+
url = "https://opensource.org/licenses/MIT"
91+
}
92+
}
93+
94+
developers {
95+
developer {
96+
id = "bugsplat"
97+
name = "BugSplat"
98+
url = "https://www.bugsplat.com"
99+
}
100+
}
101+
102+
scm {
103+
url = "https://github.com/BugSplat-Git/bugsplat-android"
104+
connection = "scm:git:https://github.com/BugSplat-Git/bugsplat-android.git"
105+
developerConnection = "scm:git:ssh://git@github.com/BugSplat-Git/bugsplat-android.git"
106+
}
107+
}
108+
}
109+
74110
dependencies {
75111
implementation libs.androidx.core.ktx
76112
implementation libs.androidx.appcompat
@@ -124,7 +160,8 @@ afterEvaluate {
124160

125161
doLast {
126162
if (originalFile.exists()) {
127-
originalFile.renameTo(newFile)
163+
// Keep original for the maven publish task, copy with descriptive name for manual distribution
164+
java.nio.file.Files.copy(originalFile.toPath(), newFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING)
128165
}
129166
}
130167
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.bugsplat.android">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43
<!-- Empty manifest is fine for a library with no components -->
54
</manifest>

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
plugins {
33
alias(libs.plugins.android.library) apply false
44
alias(libs.plugins.android.application) apply false
5+
alias(libs.plugins.maven.publish) apply false
56
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ espressoCore = "3.6.1"
88
appcompat = "1.7.0"
99
material = "1.10.0"
1010
constraintlayout = "2.2.0"
11+
mavenPublish = "0.30.0"
1112

1213
[libraries]
1314
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -22,4 +23,5 @@ androidx-constraintlayout = { group = "androidx.constraintlayout", name = "const
2223
android-application = { id = "com.android.application", version.ref = "agp" }
2324
android-library = { id = "com.android.library", version.ref = "agp" }
2425
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
26+
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
2527

0 commit comments

Comments
 (0)