-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from KwaiAppTeam/xqs/support-leakcanary-custo…
…m-dumper Support leakcanary custom dumper
- Loading branch information
Showing
85 changed files
with
1,021 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
task androidSourcesJar(type: Jar) { | ||
if (project.hasProperty("android")) { | ||
from android.sourceSets.main.java.srcDirs | ||
} else { | ||
from sourceSets.main.allSource | ||
} | ||
classifier 'sources' | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
archiveClassifier.set("javadoc") | ||
classifier "javadoc" | ||
} | ||
|
||
tasks.withType(Javadoc) { | ||
options.addStringOption('Xdoclint:none', '-quiet') | ||
options.addStringOption('encoding', 'UTF-8') | ||
options.addStringOption('charSet', 'UTF-8') | ||
} | ||
|
||
ext { | ||
PUBLISH_ARTIFACT_ID = "${project.getName()}" //project name | ||
} | ||
|
||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.secretKeyRingFile"] = '' | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
|
||
File secretPropsFile = project.rootProject.file('.gradle/gradle.properties') | ||
if (secretPropsFile.exists()) { | ||
println "Found secret props file, loading props" | ||
Properties p = new Properties() | ||
p.load(new FileInputStream(secretPropsFile)) | ||
p.each { name, value -> | ||
ext[name] = value | ||
} | ||
} else { | ||
println "No props file, loading env vars" | ||
} | ||
|
||
afterEvaluate { | ||
def curArtifactId | ||
android.libraryVariants.all { variant -> | ||
// Skipped debug variants | ||
if (variant.buildType.name == "debug") { | ||
return | ||
} | ||
def hasFlavors = !variant.flavorName.isEmpty() | ||
|
||
def artifactIdSuffix = hasFlavors ? variant.flavorName.replace('_', '-').capitalize() : '' | ||
variant.productFlavors.each { flavor -> | ||
def flavorArtifactIdSuffix = flavor.ext.has('artifactIdSuffix') ? flavor.ext.artifactIdSuffix : flavor.name | ||
if (!flavorArtifactIdSuffix.isEmpty()) { | ||
artifactIdSuffix = artifactIdSuffix.replace(flavor.name.capitalize(), "-${flavorArtifactIdSuffix}") | ||
} else { | ||
artifactIdSuffix = artifactIdSuffix.replace(flavor.name.capitalize(), "") | ||
} | ||
} | ||
if (!artifactIdSuffix.isEmpty() && !artifactIdSuffix.startsWith('-')) { | ||
artifactIdSuffix = '-' + artifactIdSuffix | ||
} | ||
|
||
curArtifactId = "${project.getName()}${artifactIdSuffix}" | ||
|
||
def publicationName = "android${variant.name.capitalize()}" | ||
publishing.publications { | ||
"$publicationName"(MavenPublication) { | ||
// The coordinates of the library, being set from variables that | ||
// we'll set up in a moment | ||
groupId GROUP | ||
artifactId curArtifactId | ||
version VERSION_NAME | ||
|
||
// Two artifacts, the `aar` and the sources | ||
if (project.hasProperty("android")) { | ||
if (hasFlavors) { | ||
variant.productFlavors.each { flavor -> | ||
artifact("build/outputs/aar/${project.getName()}-${flavor.name}-release.aar") | ||
} | ||
} else { | ||
artifact("build/outputs/aar/${project.getName()}-release.aar") | ||
} | ||
artifact androidSourcesJar | ||
} else { | ||
artifact("$buildDir/libs/${project.getName()}.jar") | ||
artifact androidSourcesJar | ||
artifact javadocJar | ||
} | ||
pom { | ||
name = "${project.getName()}" | ||
description = rootProject.name | ||
// If your project has a dedicated site, use its URL here | ||
url = POM_URL | ||
licenses { | ||
license { | ||
name = POM_LICENCE_NAME | ||
url = POM_LICENCE_URL | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = POM_DEVELOPER_ID | ||
name = POM_DEVELOPER_NAME | ||
} | ||
} | ||
// Version control info, if you're using GitHub, follow the format as seen here | ||
scm { | ||
|
||
connection = POM_SCM_CONNECTION | ||
developerConnection = POM_SCM_DEV_CONNECTION | ||
//branch address: | ||
url = POM_SCM_URL | ||
} | ||
// A slightly hacky fix so that your POM will include any transitive dependencies | ||
// that your library builds upon | ||
withXml { | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
project.configurations.implementation.allDependencies.each { | ||
if (it.group != null) { | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
if ((it.group).contains(rootProject.name)) { | ||
dependencyNode.appendNode('groupId', GROUP) | ||
// Consider a java project like "shark" | ||
if (it.dependencyProject.hasProperty("android")) { | ||
dependencyNode.appendNode('artifactId', "$it.name${artifactIdSuffix}") | ||
} else { | ||
dependencyNode.appendNode('artifactId', it.name) | ||
} | ||
dependencyNode.appendNode('version', VERSION_NAME) | ||
} else { | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishing.repositories { | ||
// The repository to publish to, Sonatype/MavenCentral | ||
maven { | ||
// This is an arbitrary name, you may also use "mavencentral" or | ||
// any other name that's descriptive for you | ||
name = rootProject.name | ||
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
// You only need this if you want to publish snapshots, otherwise just set the URL | ||
// to the release repo directly | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
|
||
// The username and password we've fetched earlier | ||
credentials { | ||
username ossrhUsername | ||
password ossrhPassword | ||
} | ||
} | ||
} | ||
signing { | ||
sign publishing.publications | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.