Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c9c3269
Moves most root plugins to plugin dsl
oguzkocer Sep 9, 2021
186f6f6
Move fetchstyle plugin to plugin dsl
oguzkocer Sep 9, 2021
dd2fd67
Most plugins in subprojects converted to plugin DSL
oguzkocer Sep 9, 2021
74159ec
Remove checkstyle plugin from libs/editor since it's applied for all …
oguzkocer Sep 9, 2021
44d06ab
Use plugin DSL for checkstyle and detekt plugins
oguzkocer Sep 9, 2021
77f94c3
Move androidx.navigation.safeargs.kotlin to plugin dsl
oguzkocer Sep 9, 2021
5f79fae
Remove buildscript section from root build file
oguzkocer Sep 9, 2021
448adf1
Move google-services plugin to plugin DSL
oguzkocer Sep 9, 2021
e6da156
Merge branch 'improve/build-gradle-file-format' into plugin-dsl
oguzkocer Dec 24, 2021
1e7728c
Use old syntax for applying checkstyle plugin
oguzkocer Dec 24, 2021
7610b17
Adds AGP to root build.gradle without applying
oguzkocer Dec 24, 2021
320eed4
Update kotlinVersion to 1.5.32
oguzkocer Dec 24, 2021
9bdab52
Force kotlin dependency resolution to specified value
oguzkocer Dec 24, 2021
be9c5b5
Merge remote-tracking branch 'origin/trunk' into plugin-dsl-2
oguzkocer May 24, 2022
6df0fe1
Fixes incorrect merge conflict resolution in editor build.gradle
oguzkocer May 24, 2022
b7a7a4c
Remove force resolutionStrategy for kotlin version
oguzkocer May 24, 2022
8329b6f
Use plugin DSL for com.google.gms.google-services
oguzkocer May 24, 2022
4fad668
Use plugin DSL for dagger.hilt
oguzkocer May 24, 2022
79fb6cf
Update navComponentVersion to 2.4.2
oguzkocer May 24, 2022
e3c97b8
Add 'google-services' plugin to build.gradle without applying
oguzkocer May 24, 2022
d573663
Update AGP version to 7.1.1
oguzkocer May 25, 2022
4fd566e
Merge remote-tracking branch 'origin/trunk' into plugin-dsl
oguzkocer Jun 1, 2022
7d0c5b8
Add kotlin parcelize plugin to root build.gradle without applying
oguzkocer Jun 1, 2022
f34d4ce
Revert changes due to git auto merge-conflict resolution
oguzkocer Jun 2, 2022
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
50 changes: 19 additions & 31 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubTask
import se.bjurr.violations.lib.model.SEVERITY

buildscript {
repositories {
google()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.google.gms:google-services:4.3.8'
classpath 'se.bjurr.violations:violation-comments-to-github-gradle-plugin:1.67'
classpath 'io.sentry:sentry-android-gradle-plugin:2.0.0'
}
plugins {
id "com.android.application"
id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.kapt"
id "org.jetbrains.kotlin.plugin.parcelize"
id "org.jetbrains.kotlin.plugin.allopen"
id "io.sentry.android.gradle"
id "io.gitlab.arturbosch.detekt"
id "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
id "com.google.gms.google-services"
id 'dagger.hilt.android.plugin'
}

repositories {
Expand Down Expand Up @@ -53,14 +53,6 @@ repositories {
maven { url "https://www.jitpack.io" }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'se.bjurr.violations.violation-comments-to-github-gradle-plugin'
apply plugin: 'kotlin-allopen'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'

detekt {
baseline = file("${project.rootDir}/config/detekt/baseline.xml")
}
Expand Down Expand Up @@ -327,7 +319,7 @@ dependencies {
implementation "$gradle.ext.storiesAndroidMp4ComposePath:$storiesVersion"
testImplementation "$gradle.ext.storiesAndroidPhotoEditorPath:$storiesVersion"
implementation project(path:':libs:image-editor::ImageEditor')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$gradle.ext.kotlinVersion"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As "dependency on the standard library (stdlib) is added automatically to each source set" we shouldn't need this or any other stdlib as direct dependency. WDYT about removing this and rest of them in other projects?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a change I've been wanting to make for a while now, but I strongly prefer making these changes in a standalone PRs especially in WPAndroid where there are quite a few modules. That's unless that change becomes a requirement for this PR.


// Provided by maven central
implementation 'com.google.code.gson:gson:2.6.2'
Expand Down Expand Up @@ -446,12 +438,12 @@ dependencies {

// Dagger and Hilt
compileOnly 'org.glassfish:javax.annotation:10.0-b28'
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
implementation "com.google.dagger:hilt-android:$daggerVersion"
kapt "com.google.dagger:hilt-compiler:$daggerVersion"
androidTestImplementation "com.google.dagger:hilt-android-testing:$daggerVersion"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$gradle.ext.daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$gradle.ext.daggerVersion"
implementation "com.google.dagger:hilt-android:$gradle.ext.daggerVersion"
kapt "com.google.dagger:hilt-compiler:$gradle.ext.daggerVersion"
androidTestImplementation "com.google.dagger:hilt-android-testing:$gradle.ext.daggerVersion"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$gradle.ext.daggerVersion"

implementation("$gradle.ext.fluxCBinaryPath") {
version {
Expand Down Expand Up @@ -520,7 +512,7 @@ dependencies {
// Enables accessibility checks in Espresso
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.3.0-alpha05'

detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion"
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$gradle.ext.detektVersion"

// Enables Java 8+ API desugaring support
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$coreLibraryDesugaringVersion"
Expand Down Expand Up @@ -665,7 +657,3 @@ if (project.hasProperty("debugStoreFile")) {
}
}
}

// Keep this at the bottom (https://stackoverflow.com/a/37565535)
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.sentry.android.gradle'
42 changes: 10 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
plugins {
id "com.automattic.android.fetchstyle"
id "io.gitlab.arturbosch.detekt"
id "androidx.navigation.safeargs.kotlin" apply false
id "com.android.library" apply false
Comment on lines +4 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI: last week I had an attempt of fixing this by moving all Android-dependant plugins away from root project but eventually this idea failed because of how Kotlin Gradle Plugin works with Gradle API. Apparently, it seems to be not-fixable. See https://youtrack.jetbrains.com/issue/KT-31643 for details and my attempt: woocommerce/woocommerce-android#5523

Comment thread
oguzkocer marked this conversation as resolved.
Resolved
id 'com.google.gms.google-services' apply false
id "org.jetbrains.kotlin.plugin.parcelize" apply false
}

ext {
wordPressUtilsVersion = '2.5.0'
wordPressLoginVersion = '0.14.0'
Expand Down Expand Up @@ -41,40 +50,8 @@ ext {
nhaarmanMockitoVersion = "2.2.0"
}

buildscript {
ext.kotlinVersion = '1.6.10'
ext.navComponentVersion = '2.4.2'
ext.detektVersion = '1.15.0'
ext.daggerVersion = '2.41'

repositories {
maven {
url 'https://a8c-libs.s3.amazonaws.com/android'
content {
includeGroup "com.automattic.android"
}
}
maven { url "https://plugins.gradle.org/m2/" }
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
classpath 'com.automattic.android:fetchstyle:1.1'
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navComponentVersion"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion"
classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion"
}
}

apply plugin: 'com.automattic.android.fetchstyle'

allprojects {
apply plugin: 'checkstyle'
apply plugin: 'io.gitlab.arturbosch.detekt'

repositories {
google()
Expand Down Expand Up @@ -114,6 +91,7 @@ allprojects {
}

detekt {
toolVersion = gradle.ext.detektVersion
config = files("${project.rootDir}/config/detekt/detekt.yml")
autoCorrect = false
buildUponDefaultConfig = false
Expand Down
6 changes: 4 additions & 2 deletions libs/WordPressAnnotations/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
apply plugin: 'kotlin'
plugins {
id "org.jetbrains.kotlin.jvm"
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion"
}

sourceCompatibility = "7"
Expand Down
8 changes: 5 additions & 3 deletions libs/WordPressProcessors/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
plugins {
id "org.jetbrains.kotlin.jvm"
id "org.jetbrains.kotlin.kapt"
}

ext.kotlinPoetVersion = '1.6.0'
ext.autoServiceVersion = '1.0'

dependencies {
implementation project(':libs:WordPressAnnotations')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$gradle.ext.kotlinVersion"
implementation "com.google.auto.service:auto-service:$autoServiceVersion"
kapt "com.google.auto.service:auto-service:$autoServiceVersion"
implementation "com.squareup:kotlinpoet:$kotlinPoetVersion"
Expand Down
4 changes: 3 additions & 1 deletion libs/analytics/WordPressAnalytics/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
plugins {
id "com.android.library"
}

repositories {
maven {
Expand Down
16 changes: 8 additions & 8 deletions libs/editor/WordPressEditor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
buildscript {
ext.aztecVersion = 'v1.5.8'
plugins {
id "com.android.library"
id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.plugin.parcelize"
}

ext.aztecVersion = 'v1.5.8'

repositories {
maven {
url "https://a8c-libs.s3.amazonaws.com/android"
Expand Down Expand Up @@ -30,10 +34,6 @@ repositories {
maven { url "https://a8c-libs.s3.amazonaws.com/android/hermes-mirror" }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

android {
compileSdkVersion 29

Expand Down Expand Up @@ -71,7 +71,7 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.5'
implementation 'com.android.volley:volley:1.1.1'
implementation "org.wordpress:utils:$wordPressUtilsVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$gradle.ext.kotlinVersion"
api ("$gradle.ext.aztecAndroidAztecPath") {
Comment thread
ParaskP7 marked this conversation as resolved.
Resolved
exclude group: "com.android.volley"
exclude group: 'org.wordpress', module: 'utils'
Expand Down Expand Up @@ -101,7 +101,7 @@ dependencies {
implementation "$rootProject.gradle.ext.gutenbergMobileBinaryPath:$rootProject.ext.gutenbergMobileVersion"

// Required Aztec dependencies (they should be included but Jitpack seems to be stripping these out)
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.1.4"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion"
implementation "org.jsoup:jsoup:1.10.3"

implementation 'com.google.code.gson:gson:2.6.2'
Expand Down
22 changes: 0 additions & 22 deletions libs/editor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +0,0 @@
buildscript {
repositories {
google()
}
}

allprojects {
apply plugin: 'checkstyle'

if (tasks.findByPath('checkstyle') == null) {
tasks.create(name: 'checkstyle', type: Checkstyle) {
source 'src'

classpath = files()
}

checkstyle {
toolVersion = '8.3'
configFile file("${project.rootDir}/config/checkstyle.xml")
}
}
}
4 changes: 3 additions & 1 deletion libs/editor/example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
plugins {
id "com.android.application"
}

repositories {
maven {
Expand Down
18 changes: 10 additions & 8 deletions libs/image-editor/ImageEditor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs.kotlin'
plugins {
id "com.android.library"
id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.kapt"
id "org.jetbrains.kotlin.plugin.parcelize"
id "androidx.navigation.safeargs.kotlin"
}

android {
compileSdkVersion rootProject.compileSdkVersion
Expand Down Expand Up @@ -51,7 +53,7 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$gradle.ext.kotlinVersion"

// UI
implementation "androidx.appcompat:appcompat:$appCompatVersion"
Expand All @@ -62,8 +64,8 @@ dependencies {
implementation "com.google.android.material:material:$materialVersion"

// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$navComponentVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navComponentVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$gradle.ext.navComponentVersion"
implementation "androidx.navigation:navigation-ui-ktx:$gradle.ext.navComponentVersion"

// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
Expand Down
4 changes: 3 additions & 1 deletion libs/mocks/WordPressMocks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
plugins {
id "com.android.library"
}

android {
compileSdkVersion 29
Expand Down
4 changes: 3 additions & 1 deletion libs/networking/WordPressNetworking/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
plugins {
id "com.android.library"
}

android {
compileSdkVersion 29
Expand Down
47 changes: 47 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
pluginManagement {
gradle.ext.kotlinVersion = '1.6.10'
gradle.ext.agpVersion = '7.1.1'
gradle.ext.daggerVersion = "2.41"
gradle.ext.detektVersion = '1.15.0'
gradle.ext.navComponentVersion = '2.4.2'

plugins {
id "org.jetbrains.kotlin.android" version gradle.ext.kotlinVersion
id "org.jetbrains.kotlin.jvm" version gradle.ext.kotlinVersion
id "org.jetbrains.kotlin.kapt" version gradle.ext.kotlinVersion
id "org.jetbrains.kotlin.plugin.serialization" version gradle.ext.kotlinVersion
id "org.jetbrains.kotlin.plugin.parcelize" version gradle.ext.kotlinVersion
id "org.jetbrains.kotlin.plugin.allopen" version gradle.ext.kotlinVersion
id "com.android.application" version gradle.ext.agpVersion
id "com.android.library" version gradle.ext.agpVersion
id 'com.google.gms.google-services' version '4.3.8'
id "io.sentry.android.gradle" version "2.0.0"
id "io.gitlab.arturbosch.detekt" version gradle.ext.detektVersion
id "se.bjurr.violations.violation-comments-to-github-gradle-plugin" version "1.67"
id "com.automattic.android.fetchstyle" version "1.1"
id "androidx.navigation.safeargs.kotlin" version gradle.ext.navComponentVersion
}
repositories {
maven {
url 'https://a8c-libs.s3.amazonaws.com/android'
content {
includeGroup "com.automattic.android"
}
}
gradlePluginPortal()
google()
}
resolutionStrategy {
eachPlugin {
// TODO: Remove this when fetchstyle starts supporting Plugin Marker Artifacts
if (requested.id.id == "com.automattic.android.fetchstyle") {
useModule("com.automattic.android:fetchstyle:1.1")
}
// TODO: Remove this when 'dagger.hilt' starts supporting Plugin Marker Artifacts
if (requested.id.id == 'dagger.hilt.android.plugin') {
useModule("com.google.dagger:hilt-android-gradle-plugin:$gradle.ext.daggerVersion")
}
}
}
}

plugins {
id "com.gradle.enterprise" version "3.9"
id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.6.5'
Expand Down