Skip to content

Commit

Permalink
Fix android 30 compatibility. Modernize upload, switch to manual rele…
Browse files Browse the repository at this point in the history
…ase for simplicity.
  • Loading branch information
f43nd1r committed Jun 17, 2020
1 parent 05e9a53 commit e069cb9
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 165 deletions.
226 changes: 78 additions & 148 deletions acra/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'net.researchgate.release'
apply plugin: 'com.jfrog.artifactory'

android {
compileSdkVersion Integer.parseInt(androidVersion)
Expand All @@ -25,170 +23,102 @@ android {
}

dependencies {
compile "com.android.support:support-compat:$supportVersion"
compile "com.android.support:support-fragment:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
implementation "com.android.support:support-compat:$supportVersion"
implementation "com.android.support:support-fragment:$supportVersion"
implementation "com.android.support:support-annotations:$supportVersion"
annotationProcessor project(':annotationprocessor')
provided project(':annotations')
compileOnly project(':annotations')
}

/*
* How to oss upload:
*
* Edit or create the file at ~/.gradle/gradle.properties and add
* signing.keyId=<short ID of your key>
* signing.password=<passphrase for your key>
* signing.secretKeyRingFile=<path to your key ring>
* Optional, depending on upload destination
* ossrhUser=<OSSRH user>
* ossrhPassword=<OSSRH password>
* artifactoryApiKey=<artifactory key>
* artifactoryUser=<jfrog artifactory user>
* Then run for ossrh upload
* gradlew release
*
* Or for jfrog oss artifactory
* gradlew artifactoryPublish
*/

release {
failOnUnversionedFiles = false
failOnCommitNeeded = true
tagTemplate = '$name-$version'
git {
requireBranch = "master"
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs + files('build/generated/source/buildConfig/release') + files('build/generated/ap_generated_sources/release/out')
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
afterEvaluate {
dependsOn assembleRelease
}
}

afterReleaseBuild {
dependsOn rootProject.closeAndPromoteRepository
}

rootProject.closeRepository {
dependsOn uploadArchives
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier.set('javadoc')
from androidJavadocs.destinationDir
}

task sourcesJar(type: Jar) {
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

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

afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
javadoc.dependsOn generateReleaseSources
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc
}

artifacts {
archives javadocJar, sourcesJar
}

signing {
required { signing.hasProperty('keyId') }
sign configurations.archives
}

ext.createPom = { pom ->
pom.project {
name 'Application Crash Report for Android'
description 'Publishes a report of an Android application crash to an end point.'
packaging 'aar'
url 'http://acra.ch'

scm {
connection 'scm:git:https://github.com/ACRA/acra.git'
developerConnection 'scm:git:git@github.com:ACRA/acra.git'
url 'https://github.com/ACRA/acra.git'
}

licenses {
license {
name 'Apache 2'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

developers {
developer {
id = 'kevin.gaudin'
name = 'Kevin Gaudin'
}
developer {
id = 'william.ferguson'
name = 'William Ferguson'
}
developer {
id = 'f43nd1r'
name = 'Lukas Morawietz'
publishing {
publications {
maven(MavenPublication) {
from components.release

artifact androidJavadocsJar
artifact androidSourcesJar

groupId = project.group
artifactId = project.archivesBaseName
version = project.version

pom {
name = 'Application Crash Report for Android'
description = 'Publishes a report of an Android application crash to an end point.'
packaging = 'aar'
url = 'http://acra.ch'

scm {
connection = 'scm:git:https://github.com/ACRA/acra.git'
developerConnection = 'scm:git:git@github.com:ACRA/acra.git'
url = 'https://github.com/ACRA/acra.git'
}

licenses {
license {
name = 'Apache 2'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}

developers {
developer {
id = 'kevin.gaudin'
name = 'Kevin Gaudin'
}
developer {
id = 'william.ferguson'
name = 'William Ferguson'
}
developer {
id = 'f43nd1r'
name = 'Lukas Morawietz'
}
}
}
}
}
}
}

install {
repositories.mavenInstaller {
createPom(pom)
}
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPassword)
repositories {
maven {
name = "MavenCentral"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username = ossrhUser
password = ossrhPassword
}
}
createPom(pom)
}
}
}

nexusStaging {
username = ossrhUser
password = ossrhPassword
packageGroup = group
}

artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = version.endsWith('SNAPSHOT') ? 'oss-snapshot-local' : 'oss-release-local'
username = artifactoryUser
password = artifactoryApiKey
maven = true
}
defaults {
publishConfigs('archives')
publishPom = true
publishIvy = false
}
signing {
sign publishing.publications.maven
}
resolve {
repository {
repoKey = 'jcenter'
username = artifactoryUser
password = artifactoryApiKey
}
}
}

artifactoryPublish {
dependsOn javadocJar
dependsOn sourcesJar
dependsOn install
}
2 changes: 1 addition & 1 deletion acra/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=4.11
version=4.11.1
group=ch.acra
archivesBaseName=acra
androidVersion=27
Expand Down
3 changes: 1 addition & 2 deletions acra/src/main/java/org/acra/collector/LogCatCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.android.internal.util.Predicate;

import org.acra.ACRA;
import org.acra.ACRAConstants;
import org.acra.ReportField;
Expand All @@ -32,6 +30,7 @@
import org.acra.model.StringElement;
import org.acra.util.IOUtils;
import org.acra.util.PackageManagerWrapper;
import org.acra.util.Predicate;

import java.io.IOException;
import java.io.InputStream;
Expand Down
2 changes: 0 additions & 2 deletions acra/src/main/java/org/acra/util/IOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.android.internal.util.Predicate;

import org.acra.ACRA;
import org.acra.ACRAConstants;
import org.acra.collections.BoundedLinkedList;
Expand Down
26 changes: 26 additions & 0 deletions acra/src/main/java/org/acra/util/Predicate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.acra.util;

/**
* @author f43nd1r
* @since 19.07.18
*/
public interface Predicate<T> {

boolean apply(T t);
}
8 changes: 4 additions & 4 deletions annotationprocessor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
apply plugin: 'java'

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

sourceCompatibility = "1.8"
Expand Down
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-rc02'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.9.0"
classpath 'net.researchgate:gradle-release:2.5.0'
classpath 'com.android.tools.build:gradle:3.6.3'

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

allprojects {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

0 comments on commit e069cb9

Please sign in to comment.