Skip to content

Commit

Permalink
Merge pull request #5 from alibaba/develop
Browse files Browse the repository at this point in the history
first release & add demo apk.
  • Loading branch information
zhi1ong authored Jun 17, 2021
2 parents 9f1a91a + 00e82aa commit 5a0331c
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 3 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Patrons

[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/patrons/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/patrons)

`🎉 A framework for improving android 32bit app stability. (Alleviate crashes caused by insufficient virtual memory)`

一行代码解决 Android 32位应用因虚拟内存不足导致的 libc:abort(signal 6)
Expand All @@ -17,10 +19,21 @@
## 三、使用方式
编译`patrons`模块,主工程依赖该模块产物,在合适的时机进行初始化:

```groovy
repositories {
mavenCentral()
}
dependencies {
implementation 'com.alibaba:patrons:1.0.6.2'
}
```

```java
com.alibaba.android.patronus.Patrons.init(context, null);
com.alibaba.android.patronus.Patrons.init(context, null);
```

##### [→ 测试 Demo 下载](https://github.com/alibaba/Patrons/blob/develop/demo/patrons-demo-1.0.6.2.apk)

## 四、Q & A

1. SDK 本身会带来多少接入成本(包大小、稳定性):包大小增加20k左右,可以忽略不计;关键逻辑中会有多层保护,不会引发新的崩溃。
Expand Down
Binary file added demo/patrons-demo-1.0.6.2.apk
Binary file not shown.
16 changes: 15 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

android.injected.testOnly=false
android.injected.testOnly=false

GROUP=com.alibaba

POM_URL=https://github.com/alibaba/Patrons/
POM_SCM_URL=https://github.com/alibaba/Patrons/
POM_SCM_CONNECTION=scm:git:git://github.com/alibaba/Patrons.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/alibaba/Patrons.git

POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=https://github.com/alibaba/Patrons/blob/main/LICENSE
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=zhi1ong
POM_DEVELOPER_NAME=ZhiLong Liu
174 changes: 174 additions & 0 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* Copyright 2013 Chris Banes
*
* 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.
*/

apply plugin: 'maven'
apply plugin: 'signing'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
}

def configurePom(pom) {
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

configurePom(pom)
}
}
}

tasks.create("installLocally", Upload) {
configuration = configurations.archives

repositories {
mavenDeployer {
repository(url: "file://${rootProject.buildDir}/localMaven")

configurePom(pom)
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
task install(type: Upload, dependsOn: assemble) {
repositories.mavenInstaller {
configuration = configurations.archives

configurePom(pom)
}
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
} else {
install {
repositories.mavenInstaller {
configurePom(pom)
}
}

task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

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

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

artifacts {
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
archives androidSourcesJar
archives androidJavadocsJar
} else {
archives sourcesJar
archives javadocJar
}
}
}
4 changes: 3 additions & 1 deletion patrons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
}

apply from: rootProject.file('gradle/publish.gradle')
5 changes: 5 additions & 0 deletions patrons/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
POM_NAME=Patrons SDK
POM_ARTIFACT_ID=patrons
POM_PACKAGING=aar
POM_DESCRIPTION=Patrons SDK for android.
VERSION_NAME=1.0.6.2

0 comments on commit 5a0331c

Please sign in to comment.