8000 Forma Android v0.1.3 by stepango · Pull Request #131 · formatools/forma · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Forma Android v0.1.3 #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
97 changes: 48 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<p align="center">
<a href="https://forma.tools" target="_blank" rel="noopener noreferrer"><img width="100" src="./img/press.svg" alt="Logo"></a>
</p>
Expand All @@ -18,9 +17,12 @@
<img alt="GitHub top language" src="https://img.shields.io/github/languages/top/formatools/forma"/>
<img alt="GitHub closed pull requests" src="https://img.shields.io/github/issues-pr-closed/formatools/forma"/>
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/formatools/forma?style=social"/>
</p>
</p>

**Forma** - Kotlin first, Meta Build System with Android and Gradle support. Opinionated, scalable, thoughtfully structured, type-safe and guided way to declare your project structure. Distributed as a Gradle plugin, Forma helps developers to shift focus from `Build Configuration` to `Project Structure Declaration`, abstracting away build configuration complexity.
**Forma** - Kotlin first, Meta Build System with Android and Gradle support. Opinionated, scalable, thoughtfully
structured, type-safe and guided way to declare your project structure. Distributed as a Gradle plugin, Forma helps
developers to shift focus from `Build Configuration` to `Project Structure Declaration`, abstracting away build
configuration complexity.

- You don't need to be a gradle expert anymore
- Get rid of project configuration bad practices
Expand All @@ -32,50 +34,46 @@
- Extensible - be the expert when you need to!
- And much more...

⚠️ We are using `target` term to express application components(e.g. modules or projects, depending in the context) across documentation and code, there is couple of reasons for that. `Module` term often confused with Dagger modules which makes communication harder, `project` from the other hand used only in Gradle context but not in other build systems like Buck and Bazel.
⚠️ We are using `target` term to express application components(e.g. modules or projects, depending in the context)
across documentation and code, there is a couple of reasons for that. `Module` term often confused with Dagger modules
which makes communication harder, `project` from the other hand used only in Gradle context but not in other build
systems like Buck and Bazel.

⚠️ This is early *alpha* release - please do try this at home🏠

Easiest way to start is here >> ‼️ https://github.com/stepango/FormaShowcase ‼️

[Presentation Link](https://www.beautiful.ai/player/-MLn7RnBBWeh7vePDoDq)

Configuration made easy (Gradle 6.8+):
```gradle
// settings.gradle.kts
dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
google()
jcenter()
}
}

```

Configuration made easy:

``` gradle
// root build.gradle.kts
buildscript {
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
}

plugins {
id("tools.forma.android") version "0.0.1"
id("tools.forma.android") version "0.1.3"
}

// Configure shared aspects of your android Project
androidProjectConfiguration(
minSdk = 21,
targetSdk = 29,
compileSdk = 29,
kotlinVersion = "1.4.10",
agpVersion = "4.0.0",
versionCode = 1,
versionName = "1.0"
)
buildscript {
androidProjectConfiguration(
project = project,
minSdk = 21,
targetSdk = 33,
compileSdk = 33,
agpVersion = "7.4.2",
dataBinding = true,
extraPlugins = listOf(
"androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3",
"com.google.firebase:firebase-crashlytics-gradle:2.9.4",
)
)
}
```

Your kotlin android library
Expand Down Expand Up @@ -105,24 +103,25 @@ androidLibrary(
)
)
```

## Progress

| Supported target types | implemented | purpose | validation |
|:-----------------------------:|:-----------:|:------------------------:|:-----------:
| androidBinary | | Genearte single APK | |
| androidApp | | Application class | partial |
| androidLibrary | | Android library | partial |
| dataBinding | ✅ | Data Binding Layouts | partial |
| dataBindingAdapters | ✅ | Data Binding Adapters | partial |
| androidWidget | | Custom View | partial |
| androidRes | | Resources Only | |
| androidTestUtils | ✅ | Shared code for Android tests | |
| androidUtils | | Library extensions | partial |
| testUtils | ✅ | Shared code for unit tests | |
| utils | ✅ | JVM Library extensions | partial |
| library | | JVM Library | partial |
| api | ✅ | Feature external API's | partial |
| impl | ✅ | Feature implementation | partial |


Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
| Supported target types | implemented | purpose | validation |
|:----------------------:|:-----------:|:-----------------------------:|:----------:|
| androidBinary | | Genearte single APK | |
| androidApp | | Application class | partial |
| androidLibrary | | Android library | partial |
| dataBinding | ✅ | Data Binding Layouts | partial |
| dataBindingAdapters | ✅ | Data Binding Adapters | partial |
| androidWidget | | Custom View | partial |
| androidRes | | Resources Only | |
| androidTestUtils | ✅ | Shared code for Android tests | |
| androidUtils | | Library extensions | partial |
| testUtils | ✅ | Shared code for unit tests | |
| utils | ✅ | JVM Library extensions | partial |
| library | | JVM Library | partial |
| api | ✅ | Feature external API's | partial |
| impl | ✅ | Feature implementation | partial |

Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a>
from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
2 changes: 1 addition & 1 deletion build-dependencies/dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
group = "tools.forma.demo"

dependencies {
implementation("tools.forma:deps-core")
implementation("tools.forma:deps")
implementation("tools.forma:owners")
implementation("tools.forma:config")

Expand Down
4 changes: 2 additions & 2 deletions build-dependencies/dependencies/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
import tools.forma.deps_core.PluginWrapper
import tools.forma.deps_core.pluginConfiguration
import tools.forma.deps.core.PluginWrapper
import tools.forma.deps.core.pluginConfiguration

object Plugins {

Expand Down
4 changes: 2 additions & 2 deletions build-dependencies/dependencies/src/main/kotlin/Team.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tools.forma.owner.Person
import tools.forma.owner.Team
import tools.forma.owners.Person
import tools.forma.owners.Team

object Users {
val stepango = Person(
Expand Down
51 changes: 26 additions & 25 deletions plugins/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@ plugins {
id("com.gradle.plugin-publish")
}

group = "tools.forma"
version = "0.1.2"
group = rootProject.ext["group"] as String
version = rootProject.ext["version"] as String

gradlePlugin {
website.set(rootProject.ext["website"] as String)
vcsUrl.set(rootProject.ext["vcsUrl"] as String)
plugins {
create(name) {
id = "$group.$name"
displayName = rootProject.ext["displayName"] as String
description = rootProject.ext["description"] as String
implementationClass = "$id.plugin.FormaPlugin"
@Suppress("UNCHECKED_CAST")
tags.set(rootProject.ext["tags"] as List<String>)
}
}
}

tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
compilerOptions {
Expand All @@ -19,33 +34,19 @@ tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
dependencies {
implementation("com.android.tools.build:gradle:7.4.2")
implementation(embeddedKotlin("gradle-plugin"))
implementation(project(":deps-core"))
implementation(project(":target"))
implementation(project(":validation"))
implementation(project(":owners"))
implementation(project(":config"))
implementation(project(":deps"))
}

gradlePlugin {
website.set("https://forma.tools/")
vcsUrl.set("https://github.com/formatools/forma.git")
plugins {
create("Forma") {
id = "tools.forma.android"
displayName = "Forma - Meta Build System with Gradle and Android support"
description = "Best way to structure your Android Project"
implementationClass = "tools.forma.android.plugin.FormaPlugin"
tags.set(
listOf(
"kotlin",
"android",
"structure",
"dependencies",
"module",
"rules",
"project"
)
)
}
}
tasks.named<Task>("publishPlugins") {
dependsOn(
":target:publishPlugins",
":validation:publishPlugins",
":owners:publishPlugins",
":config:publishPlugins",
":deps:publishPlugins",
)
}
2 changes: 1 addition & 1 deletion plugins/android/src/main/java/TargetBuilder.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import org.gradle.api.Project
import tools.forma.deps_core.PluginWrapper
import tools.forma.deps.core.PluginWrapper

class TargetBuilder(
private val project: Project
Expand Down
10 changes: 5 additions & 5 deletions plugins/android/src/main/java/androidApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import tools.forma.android.feature.androidLibraryFeatureDefinition
import tools.forma.android.feature.applyFeatures
import tools.forma.android.feature.kotlinAndroidFeatureDefinition
import tools.forma.android.target.ApplicationTargetTemplate
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.android.utils.BuildConfiguration
import tools.forma.validation.EmptyValidator
import tools.forma.android.validation.disallowResources
import tools.forma.validation.validate
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
import tools.forma.deps_core.FormaDependency
import tools.forma.deps_core.NamedDependency
import tools.forma.deps_core.applyDependencies
import tools.forma.deps.core.FormaDependency
import tools.forma.deps.core.NamedDependency
import tools.forma.deps.core.applyDependencies
import org.gradle.api.Project
import tools.forma.android.feature.kaptConfigurationFeature

Expand Down
8 changes: 4 additions & 4 deletions plugins/android/src/main/java/androidBinary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import org.gradle.api.Project
import tools.forma.android.feature.AndroidBinaryFeatureConfiguration
import tools.forma.android.feature.androidBinaryFeatureDefinition
import tools.forma.android.feature.applyFeatures
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.android.target.BinaryTargetTemplate
import tools.forma.android.utils.BuildConfiguration
import tools.forma.android.validation.disallowResources
import tools.forma.deps_core.FormaDependency
import tools.forma.deps_core.applyDependencies
import tools.forma.deps.core.FormaDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.validation.EmptyValidator
import tools.forma.validation.validate

Expand Down
10 changes: 5 additions & 5 deletions plugins/android/src/main/java/androidLibrary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import tools.forma.android.feature.androidLibraryFeatureDefinition
import tools.forma.android.feature.applyFeatures
import tools.forma.android.feature.kaptC F438 onfigurationFeature
import tools.forma.android.feature.kotlinAndroidFeatureDefinition
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.android.target.LibraryTargetTemplate
import tools.forma.android.utils.BuildConfiguration
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
import tools.forma.deps_core.FormaDependency
import tools.forma.deps_core.NamedDependency
import tools.forma.deps_core.applyDependencies
import tools.forma.deps.core.FormaDependency
import tools.forma.deps.core.NamedDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.validation.EmptyValidator
import tools.forma.validation.validate

Expand Down
4 changes: 2 additions & 2 deletions plugins/android/src/main/java/androidNative.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import org.gradle.api.Project
import tools.forma.android.config.NdkAbi
import tools.forma.android.config.NdkBuildSystem
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.android.target.NativeTarget
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
Expand Down
8 changes: 4 additions & 4 deletions plugins/android/src/main/java/androidRes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import tools.forma.android.feature.applyFeatures
import tools.forma.android.feature.kotlinAndroidFeatureDefinition
import tools.forma.android.target.ResourcesTargetTemplate
import tools.forma.android.target.WidgetTargetTemplate
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.validation.validate
import tools.forma.validation.validator
import tools.forma.android.validation.onlyAllowResources
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
import org.gradle.api.Project
import tools.forma.deps_core.applyDependencies
import tools.forma.deps_core.FormaDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.deps.core.FormaDependency

// Only resources allowed
fun Project.androidRes(
Expand Down
8 changes: 4 additions & 4 deletions plugins/android/src/main/java/androidTestUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import tools.forma.android.feature.applyFeatures
import tools.forma.android.feature.kotlinAndroidFeatureDefinition
import tools.forma.android.target.AndroidTestUtilTargetTemplate
import tools.forma.android.target.TestUtilTargetTemplate
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.validation.validate
import tools.forma.validation.validator
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
import org.gradle.api.Project
import tools.forma.deps_core.applyDependencies
import tools.forma.deps_core.FormaDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.deps.core.FormaDependency

fun Project.androidTestUtil(
packageName: String,
Expand Down
8 changes: 4 additions & 4 deletions plugins/android/src/main/java/androidUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import tools.forma.android.feature.kotlinAndroidFeatureDefinition
import tools.forma.android.target.AndroidUtilTargetTemplate
import tools.forma.android.target.ResourcesTargetTemplate
import tools.forma.android.target.TestUtilTargetTemplate
import tools.forma.owner.NoOwner
import tools.forma.owner.Owner
import tools.forma.owners.NoOwner
import tools.forma.owners.Owner
import tools.forma.validation.validate
import tools.forma.validation.validator
import tools.forma.android.validation.disallowResources
import tools.forma.android.visibility.Public
import tools.forma.android.visibility.Visibility
import org.gradle.api.Project
import tools.forma.android.feature.kaptConfigurationFeature
import tools.forma.deps_core.applyDependencies
import tools.forma.deps_core.FormaDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.deps.core.FormaDependency

/**
* TODO
Expand Down
8 changes: 4 additions & 4 deletions plugins/android/src/main/java/api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import tools.forma.android.feature.kotlinFeatureDefinition
import tools.forma.android.target.ApiTargetTemplate
import tools.forma.android.target.LibraryTargetTemplate
import tools.forma.validation.validator
import tools.forma.owner.Owner
import tools.forma.owner.NoOwner
import tools.forma.owners.Owner
import tools.forma.owners.NoOwner
import tools.forma.android.validation.disallowResources
import org.gradle.api.Project
import tools.forma.deps_core.applyDependencies
import tools.forma.deps_core.FormaDependency
import tools.forma.deps.core.applyDependencies
import tools.forma.deps.core.FormaDependency
import tools.forma.validation.validate

fun Project.api(
Expand Down
Loading
0