Skip to content

Commit d4b90b2

Browse files
authored
Merge pull request #49 from backtrace-labs/feature/update-gradle
Feature/update gradle
2 parents fef685f + 894167c commit d4b90b2

File tree

11 files changed

+393
-274
lines changed

11 files changed

+393
-274
lines changed

.github/workflows/uploadArchives.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: chmod +x gradlew
4040

4141
- name: Upload archives
42-
run: ./gradlew uploadArchives
42+
run: ./gradlew publish
4343
env:
4444
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ASCII_ARMORED_GPG_KEY }} # ASCII-armored GPG key
4545
ORG_GRADLE_PROJECT_signingPassword: "" # Using empty password for GPG key

backtrace-library/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
apply plugin: 'com.android.library'
2-
apply from: 'publish.gradle'
32

43
android {
4+
55
compileSdkVersion 30
66

77
defaultConfig {
88
minSdkVersion 21
99
targetSdkVersion 30
10-
versionCode 371
11-
versionName "3.7.1"
10+
versionCode 372
11+
versionName "3.7.2"
1212
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
1313

1414
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -68,3 +68,5 @@ dependencies {
6868
androidTestImplementation 'com.android.support.test:runner:1.0.2'
6969
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
7070
}
71+
72+
apply from: 'publish.gradle'

backtrace-library/publish.gradle

Lines changed: 120 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
* source: https://github.com/chrisbanes/gradle-mvn-push
1717
*/
1818

19-
apply plugin: 'maven'
19+
apply plugin: 'maven-publish'
2020
apply plugin: 'signing'
2121

22+
version = VERSION_NAME
23+
group = GROUP
24+
2225
def isReleaseBuild() {
2326
return VERSION_NAME.contains("SNAPSHOT") == false
2427
}
@@ -41,85 +44,136 @@ def getRepositoryPassword() {
4144
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
4245
}
4346

47+
def configurePom(pom) {
48+
pom.name = POM_NAME
49+
pom.packaging = POM_PACKAGING
50+
pom.description = POM_DESCRIPTION
51+
pom.url = POM_URL
52+
53+
pom.scm {
54+
url = POM_SCM_URL
55+
connection = POM_SCM_CONNECTION
56+
developerConnection = POM_SCM_DEV_CONNECTION
57+
}
58+
59+
pom.licenses {
60+
license {
61+
name = POM_LICENCE_NAME
62+
url = POM_LICENCE_URL
63+
distribution = POM_LICENCE_DIST
64+
}
65+
}
66+
67+
pom.developers {
68+
developer {
69+
id = POM_DEVELOPER_ID
70+
name = POM_DEVELOPER_NAME
71+
}
72+
developer {
73+
id = POM_DEVELOPER_ID2
74+
name = POM_DEVELOPER_NAME2
75+
}
76+
developer {
77+
id = POM_DEVELOPER_ID3
78+
name = POM_DEVELOPER_NAME3
79+
}
80+
}
81+
}
82+
4483
afterEvaluate { project ->
45-
uploadArchives {
84+
publishing {
85+
publications {
86+
release(MavenPublication) {
87+
groupId GROUP
88+
artifactId POM_ARTIFACT_ID
89+
version VERSION_NAME
90+
from components.release
91+
}
92+
}
93+
4694
repositories {
47-
mavenDeployer {
48-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
95+
maven {
96+
def releasesRepoUrl = getReleaseRepositoryUrl()
97+
def snapshotsRepoUrl = getSnapshotRepositoryUrl()
98+
url = isReleaseBuild() ? releasesRepoUrl : snapshotsRepoUrl
99+
100+
credentials(PasswordCredentials) {
101+
username = getRepositoryUsername()
102+
password = getRepositoryPassword()
103+
}
104+
}
105+
}
106+
}
49107

50-
pom.groupId = GROUP
51-
pom.artifactId = POM_ARTIFACT_ID
52-
pom.version = VERSION_NAME
108+
if (project.getPlugins().hasPlugin('com.android.application') ||
109+
project.getPlugins().hasPlugin('com.android.library')) {
53110

54-
repository(url: getReleaseRepositoryUrl()) {
55-
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
56-
}
57-
snapshotRepository(url: getSnapshotRepositoryUrl()) {
58-
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
59-
}
111+
task androidJavadocs(type: Javadoc) {
112+
source = android.sourceSets.main.java.source
113+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
114+
excludes = ['**/*.kt']
115+
}
60116

61-
pom.project {
62-
name POM_NAME
63-
packaging POM_PACKAGING
64-
description POM_DESCRIPTION
65-
url POM_URL
66-
67-
scm {
68-
url POM_SCM_URL
69-
connection POM_SCM_CONNECTION
70-
developerConnection POM_SCM_DEV_CONNECTION
71-
}
72-
73-
licenses {
74-
license {
75-
name POM_LICENCE_NAME
76-
url POM_LICENCE_URL
77-
distribution POM_LICENCE_DIST
78-
}
79-
}
80-
81-
developers {
82-
developer {
83-
id POM_DEVELOPER_ID
84-
name POM_DEVELOPER_NAME
85-
}
86-
developer {
87-
id POM_DEVELOPER_ID2
88-
name POM_DEVELOPER_NAME2
89-
}
90-
developer {
91-
id POM_DEVELOPER_ID3
92-
name POM_DEVELOPER_NAME3
93-
}
94-
}
95-
}
117+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
118+
classifier = 'javadoc'
119+
from androidJavadocs.destinationDir
120+
}
121+
122+
task androidSourcesJar(type: Jar) {
123+
classifier = 'sources'
124+
from android.sourceSets.main.java.source
125+
}
126+
}
127+
128+
if (JavaVersion.current().isJava8Compatible()) {
129+
allprojects {
130+
tasks.withType(Javadoc) {
131+
options.addStringOption('Xdoclint:none', '-quiet')
96132
}
97133
}
98134
}
99135

100-
signing {
101-
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
102-
def signingKey = findProperty("signingKey")
103-
def signingPassword = findProperty("signingPassword")
104-
useInMemoryPgpKeys(signingKey, signingPassword)
105-
sign configurations.archives
136+
if (JavaVersion.current().isJava9Compatible()) {
137+
allprojects {
138+
tasks.withType(Javadoc) {
139+
options.addBooleanOption('html5', true)
140+
}
141+
}
142+
}
143+
144+
artifacts {
145+
if (project.getPlugins().hasPlugin('com.android.application') ||
146+
project.getPlugins().hasPlugin('com.android.library')) {
147+
archives androidSourcesJar
148+
archives androidJavadocsJar
149+
}
150+
}
151+
152+
android.libraryVariants.all { variant ->
153+
tasks.androidJavadocs.doFirst {
154+
classpath += files(variant.javaCompileProvider.get().classpath.files.join(File.pathSeparator))
155+
}
106156
}
107157

108-
//task androidJavadocs(type: Javadoc) {
109-
//source = android.sourceSets.main.allJava
110-
//}
158+
publishing.publications.all { publication ->
159+
publication.groupId = GROUP
160+
publication.version = VERSION_NAME
111161

112-
//task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
113-
//classifier = 'javadoc'
114-
//from androidJavadocs.destinationDir
115-
//}
162+
publication.artifact androidSourcesJar
163+
publication.artifact androidJavadocsJar
116164

117-
task androidSourcesJar(type: Jar) {
118-
classifier = 'sources'
119-
from android.sourceSets.main.java.sourceFiles
165+
configurePom(publication.pom)
120166
}
121167

122-
artifacts {
123-
archives androidSourcesJar
168+
signing {
169+
if (findProperty("signingKey")) {
170+
def signingKey = findProperty("signingKey")
171+
def signingPassword = findProperty("signingPassword")
172+
useInMemoryPgpKeys(signingKey, signingPassword)
173+
}
174+
175+
publishing.publications.all { publication ->
176+
sign publication
177+
}
124178
}
125179
}

backtrace-library/src/main/java/backtraceio/library/base/BacktraceBase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import backtraceio.library.BacktraceCredentials;
1212
import backtraceio.library.BacktraceDatabase;
13-
import backtraceio.library.BuildConfig;
1413
import backtraceio.library.enums.BacktraceBreadcrumbLevel;
1514
import backtraceio.library.enums.BacktraceBreadcrumbType;
1615
import backtraceio.library.enums.UnwindingMode;
@@ -51,7 +50,7 @@ public class BacktraceBase implements Client {
5150
/**
5251
* Backtrace client version
5352
*/
54-
public static String version = BuildConfig.VERSION_NAME;
53+
public static String version = backtraceio.library.BuildConfig.VERSION_NAME;
5554

5655
/**
5756
* Get custom client attributes. Every argument stored in dictionary will be send to Backtrace API

backtrace-library/src/main/java/backtraceio/library/models/json/BacktraceAttributes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.UUID;
1616

1717
import backtraceio.library.BacktraceClient;
18-
import backtraceio.library.BuildConfig;
1918
import backtraceio.library.common.BacktraceStringHelper;
2019
import backtraceio.library.common.DeviceAttributesHelper;
2120
import backtraceio.library.common.TypeHelper;
@@ -103,7 +102,7 @@ public Map<String, Object> getComplexAttributes() {
103102
private void setDeviceInformation(Boolean includeDynamicAttributes) {
104103
this.attributes.put("uname.version", Build.VERSION.RELEASE);
105104
this.attributes.put("culture", Locale.getDefault().getDisplayLanguage());
106-
this.attributes.put("build.type", BuildConfig.DEBUG ? "Debug" : "Release");
105+
this.attributes.put("build.type", backtraceio.library.BuildConfig.DEBUG ? "Debug" : "Release");
107106
this.attributes.put("device.model", Build.MODEL);
108107
this.attributes.put("device.brand", Build.BRAND);
109108
this.attributes.put("device.product", Build.PRODUCT);

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:4.2.2'
10+
classpath 'com.android.tools.build:gradle:7.2.1'
1111

1212

1313
// NOTE: Do not place your application dependencies here; they belong

gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ org.gradle.jvmargs=-Xmx1024m
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
1414

15-
16-
VERSION_NAME=3.7.1
17-
VERSION_CODE=371
15+
VERSION_NAME=3.7.2
16+
VERSION_CODE=372
1817
GROUP=com.github.backtrace-labs.backtrace-android
1918

2019
POM_DESCRIPTION=Backtrace's integration with Android applications written in Java allows customers to capture and report handled and unhandled java exceptions.

gradle/wrapper/gradle-wrapper.jar

5.36 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Thu Sep 02 16:28:56 EDT 2021
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

0 commit comments

Comments
 (0)