Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Add support for Android's archivesBaseName property #202

Merged
merged 4 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class AndroidArtifacts implements Artifacts {
}

def mainJar(Project project) {
"$project.buildDir/outputs/aar/${project.name}-${variant.baseName}.aar"
def artifactBaseName = project.getProperty("archivesBaseName")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about checking if archivesBaseName is defined, if so use it, if not fall back to ${project.name}-${variant.baseName}?

Copy link
Contributor Author

@steurt steurt Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure it can be added as a fallback, but I would prefer not to. This seems like the only right way to determine the archive's name.

Do you agree, or would you like me to add the fallback anyway?

I do agree with you. Since it's a dynamic property and not an an actual property of the Project type it's probably better to have a fallback. I'll add this!

"$project.buildDir/outputs/aar/$artifactBaseName-${variant.baseName}.aar"
}

def from(Project project) {
Expand Down
2 changes: 2 additions & 0 deletions samples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ android {
targetSdkVersion 27
versionCode 1
versionName "1.0.0"

setProperty("archivesBaseName", "$project.name-$versionName")
}
}

Expand Down