Skip to content

Commit e069cb9

Browse files
author
f43nd1r
committed
Fix android 30 compatibility. Modernize upload, switch to manual release for simplicity.
1 parent 05e9a53 commit e069cb9

File tree

8 files changed

+112
-165
lines changed

8 files changed

+112
-165
lines changed

acra/build.gradle

Lines changed: 78 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'maven-publish'
23
apply plugin: 'signing'
3-
apply plugin: 'com.github.dcendents.android-maven'
4-
apply plugin: 'net.researchgate.release'
5-
apply plugin: 'com.jfrog.artifactory'
64

75
android {
86
compileSdkVersion Integer.parseInt(androidVersion)
@@ -25,170 +23,102 @@ android {
2523
}
2624

2725
dependencies {
28-
compile "com.android.support:support-compat:$supportVersion"
29-
compile "com.android.support:support-fragment:$supportVersion"
30-
compile "com.android.support:support-annotations:$supportVersion"
26+
implementation "com.android.support:support-compat:$supportVersion"
27+
implementation "com.android.support:support-fragment:$supportVersion"
28+
implementation "com.android.support:support-annotations:$supportVersion"
3129
annotationProcessor project(':annotationprocessor')
32-
provided project(':annotations')
30+
compileOnly project(':annotations')
3331
}
3432

35-
/*
36-
* How to oss upload:
37-
*
38-
* Edit or create the file at ~/.gradle/gradle.properties and add
39-
* signing.keyId=<short ID of your key>
40-
* signing.password=<passphrase for your key>
41-
* signing.secretKeyRingFile=<path to your key ring>
42-
* Optional, depending on upload destination
43-
* ossrhUser=<OSSRH user>
44-
* ossrhPassword=<OSSRH password>
45-
* artifactoryApiKey=<artifactory key>
46-
* artifactoryUser=<jfrog artifactory user>
47-
48-
* Then run for ossrh upload
49-
* gradlew release
50-
*
51-
* Or for jfrog oss artifactory
52-
* gradlew artifactoryPublish
53-
*/
54-
55-
release {
56-
failOnUnversionedFiles = false
57-
failOnCommitNeeded = true
58-
tagTemplate = '$name-$version'
59-
git {
60-
requireBranch = "master"
33+
task androidJavadocs(type: Javadoc) {
34+
source = android.sourceSets.main.java.srcDirs + files('build/generated/source/buildConfig/release') + files('build/generated/ap_generated_sources/release/out')
35+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
36+
android.libraryVariants.all { variant ->
37+
if (variant.name == 'release') {
38+
owner.classpath += variant.javaCompileProvider.get().classpath
39+
}
40+
}
41+
exclude '**/R.html', '**/R.*.html', '**/index.html'
42+
afterEvaluate {
43+
dependsOn assembleRelease
6144
}
6245
}
6346

64-
afterReleaseBuild {
65-
dependsOn rootProject.closeAndPromoteRepository
66-
}
67-
68-
rootProject.closeRepository {
69-
dependsOn uploadArchives
47+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
48+
archiveClassifier.set('javadoc')
49+
from androidJavadocs.destinationDir
7050
}
7151

72-
task sourcesJar(type: Jar) {
52+
task androidSourcesJar(type: Jar) {
53+
archiveClassifier.set('sources')
7354
from android.sourceSets.main.java.srcDirs
74-
classifier = 'sources'
7555
}
7656

77-
task javadoc(type: Javadoc) {
78-
source = android.sourceSets.main.java.srcDirs
79-
source += files('build/generated/source/aidl/release') + files('build/generated/source/buildConfig/release') + files('build/generated/source/apt/release')
80-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
81-
}
8257

8358
afterEvaluate {
84-
javadoc.classpath += files(android.libraryVariants.collect { variant ->
85-
variant.javaCompile.classpath.files
86-
})
87-
javadoc.dependsOn generateReleaseSources
88-
}
89-
90-
task javadocJar(type: Jar, dependsOn: javadoc) {
91-
classifier = 'javadoc'
92-
from javadoc
93-
}
94-
95-
artifacts {
96-
archives javadocJar, sourcesJar
97-
}
98-
99-
signing {
100-
required { signing.hasProperty('keyId') }
101-
sign configurations.archives
102-
}
103-
104-
ext.createPom = { pom ->
105-
pom.project {
106-
name 'Application Crash Report for Android'
107-
description 'Publishes a report of an Android application crash to an end point.'
108-
packaging 'aar'
109-
url 'http://acra.ch'
110-
111-
scm {
112-
connection 'scm:git:https://github.com/ACRA/acra.git'
113-
developerConnection 'scm:git:git@github.com:ACRA/acra.git'
114-
url 'https://github.com/ACRA/acra.git'
115-
}
116-
117-
licenses {
118-
license {
119-
name 'Apache 2'
120-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
121-
distribution 'repo'
122-
}
123-
}
124-
125-
developers {
126-
developer {
127-
id = 'kevin.gaudin'
128-
name = 'Kevin Gaudin'
129-
}
130-
developer {
131-
id = 'william.ferguson'
132-
name = 'William Ferguson'
133-
}
134-
developer {
135-
id = 'f43nd1r'
136-
name = 'Lukas Morawietz'
59+
publishing {
60+
publications {
61+
maven(MavenPublication) {
62+
from components.release
63+
64+
artifact androidJavadocsJar
65+
artifact androidSourcesJar
66+
67+
groupId = project.group
68+
artifactId = project.archivesBaseName
69+
version = project.version
70+
71+
pom {
72+
name = 'Application Crash Report for Android'
73+
description = 'Publishes a report of an Android application crash to an end point.'
74+
packaging = 'aar'
75+
url = 'http://acra.ch'
76+
77+
scm {
78+
connection = 'scm:git:https://github.com/ACRA/acra.git'
79+
developerConnection = 'scm:git:git@github.com:ACRA/acra.git'
80+
url = 'https://github.com/ACRA/acra.git'
81+
}
82+
83+
licenses {
84+
license {
85+
name = 'Apache 2'
86+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
87+
distribution = 'repo'
88+
}
89+
}
90+
91+
developers {
92+
developer {
93+
id = 'kevin.gaudin'
94+
name = 'Kevin Gaudin'
95+
}
96+
developer {
97+
id = 'william.ferguson'
98+
name = 'William Ferguson'
99+
}
100+
developer {
101+
id = 'f43nd1r'
102+
name = 'Lukas Morawietz'
103+
}
104+
}
105+
}
137106
}
138107
}
139-
}
140-
}
141-
142-
install {
143-
repositories.mavenInstaller {
144-
createPom(pom)
145-
}
146-
}
147108

148-
uploadArchives {
149-
repositories {
150-
mavenDeployer {
151-
beforeDeployment { deployment -> signing.signPom(deployment) }
152-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
153-
authentication(userName: ossrhUser, password: ossrhPassword)
109+
repositories {
110+
maven {
111+
name = "MavenCentral"
112+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
113+
credentials {
114+
username = ossrhUser
115+
password = ossrhPassword
116+
}
154117
}
155-
createPom(pom)
156118
}
157119
}
158-
}
159-
160-
nexusStaging {
161-
username = ossrhUser
162-
password = ossrhPassword
163-
packageGroup = group
164-
}
165120

166-
artifactory {
167-
contextUrl = 'https://oss.jfrog.org/artifactory'
168-
publish {
169-
repository {
170-
repoKey = version.endsWith('SNAPSHOT') ? 'oss-snapshot-local' : 'oss-release-local'
171-
username = artifactoryUser
172-
password = artifactoryApiKey
173-
maven = true
174-
}
175-
defaults {
176-
publishConfigs('archives')
177-
publishPom = true
178-
publishIvy = false
179-
}
121+
signing {
122+
sign publishing.publications.maven
180123
}
181-
resolve {
182-
repository {
183-
repoKey = 'jcenter'
184-
username = artifactoryUser
185-
password = artifactoryApiKey
186-
}
187-
}
188-
}
189-
190-
artifactoryPublish {
191-
dependsOn javadocJar
192-
dependsOn sourcesJar
193-
dependsOn install
194124
}

acra/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=4.11
1+
version=4.11.1
22
group=ch.acra
33
archivesBaseName=acra
44
androidVersion=27

acra/src/main/java/org/acra/collector/LogCatCollector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import android.support.annotation.NonNull;
2121
import android.support.annotation.Nullable;
2222

23-
import com.android.internal.util.Predicate;
24-
2523
import org.acra.ACRA;
2624
import org.acra.ACRAConstants;
2725
import org.acra.ReportField;
@@ -32,6 +30,7 @@
3230
import org.acra.model.StringElement;
3331
import org.acra.util.IOUtils;
3432
import org.acra.util.PackageManagerWrapper;
33+
import org.acra.util.Predicate;
3534

3635
import java.io.IOException;
3736
import java.io.InputStream;

acra/src/main/java/org/acra/util/IOUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import android.support.annotation.Nullable;
2020
import android.text.TextUtils;
2121

22-
import com.android.internal.util.Predicate;
23-
2422
import org.acra.ACRA;
2523
import org.acra.ACRAConstants;
2624
import org.acra.collections.BoundedLinkedList;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2018
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+
17+
package org.acra.util;
18+
19+
/**
20+
* @author f43nd1r
21+
* @since 19.07.18
22+
*/
23+
public interface Predicate<T> {
24+
25+
boolean apply(T t);
26+
}

annotationprocessor/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
apply plugin: 'java'
1818

1919
dependencies {
20-
compile fileTree(dir: 'libs', include: ['*.jar'])
21-
compile 'com.google.auto.service:auto-service:1.0-rc2'
22-
compile 'com.squareup:javapoet:1.7.0'
23-
compile project(':annotations')
20+
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc6'
21+
compileOnly 'com.google.auto.service:auto-service-annotations:1.0-rc6'
22+
implementation 'com.squareup:javapoet:1.11.1'
23+
implementation project(':annotations')
2424
}
2525

2626
sourceCompatibility = "1.8"

build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.0-rc02'
10-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
11-
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0"
12-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.9.0"
13-
classpath 'net.researchgate:gradle-release:2.5.0'
9+
classpath 'com.android.tools.build:gradle:3.6.3'
1410

1511
// NOTE: Do not place your application dependencies here; they belong
1612
// in the individual module build.gradle files
1713
}
1814
}
19-
apply plugin: 'com.jfrog.artifactory'
20-
apply plugin: 'io.codearte.nexus-staging'
2115

2216
allprojects {
2317
repositories {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

0 commit comments

Comments
 (0)