Skip to content

Commit c8aeef0

Browse files
authored
Merge pull request #1 from rollbar/feat/SDK-439/create-plugin-to-upload-mappings-file
[Feat][SDK-439] Create plugin to upload mappings file
2 parents cf3c74e + cc9198c commit c8aeef0

File tree

18 files changed

+1020
-0
lines changed

18 files changed

+1020
-0
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: rollbar-gradle-plugin CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "release/**"
8+
pull_request:
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: 17
25+
26+
- name: Cache Gradle
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.gradle/caches
31+
~/.gradle/wrapper
32+
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
33+
restore-keys: gradle-
34+
35+
- name: Run tests
36+
run: ./gradlew test --stacktrace
37+
38+
publish:
39+
name: Publish to Gradle Plugin Portal
40+
if: github.event_name == 'release'
41+
runs-on: ubuntu-latest
42+
needs: [ test ]
43+
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Set up JDK 17
49+
uses: actions/setup-java@v4
50+
with:
51+
distribution: temurin
52+
java-version: 17
53+
54+
- name: Publish plugin
55+
run: ./gradlew publishPlugins --stacktrace
56+
env:
57+
ORG_GRADLE_PROJECT_gradlePublishKey: ${{ secrets.GRADLE_PUBLISH_KEY }}
58+
ORG_GRADLE_PROJECT_gradlePublishSecret: ${{ secrets.GRADLE_PUBLISH_SECRET }}

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
local.properties
7+
8+
### IntelliJ IDEA ###
9+
*.iws
10+
*.iml
11+
*.ipr
12+
out/
13+
!**/src/main/**/out/
14+
!**/src/test/**/out/
15+
/.idea/
16+
/.kotlin/
17+
18+
### Eclipse ###
19+
.apt_generated
20+
.classpath
21+
.factorypath
22+
.project
23+
.settings
24+
.springBeans
25+
.sts4-cache
26+
bin/
27+
!**/src/main/**/bin/
28+
!**/src/test/**/bin/
29+
30+
### NetBeans ###
31+
/nbproject/private/
32+
/nbbuild/
33+
/dist/
34+
/nbdist/
35+
/.nb-gradle/
36+
37+
### VS Code ###
38+
.vscode/
39+
40+
### Mac OS ###
41+
.DS_Store

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# rollbar-android
2+
3+
Gradle plugin for uploading Android ProGuard/R8 mapping files to Rollbar for deobfuscation.
4+
5+
## Usage
6+
7+
```groovy
8+
plugins {
9+
id 'com.rollbar.plugins.android' version '<latest>'
10+
}
11+
12+
rollbar {
13+
apiToken = "<token>"
14+
variantsToUpload = ["externalProductionRelease", "internalProductionRelease"] // if left empty, "release" buildType will be used
15+
}
16+
```
17+
18+
This should produce the below output:
19+
```shell
20+
...
21+
> Configure project :app
22+
Configuring Rollbar plugin for variant externalProductionRelease with task name uploadRollbarMappingFileExternalProductionRelease
23+
Configuring Rollbar plugin for variant internalProductionRelease with task name uploadRollbarMappingFileInternalProductionRelease
24+
...
25+
```
26+
27+
## How to test
28+
29+
Publish the latest changes from the `rollbar-android` plugin to mavenLocal:
30+
```shell
31+
./gradlew publishToMavenLocal
32+
```

build.gradle.kts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
`kotlin-dsl`
3+
`maven-publish`
4+
id("com.gradle.plugin-publish") version "2.0.0"
5+
}
6+
7+
group = properties["GROUP"].toString()
8+
version = properties["PLUGIN_VERSION"].toString()
9+
10+
dependencies {
11+
compileOnly(gradleApi())
12+
compileOnly(libs.android.gradle.plugin)
13+
testImplementation(kotlin("test"))
14+
testImplementation("org.mockito:mockito-core:5.12.0")
15+
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
16+
testImplementation("com.squareup.okio:okio:3.6.0")
17+
testImplementation("io.mockk:mockk:1.13.10")
18+
testImplementation("com.google.truth:truth:1.4.2")
19+
}
20+
21+
gradlePlugin {
22+
plugins {
23+
website = "https://rollbar.com/"
24+
vcsUrl = "https://github.com/rollbar/rollbar-gradle-plugin"
25+
26+
create("rollbar-android") {
27+
id = properties["PLUGIN_NAME"].toString()
28+
displayName = "Rollbar gradle plugin"
29+
description = "Gradle plugin for uploading Android ProGuard/R8 mapping files to Rollbar for deobfuscation."
30+
tags = listOf("upload", "mappings", "android", "Rollbar")
31+
implementationClass = properties["PLUGIN_NAME_CLASS"].toString()
32+
}
33+
}
34+
35+
}
36+
37+
sourceSets {
38+
named("test") {
39+
kotlin.srcDirs("src/test/kotlin")
40+
}
41+
}
42+
43+
tasks.test {
44+
useJUnitPlatform()
45+
}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
GROUP = com.rollbar.plugins
2+
PLUGIN_NAME = com.rollbar.plugins.android
3+
PLUGIN_NAME_CLASS = com.rollbar.plugins.RollbarPlugin
4+
PLUGIN_VERSION = 1.0.0-alpha.1

gradle/libs.versions.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[versions]
2+
agp = "8.8.1"
3+
4+
[libraries]
5+
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Feb 17 11:17:34 GMT 2025
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)