Skip to content

Commit

Permalink
android-simple-multimodule sample: updated migration components naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Morfly committed Aug 4, 2021
1 parent 90fc0a2 commit 995ef90
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
4 changes: 2 additions & 2 deletions examples/migration/android-simple-multimodule/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ allprojects {
airin {
templates {
register Workspace
register KotlinLibraryBuild
register AndroidApplicationBuild
register KotlinModuleBuild
register AndroidModuleBuild
}

artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import org.gradle.api.Project
import org.morfly.airin.*
import org.morfly.airin.starlark.elements.StarlarkFile
import template.android_application_build_template
import template.android_module_build_template


/**
*
*/
class AndroidApplicationBuild : GradlePerModuleTemplateProvider() {
class AndroidModuleBuild : GradlePerModuleTemplateProvider() {

override fun canProvide(target: Project): Boolean =
target.plugins.hasPlugin(ANDROID_APPLICATION)
Expand All @@ -42,8 +42,9 @@ class AndroidApplicationBuild : GradlePerModuleTemplateProvider() {
.shortLabels()

return listOf(
android_application_build_template(
android_module_build_template(
name = target.name,
hasBinary = target.plugins.hasPlugin(ANDROID_APPLICATION),
packageName = target.packageName ?: "ERROR",
moduleDependencies = moduleDepsLabels,
artifactDependencies = artifactDepsLabels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
import org.gradle.api.Project
import org.morfly.airin.*
import org.morfly.airin.starlark.elements.StarlarkFile
import template.kotlin_library_build_template
import template.kotlin_module_build_template


/**
*
*/
class KotlinLibraryBuild : GradlePerModuleTemplateProvider() {
class KotlinModuleBuild : GradlePerModuleTemplateProvider() {

override fun canProvide(target: Project): Boolean = with(target.plugins) {
hasPlugin(KOTLIN_JVM) && !hasPlugin(APPLICATION) && !hasPlugin(ANDROID_LIBRARY)
Expand All @@ -40,7 +40,7 @@ class KotlinLibraryBuild : GradlePerModuleTemplateProvider() {
.shortLabels()

return listOf(
kotlin_library_build_template(
kotlin_module_build_template(
name = target.name,
moduleDependencies = moduleDepsLabels,
artifactDependencies = artifactDepsLabels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import org.morfly.airin.starlark.library.kt_android_library
/**
*
*/
fun android_application_build_template(
fun android_module_build_template(
name: String,
hasBinary: Boolean,
packageName: String,
moduleDependencies: List<Label>,
artifactDependencies: List<String>
Expand All @@ -55,19 +56,20 @@ fun android_application_build_template(
deps = moduleDependencies + artifactDependencies.map { artifact(it) }
)

android_binary(
name = "bin",
manifest = "src/main/AndroidManifest.xml",
custom_package = packageName,
resource_files = glob("src/main/res/**"),
manifest_values = dict {
"minSdkVersion" to "21"
"targetSdkVersion" to "29"
"versionCode" to "1"
"versionName" to "1.0"
},
debug_key = "debug.keystore",
visibility = list["//visibility:public"],
deps = list[":$name"]
)
if (hasBinary)
android_binary(
name = "bin",
manifest = "src/main/AndroidManifest.xml",
custom_package = packageName,
resource_files = glob("src/main/res/**"),
manifest_values = dict {
"minSdkVersion" to "21"
"targetSdkVersion" to "29"
"versionCode" to "1"
"versionName" to "1.0"
},
debug_key = "debug.keystore",
visibility = list["//visibility:public"],
deps = list[":$name"]
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.morfly.airin.starlark.library.kt_jvm_library
/**
*
*/
fun kotlin_library_build_template(
fun kotlin_module_build_template(
name: String,
moduleDependencies: List<Label>,
artifactDependencies: List<String>
Expand Down

0 comments on commit 995ef90

Please sign in to comment.