Skip to content

Commit

Permalink
添加aar 生成代码
Browse files Browse the repository at this point in the history
  • Loading branch information
puyang1017 committed Dec 22, 2021
1 parent ea4de54 commit b5a4f20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conf.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {
targetSdkVersion : 29,

versionCode : 23,
versionName : '2.0.0',
versionName : '1.8.4',
]
dependencies = [
"butterknife" : "com.jakewharton:butterknife:10.1.0",
Expand Down
24 changes: 23 additions & 1 deletion puymvpjava/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,29 @@ android {
dirs 'libs'
}
}

//自动追加版本号和版本名称
android.libraryVariants.all { variant ->
if(variant.name.equalsIgnoreCase("release")) {
// 修改aar名称
variant.outputs.all { output ->
def f = output.outputFileName
if (f != null && f.endsWith('.aar')) {
output.outputFileName = "Mvp_"+defaultConfig.versionName+".aar"
}
}
// 复制aar到指定目录
variant.assemble.doLast {
variant.outputs.all { output ->
// 输出目录在:项目目录/libs/
def outputPath = [project.rootDir.absolutePath, "app", "libs"].join(File.separator)
copy {
from output.outputFile
into outputPath
}
}
}
}
}
}


Expand Down

0 comments on commit b5a4f20

Please sign in to comment.