Skip to content

Commit eef9315

Browse files
authored
spotless (#277)
1 parent 72541ce commit eef9315

File tree

123 files changed

+3437
-2366
lines changed

Some content is hidden

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

123 files changed

+3437
-2366
lines changed

CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ exception when queried. See the corresponding Android bug: https://issuetracker.
6262

6363
---
6464

65-
## Version 0.7.0
65+
## Version 0.7.0
6666

67-
- OpenTelemetry okhttp instrumentation has been updated to version 1.5.3-alpha.
67+
- OpenTelemetry okhttp instrumentation has been updated to version 1.5.3-alpha.
6868
- For okhttp, SplunkRum now exposes a wrapper for your `OkHttpClient` which implements the `Call.Factory`
6969
interface. This `Call.Factory` will properly manage context propagation with asynchronous http calls.
7070
- The okhttp Interceptor provided by SplunkRum has been deprecated. Please use the `Call.Factory` from now on.
7171
The `createOkHttpRumInterceptor()` method will be removed in a future release.
72-
- A new class (`com.splunk.rum.StandardAttributes`) has been introduced to provide `AttributeKey`s for
72+
- A new class (`com.splunk.rum.StandardAttributes`) has been introduced to provide `AttributeKey`s for
7373
standard RUM span attributes. Currently this class exposes the `APP_VERSION` attribute.
7474
- The ANR detector and Network monitor will no longer operate when the app has been put in the background.
7575
- A new API on the `Config.Builder` allows redacting of spans or redacting/replacing Span attributes. See
7676
the new `filterSpans(Consumer<SpanFilterBuilder>)` method and the corresponding `com.splunk.rum.SpanFilterBuilder` class
7777
for details.
78-
- The `os.type` Span attribute has been changed to 'linux' and `os.name` attribute is now 'Android'.
78+
- The `os.type` Span attribute has been changed to 'linux' and `os.name` attribute is now 'Android'.
7979

8080
---
8181

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ import android.webkit.WebView;
187187
import com.splunk.rum.SplunkRum;
188188

189189
//...
190-
/*
191-
Make sure that the WebView instance only loads pages under
192-
your control and instrumented with Splunk Browser RUM. The
190+
/*
191+
Make sure that the WebView instance only loads pages under
192+
your control and instrumented with Splunk Browser RUM. The
193193
integrateWithBrowserRum() method can expose the splunk.rumSessionId
194194
of your user to every site/page loaded in the WebView instance.
195195
*/
@@ -247,11 +247,11 @@ when initializing your instance of the SplunkRum API:
247247
or changing the span name. See the javadoc on the `SpanFilterBuilder` class for more details.
248248
- `slowRenderingDetectionPollInterval(Duration)` :
249249
Set/change the default polling interval for slow/frozen render detection.
250-
Default is 1000ms. Value must be positive.
250+
Default is 1000ms. Value must be positive.
251251
- `slowRenderingDetectionEnabled(boolean)` :
252252
Disables the detection of slow frame renders. Enabled by default.
253-
- `diskBufferingEnabled(boolean)` :
254-
Enables the storage-based buffering of telemetry.
253+
- `diskBufferingEnabled(boolean)` :
254+
Enables the storage-based buffering of telemetry.
255255
This setting is useful when instrumenting applications that might work offline for extended periods of time.
256256
- `limitDiskUsageMegabytes(int)` :
257257
When disk buffering is enabled, this can be used to adjust the maximum amount of storage
@@ -294,14 +294,14 @@ when initializing your instance of the SplunkRum API:
294294
#### Detection of slow or frozen renders
295295

296296
By default, Splunk RUM detects and reports slow or frozen screen renders.
297-
To disable this feature, call `.slowRenderingDetectionEnabled(false)` on the
297+
To disable this feature, call `.slowRenderingDetectionEnabled(false)` on the
298298
`Config.Builder`.
299299

300300
Splunk RUM defines renders as slow or frozen following the [Android Vitals definitions](https://developer.android.com/topic/performance/vitals/frozen):
301301

302302
| Category | Speed | spanName | Attribute |
303303
|----------|---------|---------------|-------------|
304-
| Slow | >16ms | slowRenders | count |
304+
| Slow | >16ms | slowRenders | count |
305305
| Frozen | >700ms | frozenRenders | count |
306306

307307
## Customizing screen names
@@ -310,7 +310,7 @@ By default, the instrumentation uses the simple class name of each `Fragment`
310310
and `Activity` type as the value of the `screen.name` attribute. To customize the
311311
screen name, use the `@RumScreenName` annotation.
312312

313-
For example, the following activity appears with the `screen.name`
313+
For example, the following activity appears with the `screen.name`
314314
attribute set to the value "Buttercup":
315315

316316
```java

RELEASING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
## Releasing a new version
44

5-
Releasing of splunk-otel-android is done via a private Splunk gitlab installation.
5+
Releasing of splunk-otel-android is done via a private Splunk gitlab installation.
66

77
This is the process to use to do a release:
88

9-
1) Use the _Github_ UI to create a tag for the version (by creating a pre-release, for example),
10-
pointing at the commit SHA on the main branch that you want to release.
9+
1) Use the _Github_ UI to create a tag for the version (by creating a pre-release, for example),
10+
pointing at the commit SHA on the main branch that you want to release.
1111
The format of the tag should be "vx.y.z" or it won't be picked
1212
up by gitlab as a release tag. You can also create a tag via the command line and push it to github
1313
if you are more comfortable with that process.
1414

1515
2) Wait for gitlab to run the release job.
1616

17-
3) Log in to oss.sonatype.org with a login that has permissions to see and release the `com.splunk`
17+
3) Log in to oss.sonatype.org with a login that has permissions to see and release the `com.splunk`
1818
staging repository.
1919

2020
4) Close the staging repository, and then release it via the oss.sonatype.org UI.
2121
Ideally, verify that the publishing worked by pulling down the dependency in some sample project and
2222
build an application against it, as a double-check that it is a working release.
2323

2424
5) Create a PR that will update the version in the `gradle.properties` to the next one that will be being worked on.
25-
This PR can and probably should also include updating any documentation (CHANGELOG.md, README.md, etc)
25+
This PR can and probably should also include updating any documentation (CHANGELOG.md, README.md, etc)
2626
that mentions the previous version.
2727

2828
6) Once this PR is merged, create a release in Github that points at the newly created version, make sure
29-
to provide release notes that at least mirror the contents of the CHANGELOG.md
29+
to provide release notes that at least mirror the contents of the CHANGELOG.md

build.gradle.kts

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ buildscript {
1111
}
1212
}
1313

14+
plugins {
15+
id("splunk.spotless-conventions")
16+
}
17+
1418
allprojects {
1519
repositories {
1620
google()
@@ -23,3 +27,7 @@ allprojects {
2327
version = "$version-SNAPSHOT"
2428
}
2529
}
30+
31+
subprojects {
32+
apply(plugin = "splunk.spotless-conventions")
33+
}

buildSrc/build.gradle.kts

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
plugins {
22
`kotlin-dsl`
3+
4+
// When updating, update below in dependencies too
5+
id("com.diffplug.spotless") version "6.4.2"
6+
}
7+
8+
spotless {
9+
kotlinGradle {
10+
ktlint()
11+
target("* * / *.gradle.kts")
12+
}
313
}
414

515
repositories {
616
mavenCentral()
717
google()
18+
gradlePluginPortal()
819
}
920

1021
dependencies {
1122
implementation("com.android.tools.build:gradle:7.1.2")
12-
}
23+
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.4.2")
24+
}

buildSrc/src/main/kotlin/splunk.android-library-conventions.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ val sourcesJar by tasks.registering(Jar::class) {
8383

8484
project.afterEvaluate {
8585

86-
//note: we need to declare this here in afterEvaluate because the android plugin doesn't
86+
// note: we need to declare this here in afterEvaluate because the android plugin doesn't
8787
// resolve dependencies early enough to make the libraryVariants hack work until here.
8888
val javadoc by tasks.registering(Javadoc::class) {
8989
source = android.sourceSets.named("main").get().java.getSourceFiles()
@@ -113,4 +113,4 @@ project.afterEvaluate {
113113
}
114114
}
115115
}
116-
}
116+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import com.diffplug.gradle.spotless.SpotlessExtension
2+
3+
plugins {
4+
id("com.diffplug.spotless")
5+
}
6+
7+
extensions.configure<SpotlessExtension>("spotless") {
8+
java {
9+
googleJavaFormat().aosp()
10+
licenseHeaderFile(rootProject.file("gradle/spotless.license.java"), "(package|import|public)")
11+
target("src/**/*.java")
12+
}
13+
plugins.withId("org.jetbrains.kotlin.jvm") {
14+
kotlin {
15+
ktlint()
16+
licenseHeaderFile(rootProject.file("gradle/spotless.license.java"), "(package|import|public)")
17+
}
18+
}
19+
kotlinGradle {
20+
ktlint()
21+
}
22+
format("misc") {
23+
// not using "**/..." to help keep spotless fast
24+
target(
25+
".gitignore",
26+
".gitattributes",
27+
".gitconfig",
28+
".editorconfig",
29+
"*.md",
30+
"src/**/*.md",
31+
"docs/**/*.md",
32+
"*.sh",
33+
"src/**/*.properties"
34+
)
35+
indentWithSpaces()
36+
trimTrailingWhitespace()
37+
endWithNewline()
38+
}
39+
}

docs/faq.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
## Frequently Asked Questions
2-

gradle/spotless.license.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Splunk Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+

sample-app/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ dependencies {
6363
implementation(project(":splunk-otel-android"))
6464

6565
testImplementation("junit:junit:4.13.2")
66-
}
66+
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1+
/*
2+
* Copyright Splunk Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.splunk.android.sample;
218

3-
import android.content.Context;
19+
import static org.junit.Assert.*;
420

5-
import androidx.test.platform.app.InstrumentationRegistry;
21+
import android.content.Context;
622
import androidx.test.ext.junit.runners.AndroidJUnit4;
7-
23+
import androidx.test.platform.app.InstrumentationRegistry;
824
import org.junit.Test;
925
import org.junit.runner.RunWith;
1026

11-
import static org.junit.Assert.*;
12-
1327
/**
1428
* Instrumented test, which will execute on an Android device.
1529
*
@@ -23,4 +37,4 @@ public void useAppContext() {
2337
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
2438
assertEquals("com.splunk.android.sample", appContext.getPackageName());
2539
}
26-
}
40+
}

0 commit comments

Comments
 (0)