Created
July 28, 2021 14:23
-
-
Save orcchg/ad77b862e39bd473280f2ee708bb093d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// root build.gradle | |
static boolean isNewTypeProject(Project project) { | |
project.ext.has("isBuildSystemProject") | |
} | |
static boolean isAndroidLibraryPlugin(Plugin plugin) { | |
plugin.getClass().canonicalName in ["com.android.build.gradle.LibraryPlugin", | |
"com.android.build.gradle.AppPlugin"] | |
} | |
static boolean isJavaLibraryPlugin(Plugin plugin) { | |
plugin.getClass().canonicalName in ["org.gradle.api.plugins.JavaPlugin", | |
"org.gradle.api.plugins.JavaLibraryPlugin"] | |
} | |
subprojects { project -> | |
if (isNewTypeProject(project)) { // <-- this check doesn't work ! | |
println "${project.displayName} has been migrated to new Build System" | |
} else { | |
// feature module comes here intead | |
println "${project.displayName} has NOT been migrated to new Build System" | |
project.plugins.whenPluginAdded { plugin -> | |
if (isAndroidLibraryPlugin(plugin)) { | |
project.apply from: "$rootProject.projectDir/../sdakit/scripts/gradle/android_subproject.gradle" | |
} | |
if (isJavaLibraryPlugin(plugin)) { | |
project.apply from: "$rootProject.projectDir/../sdakit/scripts/gradle/java_subproject.gradle" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment