Skip to content

Commit

Permalink
Merge pull request #25 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
Added LibraryExtension Config for feature convention plugin
  • Loading branch information
stzouvaras authored Feb 20, 2024
2 parents 369355d + 73a62b0 commit 9dc43a7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
*/

import com.android.build.gradle.LibraryExtension
import eu.europa.ec.euidi.config.LibraryPluginConfig
import eu.europa.ec.euidi.configureGradleManagedDevices
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.dependencies

class AndroidFeatureConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
val config = extensions.create<LibraryPluginConfig>("featureConfig", false)
pluginManager.apply {
apply("eudi.android.library")
apply("eudi.android.library.compose")
Expand All @@ -45,6 +48,14 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
add("testImplementation", project(":test-feature"))
add("androidTestImplementation", project(":test-feature"))
}

afterEvaluate {
if (!config.isCommonFeature) {
dependencies {
add("implementation", project(":common-feature"))
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2023 European Commission
*
* Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
* Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work
* except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the Licence for the specific language
* governing permissions and limitations under the Licence.
*/

package eu.europa.ec.euidi.config

open class LibraryPluginConfig(var isCommonFeature: Boolean)
4 changes: 4 additions & 0 deletions common-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ android {

dependencies {
implementation(libs.gson)
}

featureConfig {
isCommonFeature = true
}
1 change: 0 additions & 1 deletion dashboard-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ android {
}

dependencies {
implementation(project(":common-feature"))
implementation(libs.zxing)
implementation(libs.androidx.camera.core)
implementation(libs.androidx.camera.lifecycle)
Expand Down
4 changes: 0 additions & 4 deletions issuance-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ plugins {

android {
namespace = "eu.europa.ec.issuancefeature"
}

dependencies {
implementation(project(":common-feature"))
}
4 changes: 0 additions & 4 deletions login-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ plugins {
android {
namespace = "eu.europa.ec.loginfeature"
}

dependencies {
implementation(project(":common-feature"))
}
4 changes: 0 additions & 4 deletions presentation-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ plugins {

android {
namespace = "eu.europa.ec.presentationfeature"
}

dependencies {
implementation(project(":common-feature"))
}
1 change: 0 additions & 1 deletion proximity-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ android {
}

dependencies {
implementation(project(":common-feature"))
implementation(libs.zxing)
}
4 changes: 0 additions & 4 deletions startup-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ plugins {

android {
namespace = "eu.europa.ec.startupfeature"
}

dependencies {
implementation(project(":common-feature"))
}

0 comments on commit 9dc43a7

Please sign in to comment.