-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump dependencies, update build script
- Loading branch information
Showing
9 changed files
with
216 additions
and
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
def buildVersionSuffix() { | ||
if (runningOnJenkins) { | ||
def versionSuffix = System.getenv('VERSION_SUFFIX')?.trim() | ||
return "${versionSuffix == null || versionSuffix.empty ? "" : "${versionSuffix}_"}${System.getenv('BUILD_NUMBER')?.trim()}_${System.getenv('GIT_COMMIT')?.subSequence(0, 6)?.trim()}" | ||
} | ||
return 'local' | ||
} | ||
|
||
def renameLibraryVariantOutput(variant) { | ||
variant.outputs.all { output -> | ||
if (outputFileName.endsWith('.aar')) { | ||
outputFileName = "${buildLibraryArchiveBaseName(variant)}.aar" | ||
} | ||
} | ||
} | ||
|
||
def buildLibraryArchiveBaseName(variant) { | ||
return "${project.name}_${android.defaultConfig.versionName}_${buildVersionSuffix()}-${variant.baseName}" | ||
} | ||
|
||
ext { | ||
buildVersionSuffix = this.&buildVersionSuffix | ||
renameLibraryVariantOutput = this.&renameLibraryVariantOutput | ||
buildLibraryArchiveBaseName = this.&buildLibraryArchiveBaseName | ||
} |
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,95 @@ | ||
apply plugin: 'maven-publish' | ||
|
||
/** | ||
* Sources Jar | ||
*/ | ||
android.libraryVariants.all { variant -> | ||
renameLibraryVariantOutput(variant) | ||
|
||
task("generate${variant.name.capitalize()}SourcesJar", type: Jar) { | ||
classifier = 'sources' | ||
from variant.sourceSets*.java.srcDirs.flatten() | ||
baseName = buildLibraryArchiveBaseName(variant) | ||
} | ||
} | ||
|
||
/** | ||
* Maven Publication | ||
*/ | ||
publishing { | ||
repositories { | ||
maven { | ||
name "nexus" | ||
credentials { | ||
username nexusUsername | ||
password nexusPassword | ||
} | ||
url project.android.defaultConfig.versionName.endsWith('-SNAPSHOT') ? nexusSnapshotsRepository : nexusReleasesRepository | ||
} | ||
} | ||
|
||
afterEvaluate { | ||
publications { | ||
android.libraryVariants.each { variant -> | ||
"${variant.name}"(MavenPublication) { | ||
groupId project.group | ||
artifactId "${project.name}${variant.buildType.name == "release" ? "" : "-${variant.buildType.name}"}" | ||
version project.android.defaultConfig.versionName | ||
|
||
artifact tasks["bundle${variant.name.capitalize()}Aar"] | ||
artifact tasks["generate${variant.name.capitalize()}SourcesJar"] | ||
|
||
pom { | ||
packaging = 'aar' | ||
name = project.title | ||
description = project.description | ||
url = project.scm.url | ||
|
||
developers { | ||
project.developers.each { d -> | ||
developer { | ||
id = d.id | ||
name = d.name | ||
email = d.email | ||
} | ||
} | ||
} | ||
|
||
scm { | ||
connection = project.scm.connection | ||
developerConnection = project.scm.developerConnection | ||
url = project.scm.url | ||
} | ||
|
||
withXml { | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
variant.compileConfiguration.allDependencies.each { | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
|
||
if (!it.excludeRules.empty) { | ||
def exclusionsNode = dependencyNode.appendNode('exclusions') | ||
it.excludeRules.each { rule -> | ||
def exclusionNode = exclusionsNode.appendNode('exclusion') | ||
exclusionNode.appendNode('groupId', rule.group) | ||
exclusionNode.appendNode('artifactId', rule.module) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
android.libraryVariants.all { variant -> | ||
model { | ||
tasks."generatePomFileFor${variant.name.capitalize()}Publication" { | ||
destination = new File(destination.parent, "${buildLibraryArchiveBaseName(variant)}-pom.xml") | ||
} | ||
} | ||
} |
Binary file not shown.
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
Oops, something went wrong.