-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #26 Cannot Use Library in External Projects
* Upgrade to Gradle Version Catalogs, convention plugins. Move sourceset from java to kotlin, and upgrade build scripts. * Basic clean up * Add back in commented out code regarding the system status bar
- Loading branch information
1 parent
87629ae
commit e85e904
Showing
66 changed files
with
978 additions
and
484 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
[*] | ||
[*.{kt,kts}] | ||
# https://pinterest.github.io/ktlint/latest/rules/configuration-ktlint/#code-style | ||
ktlint_code_style = intellij_idea | ||
|
||
############################################# | ||
|
||
# https://pinterest.github.io/ktlint/latest/rules/configuration-ktlint/#final-newline | ||
insert_final_newline = true | ||
|
||
# https://pinterest.github.io/ktlint/latest/rules/standard/#trailing-comma-on-declaration-site | ||
ij_kotlin_allow_trailing_comma = false | ||
|
||
# https://pinterest.github.io/ktlint/latest/rules/standard/#trailing-comma-on-call-site | ||
ij_kotlin_allow_trailing_comma_on_call_site = false | ||
|
||
# https://pinterest.github.io/ktlint/latest/rules/standard/#no-wildcard-imports | ||
ij_kotlin_packages_to_use_import_on_demand = unset # Disallows all wildcard imports | ||
|
||
# https://pinterest.github.io/ktlint/latest/rules/standard/#import-ordering | ||
# https://pinterest.github.io/ktlint/latest/rules/standard/#no-wildcard-imports | ||
ij_kotlin_imports_layout = * # Alphabetical with capital letters before lower case letters (e.g. Z before a), no blank lines |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,91 +1,12 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("com.google.dagger.hilt.android") | ||
kotlin("android") | ||
kotlin("kapt") | ||
} | ||
|
||
android { | ||
compileSdk = Versions.COMPILE_SDK | ||
namespace = "${Config.APPLICATION_ID}.sample" | ||
|
||
defaultConfig { | ||
applicationId = "${Config.APPLICATION_ID}.sample" | ||
|
||
minSdk = Versions.MIN_SDK | ||
targetSdk = Versions.TARGET_SDK | ||
|
||
versionCode = Versions.VERSION_CODE | ||
versionName = Versions.VERSION_NAME | ||
|
||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
isMinifyEnabled = false | ||
isTestCoverageEnabled = true | ||
} | ||
|
||
getByName("release") { | ||
isMinifyEnabled = false | ||
isShrinkResources = false | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = Versions.JVM | ||
targetCompatibility = Versions.JVM | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = Versions.JVM_STRING | ||
} | ||
alias(libs.plugins.multimodal.app) | ||
|
||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = Versions.COMPOSE_COMPILER | ||
} | ||
|
||
packagingOptions { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
alias(libs.plugins.multimodal.compose.app) | ||
alias(libs.plugins.multimodal.hilt) | ||
} | ||
|
||
dependencies { | ||
api(platform(project(":constraints"))) | ||
api(project(":multimodal")) | ||
kapt(platform(project(":constraints"))) | ||
|
||
///////////////////////////////////////////////////////////////////// | ||
|
||
// region Application | ||
|
||
debugImplementation(Libraries.COMPOSE_MANIFEST_TEST) | ||
debugImplementation(Libraries.COMPOSE_UI_TOOLING) | ||
|
||
implementation(Libraries.ACTIVITY_COMPOSE) | ||
implementation(Libraries.COMPOSE_UI) | ||
implementation(Libraries.COMPOSE_UI_TOOLING_PREVIEW) | ||
implementation(Libraries.CORE_KTX) | ||
implementation(Libraries.DAGGER_ANDROID) | ||
implementation(Libraries.MATERIAL) | ||
implementation(Libraries.MATERIAL_3) | ||
implementation(Libraries.NAVIGATION_COMPOSE) | ||
implementation(Libraries.WINDOW_MANAGER) | ||
|
||
kapt(Libraries.DAGGER_COMPILER) | ||
|
||
// endregion | ||
} | ||
implementation(project(":multimodal")) | ||
|
||
kapt { | ||
correctErrorTypes = true | ||
implementation(libs.material) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,2 @@ | ||
/build | ||
/*/build |
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,34 @@ | ||
# Convention Plugins | ||
|
||
The `build-logic` folder defines project-specific convention plugins, used to keep a single source | ||
of truth for common module configurations. | ||
|
||
This approach is heavily based on these articles and/or repositories: | ||
|
||
- [Now in Android](https://github.com/android/nowinandroid/tree/main/build-logic) | ||
- [Unlocking Reusability in Gradle: How to Use Kotlin-written Convention | ||
Plugins](https://medium.com/@amsavarthan/11b95cb008ef) | ||
- [Mastering Dependency Management: Version Catalog & Convention Plugin at | ||
Scale](https://proandroiddev.com/b94205595f6b) | ||
- [Using Version Catalogs from Gradle Precompiled Scripts with Kotlin | ||
DSL](https://medium.com/@saulmm2/df3c27ea017c) | ||
|
||
By setting up convention plugins in `build-logic`, we can avoid duplicated build script setup, | ||
messy `subproject` configurations, without the pitfalls of the `buildSrc` directory. | ||
|
||
`build-logic` is an included build, as configured in the root | ||
[`settings.gradle.kts`](../settings.gradle.kts). | ||
|
||
Inside `build-logic` is a `convention` module, which defines a set of plugins that all other | ||
modules can use to configure themselves. | ||
|
||
`build-logic` also includes a set of `Kotlin` files used to share logic between plugins themselves, | ||
which is most useful for configuring Android components (libraries vs applications) with shared | ||
code. | ||
|
||
These plugins are *additive* and *composable*, and try to only accomplish a single responsibility. | ||
Modules can then pick and choose the configurations they need. | ||
|
||
If there is one-off logic for a module without shared code, it's preferable to define that directly | ||
in the module's `build.gradle.kts`, as opposed to creating a convention plugin with module-specific | ||
setup. |
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,65 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
group = "com.oliverspryn.gradle" | ||
|
||
// Configure the build-logic plugins to target JDK 17 | ||
// This matches the JDK used to build the project, and is not related to what is running on device. | ||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.agp) | ||
compileOnly(libs.dokka) | ||
compileOnly(libs.kotlin) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("app") { | ||
id = "multimodal.app" | ||
implementationClass = "com.oliverspryn.gradle.plugin.AndroidApplicationConventionPlugin" | ||
} | ||
|
||
register("compose-app") { | ||
id = "multimodal.compose-app" | ||
implementationClass = "com.oliverspryn.gradle.plugin.ComposeApplicationConventionPlugin" | ||
} | ||
|
||
register("compose-library-base") { | ||
id = "multimodal.compose-library-base" | ||
implementationClass = "com.oliverspryn.gradle.plugin.BaseComposeLibraryConventionPlugin" | ||
} | ||
|
||
register("dokka") { | ||
id = "multimodal.dokka" | ||
implementationClass = "com.oliverspryn.gradle.plugin.DokkaConventionPlugin" | ||
} | ||
|
||
register("hilt") { | ||
id = "multimodal.hilt" | ||
implementationClass = "com.oliverspryn.gradle.plugin.HiltConventionPlugin" | ||
} | ||
|
||
register("library") { | ||
id = "multimodal.library" | ||
implementationClass = "com.oliverspryn.gradle.plugin.AndroidLibraryConventionPlugin" | ||
} | ||
|
||
register("publish") { | ||
id = "multimodal.publish" | ||
implementationClass = "com.oliverspryn.gradle.plugin.PublishConventionPlugin" | ||
} | ||
} | ||
} |
Oops, something went wrong.