diff --git a/.editorconfig b/.editorconfig index 544fa9968f..395f8cfe9a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,9 +1,13 @@ root = true +# See conf/detekt.yml, values should be the same + [*] charset = utf-8 end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = true -max_line_length = 120 \ No newline at end of file +max_line_length = 120 + +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ diff --git a/build-logic-settings/dependency-plugin/src/main/kotlin/convention-dependencies.settings.gradle.kts b/build-logic-settings/dependency-plugin/src/main/kotlin/convention-dependencies.settings.gradle.kts index abac2ffee0..0eb99ad8c8 100644 --- a/build-logic-settings/dependency-plugin/src/main/kotlin/convention-dependencies.settings.gradle.kts +++ b/build-logic-settings/dependency-plugin/src/main/kotlin/convention-dependencies.settings.gradle.kts @@ -53,27 +53,6 @@ dependencyResolutionManagement { includeGroup("com.google.testing.platform") } } - /** - * This repo is used for kotlinx-html:0.7.2 (transitive dependency of current Detekt version) - * The new version of Detekt uses kotlinx-html:0.7.3, which is available in mavenCentral repo, - * so this block would become unnecessary. For more information about maven.pkg.jetbrains.space, see - * https://github.com/kotlin/kotlinx.html/wiki/Getting-started - * TODO: Remove this block after MBS-11267 - */ - exclusiveContent { - forRepository { - maven { - setUrlOrProxy( - artifactoryUrl = artifactoryUrl, - repositoryName = "jetbrains-kotlinx-html", - originalRepo = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven" - ) - } - } - filter { - includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm") - } - } exclusiveContent { forRepository { maven { diff --git a/build-logic/android/build.gradle.kts b/build-logic/android/build.gradle.kts index 340a215991..014d2c20c4 100644 --- a/build-logic/android/build.gradle.kts +++ b/build-logic/android/build.gradle.kts @@ -6,8 +6,8 @@ group = "com.avito.android.buildlogic" dependencies { implementation("com.avito.android.buildlogic:kotlin") - implementation(libs.kotlinPlugin) - implementation(libs.androidGradlePlugin) + implementation(libs.kotlinGradle) + implementation(libs.androidGradle) // workaround for https://github.com/gradle/gradle/issues/15383 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) } diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index c6e736c936..0c4bb13b06 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -1,11 +1,13 @@ +import io.gitlab.arturbosch.detekt.Detekt + plugins { base - // accessing version catalog here will be supported in grale 7.2 - // https://github.com/gradle/gradle/pull/17394 - id("io.gitlab.arturbosch.detekt") version "1.16.0" + // accessing version catalog here is blocked by IDE false-postive error + // https://youtrack.jetbrains.com/issue/KTIJ-19369 + id("io.gitlab.arturbosch.detekt") version "1.18.0" } -val detektAll = tasks.register("detektAll") { +val detektAll = tasks.register("detektAll") { description = "Runs over whole code base without the starting overhead for each module." parallel = true setSource(files(projectDir)) diff --git a/build-logic/checks/build.gradle.kts b/build-logic/checks/build.gradle.kts index 72246d5904..a3df7ade18 100644 --- a/build-logic/checks/build.gradle.kts +++ b/build-logic/checks/build.gradle.kts @@ -5,8 +5,8 @@ plugins { group = "com.avito.android.buildlogic" dependencies { - implementation(libs.gradleVersionsPlugin) - implementation(libs.detektPlugin) + implementation(libs.versionsGradle) + implementation(libs.detektGradle) // workaround for https://github.com/gradle/gradle/issues/15383 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) } diff --git a/build-logic/kotlin/build.gradle.kts b/build-logic/kotlin/build.gradle.kts index da53b46661..98451a2d33 100644 --- a/build-logic/kotlin/build.gradle.kts +++ b/build-logic/kotlin/build.gradle.kts @@ -6,6 +6,6 @@ group = "com.avito.android.buildlogic" dependencies { implementation("com.avito.android.buildlogic:testing") - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) implementation(libs.nebulaIntegTest) } diff --git a/build-logic/publication/build.gradle.kts b/build-logic/publication/build.gradle.kts index f7e6bf4e7a..d378b48382 100644 --- a/build-logic/publication/build.gradle.kts +++ b/build-logic/publication/build.gradle.kts @@ -5,7 +5,7 @@ plugins { group = "com.avito.android.buildlogic" dependencies { - implementation(libs.androidGradlePlugin) + implementation(libs.androidGradle) implementation(libs.okhttp) implementation(libs.kotson) } diff --git a/build-logic/testing/build.gradle.kts b/build-logic/testing/build.gradle.kts index adf3b35201..50105f5a50 100644 --- a/build-logic/testing/build.gradle.kts +++ b/build-logic/testing/build.gradle.kts @@ -5,9 +5,9 @@ plugins { group = "com.avito.android.buildlogic" dependencies { - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) implementation(libs.nebulaIntegTest) - implementation(libs.gradleTestRetryPlugin) + implementation(libs.testRetryGradle) // workaround for https://github.com/gradle/gradle/issues/15383 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) } diff --git a/build.gradle.kts b/build.gradle.kts index 8d0414a04e..8cf37b9b8e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ val samplesWrapper by tasks.registering(Copy::class) { tasks.withType { // sources unavailable with BIN until https://youtrack.jetbrains.com/issue/IDEA-231667 resolved distributionType = Wrapper.DistributionType.ALL - gradleVersion = "7.1" + gradleVersion = "7.2-rc-3" finalizedBy(subprojectsWrapper, samplesWrapper) } diff --git a/conf/detekt.yml b/conf/detekt.yml index e96be7d355..f72ca25a23 100644 --- a/conf/detekt.yml +++ b/conf/detekt.yml @@ -262,8 +262,9 @@ formatting: active: false AnnotationSpacing: active: true + # todo fix and enable ArgumentListWrapping: - active: true + active: false # questionable rule; && and || goes to the end of line, instead of beginning a new line as we do right now ChainWrapping: active: false @@ -281,7 +282,7 @@ formatting: insertFinalNewLine: false ImportOrdering: active: true - layout: 'idea' + layout: '*,java.**,javax.**,kotlin.**,^' # blocked by bugs: https://github.com/pinterest/ktlint/issues?q=is%3Aissue+is%3Aopen+Indentation Indentation: active: false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9bbeefb74b..59e4672fba 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ androidX = "1.0.0" espresso = "3.4.0" coroutines = "1.3.8" androidXTest = "1.4.0" -detekt = "1.16.0" +detekt = "1.18.0" buildTools = "30.0.3" compileSdk = "30" targetSdk = "29" @@ -15,7 +15,7 @@ junit5 = "5.7.2" junit5Platform = "1.7.2" [libraries] -kotlinPlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinGradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlinTestJUnit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } kotlinXCli = "org.jetbrains.kotlinx:kotlinx-cli:0.2.1" kotlinStdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } @@ -43,7 +43,7 @@ retrofitConverterScalars = { module = "com.squareup.retrofit2:converter-scalars" gson = "com.google.code.gson:gson:2.8.5" kotson = "com.github.salomonbrys.kotson:kotson:2.5.0" -androidGradlePlugin = "com.android.tools.build:gradle:4.2.2" +androidGradle = "com.android.tools.build:gradle:4.2.2" appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidX" } material = { module = "com.google.android.material:material", version.ref = "androidX" } recyclerView = "androidx.recyclerview:recyclerview:1.1.0" @@ -82,8 +82,8 @@ okhttpMock = "com.github.gmazzo:okhttp-mock:1.4.0" kotlinTest = "io.kotlintest:kotlintest:2.0.7" coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } nebulaIntegTest = "com.netflix.nebula:nebula-project-plugin:8.0.0" -gradleTestRetryPlugin = "org.gradle:test-retry-gradle-plugin:1.3.1" -gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.39.0" +testRetryGradle = "org.gradle:test-retry-gradle-plugin:1.3.1" +versionsGradle = "com.github.ben-manes:gradle-versions-plugin:0.39.0" junitJupiterApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" } junitJupiterEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" } junitPlatformRunner = { module = "org.junit.platform:junit-platform-runner", version.ref = "junit5Platform" } @@ -98,5 +98,5 @@ googlePublish = "com.google.apis:google-api-services-androidpublisher:v3-rev86-1 googleAuthLibrary = "com.google.auth:google-auth-library-oauth2-http:0.10.0" jdgraphtCore = "org.jgrapht:jgrapht-core:1.5.1" -detektPlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } +detektGradle = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } detektFormatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1acc777d74..ad2de7bbba 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 744e882ed5..1b6c787337 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/build.gradle.kts b/samples/build.gradle.kts index ca542bc4d4..8d2498a244 100644 --- a/samples/build.gradle.kts +++ b/samples/build.gradle.kts @@ -6,19 +6,10 @@ buildscript { /** * workaround to load plugin classes once: - * ttps://youtrack.jetbrains.com/issue/KT-31643#focus=Comments-27-3510019.0-0 + * https://youtrack.jetbrains.com/issue/KT-31643#focus=Comments-27-3510019.0-0 */ - @Suppress("UnstableApiUsage") dependencies { - - /** - * workaround till https://github.com/gradle/gradle/issues/16958 is resolved - * most likely gradle 7.2 - */ - val libs = project.extensions.getByType() - .named("libs") as org.gradle.accessors.dm.LibrariesForLibs - - classpath(libs.androidGradlePlugin) - classpath(libs.kotlinPlugin) + classpath(libs.kotlinGradle) + classpath(libs.androidGradle) } } diff --git a/samples/gradle/wrapper/gradle-wrapper.properties b/samples/gradle/wrapper/gradle-wrapper.properties index 1acc777d74..ad2de7bbba 100644 --- a/samples/gradle/wrapper/gradle-wrapper.properties +++ b/samples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/subprojects/android-test/ui-testing-core-app/src/androidTest/kotlin/com/avito/android/ui/test/retry/RetryScreen.kt b/subprojects/android-test/ui-testing-core-app/src/androidTest/kotlin/com/avito/android/ui/test/retry/RetryScreen.kt index 1bf03d98e1..b47568bce0 100644 --- a/subprojects/android-test/ui-testing-core-app/src/androidTest/kotlin/com/avito/android/ui/test/retry/RetryScreen.kt +++ b/subprojects/android-test/ui-testing-core-app/src/androidTest/kotlin/com/avito/android/ui/test/retry/RetryScreen.kt @@ -30,6 +30,9 @@ class FailViewElement( private lateinit var exception: Throwable + override val actions: Actions + get() = FailActions(interactionContext, super.actions, exception) + fun firstFail(exception: Throwable): ViewElement { this.exception = exception return this @@ -65,7 +68,4 @@ class FailViewElement( ) } } - - override val actions: Actions - get() = FailActions(interactionContext, super.actions, exception) } diff --git a/subprojects/build.gradle.kts b/subprojects/build.gradle.kts index af7d33bc77..ccc215407b 100644 --- a/subprojects/build.gradle.kts +++ b/subprojects/build.gradle.kts @@ -1,4 +1,6 @@ plugins { + // accessing version catalog here is blocked by IDE false-postive error + // https://youtrack.jetbrains.com/issue/KTIJ-19369 id("com.autonomousapps.dependency-analysis") version "0.74.0" id("convention.dependency-updates") id("convention.detekt") @@ -8,20 +10,11 @@ buildscript { /** * workaround to load plugin classes once: - * ttps://youtrack.jetbrains.com/issue/KT-31643#focus=Comments-27-3510019.0-0 + * https://youtrack.jetbrains.com/issue/KT-31643#focus=Comments-27-3510019.0-0 */ - @Suppress("UnstableApiUsage") dependencies { - - /** - * workaround till https://github.com/gradle/gradle/issues/16958 is resolved - * most likely gradle 7.2 - */ - val libs = project.extensions.getByType() - .named("libs") as org.gradle.accessors.dm.LibrariesForLibs - - classpath(libs.androidGradlePlugin) - classpath(libs.kotlinPlugin) + classpath(libs.androidGradle) + classpath(libs.kotlinGradle) /** * com.autonomousapps.dependency-analysis depends on older version of okio, and it's resolved for diff --git a/subprojects/gradle/android/build.gradle.kts b/subprojects/gradle/android/build.gradle.kts index 208e7e74f6..6b7f740b32 100644 --- a/subprojects/gradle/android/build.gradle.kts +++ b/subprojects/gradle/android/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - api(libs.androidGradlePlugin) { + api(libs.androidGradle) { excludeTransitiveAgpDependencies() } diff --git a/subprojects/gradle/build-checks/build.gradle.kts b/subprojects/gradle/build-checks/build.gradle.kts index 7bfd9964c6..0983c885f2 100644 --- a/subprojects/gradle/build-checks/build.gradle.kts +++ b/subprojects/gradle/build-checks/build.gradle.kts @@ -16,7 +16,7 @@ dependencies { implementation(projects.common.result) implementation(projects.gradle.statsdConfig) implementation(projects.gradle.gradleExtensions) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) // for test implementation(projects.gradle.moduleTypes) diff --git a/subprojects/gradle/build-metrics/build.gradle.kts b/subprojects/gradle/build-metrics/build.gradle.kts index 81abae46ee..76fb60494e 100644 --- a/subprojects/gradle/build-metrics/build.gradle.kts +++ b/subprojects/gradle/build-metrics/build.gradle.kts @@ -16,7 +16,7 @@ dependencies { implementation(projects.gradle.gradleExtensions) implementation(projects.gradle.statsdConfig) implementation(projects.gradle.teamcity) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) testImplementation(libs.mockitoKotlin) testImplementation(libs.mockitoJUnitJupiter) diff --git a/subprojects/gradle/build-metrics/src/gradleTest/kotlin/com/avito/android/plugin/build_metrics/cache/HttpBuildCacheMetricsTest.kt b/subprojects/gradle/build-metrics/src/gradleTest/kotlin/com/avito/android/plugin/build_metrics/cache/HttpBuildCacheMetricsTest.kt index d937a3f311..86035cf4dd 100644 --- a/subprojects/gradle/build-metrics/src/gradleTest/kotlin/com/avito/android/plugin/build_metrics/cache/HttpBuildCacheMetricsTest.kt +++ b/subprojects/gradle/build-metrics/src/gradleTest/kotlin/com/avito/android/plugin/build_metrics/cache/HttpBuildCacheMetricsTest.kt @@ -13,43 +13,6 @@ import java.io.File internal class HttpBuildCacheMetricsTest : HttpBuildCacheTestFixture() { - override fun setupProject(projectDir: File) { - File(projectDir, "build.gradle.kts").writeText( - """ - plugins { - id("com.avito.android.build-metrics") - } - - @CacheableTask - abstract class CustomTask @Inject constructor(objects: ObjectFactory) : DefaultTask() { - - @Input - var input: Long = 0 - - @OutputFile - val outputFile = objects.fileProperty() - - @TaskAction - fun createFile() { - outputFile.get().asFile.writeText("Output of CacheableTask: " + input) - } - } - - tasks.register("cacheMissTask", CustomTask::class.java) { - input = System.currentTimeMillis() - outputFile.set(file("build/cacheMissTask.txt")) - } - """.trimIndent() - ) - } - - private class TestCase( - val name: String, - val loadStatus: Int, - val storeStatus: Int, - val assertion: (result: TestResult) -> Unit - ) - private val cases = listOf( TestCase( name = "no errors - miss and successful store", @@ -93,6 +56,43 @@ internal class HttpBuildCacheMetricsTest : HttpBuildCacheTestFixture() { ), ) + override fun setupProject(projectDir: File) { + File(projectDir, "build.gradle.kts").writeText( + """ + plugins { + id("com.avito.android.build-metrics") + } + + @CacheableTask + abstract class CustomTask @Inject constructor(objects: ObjectFactory) : DefaultTask() { + + @Input + var input: Long = 0 + + @OutputFile + val outputFile = objects.fileProperty() + + @TaskAction + fun createFile() { + outputFile.get().asFile.writeText("Output of CacheableTask: " + input) + } + } + + tasks.register("cacheMissTask", CustomTask::class.java) { + input = System.currentTimeMillis() + outputFile.set(file("build/cacheMissTask.txt")) + } + """.trimIndent() + ) + } + + private class TestCase( + val name: String, + val loadStatus: Int, + val storeStatus: Int, + val assertion: (result: TestResult) -> Unit + ) + @TestFactory fun `remote cache errors`(): List { return cases.map { case -> diff --git a/subprojects/gradle/gradle-extensions/src/main/kotlin/org/gradle/kotlin/dsl/GroovyInteropability.kt b/subprojects/gradle/gradle-extensions/src/main/kotlin/org/gradle/kotlin/dsl/GroovyInteropability.kt index 521a0c03b0..23bebad2a4 100644 --- a/subprojects/gradle/gradle-extensions/src/main/kotlin/org/gradle/kotlin/dsl/GroovyInteropability.kt +++ b/subprojects/gradle/gradle-extensions/src/main/kotlin/org/gradle/kotlin/dsl/GroovyInteropability.kt @@ -14,7 +14,8 @@ import org.gradle.kotlin.dsl.support.uncheckedCast */ public fun noOwnerClosureOf(action: T.() -> Unit): Closure = object : Closure(null, null) { - @Suppress("unused") // to be called dynamically by Groovy + // to be called dynamically by Groovy + @Suppress("unused") fun doCall() = uncheckedCast(delegate).action() } diff --git a/subprojects/gradle/impact-shared/build.gradle.kts b/subprojects/gradle/impact-shared/build.gradle.kts index 1a19b8cb39..e154578f56 100644 --- a/subprojects/gradle/impact-shared/build.gradle.kts +++ b/subprojects/gradle/impact-shared/build.gradle.kts @@ -16,7 +16,7 @@ dependencies { implementation(projects.gradle.process) implementation(libs.antPattern) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) testImplementation(projects.common.truthExtensions) testImplementation(projects.gradle.gitTestFixtures) diff --git a/subprojects/gradle/impact/build.gradle.kts b/subprojects/gradle/impact/build.gradle.kts index a57e3ca234..04bb17e759 100644 --- a/subprojects/gradle/impact/build.gradle.kts +++ b/subprojects/gradle/impact/build.gradle.kts @@ -20,7 +20,7 @@ dependencies { implementation(projects.gradle.statsdConfig) implementation(libs.antPattern) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) gradleTestImplementation(testFixtures(projects.gradle.buildEnvironment)) gradleTestImplementation(testFixtures(projects.gradle.impactShared)) diff --git a/subprojects/gradle/module-types/build.gradle.kts b/subprojects/gradle/module-types/build.gradle.kts index 1b0ce8934c..91a6f8d2ed 100644 --- a/subprojects/gradle/module-types/build.gradle.kts +++ b/subprojects/gradle/module-types/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { implementation(projects.gradle.preBuild) implementation(projects.gradle.gradleExtensions) implementation(projects.gradle.impact) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) gradleTestImplementation(projects.gradle.testProject) } diff --git a/subprojects/gradle/room-config/build.gradle.kts b/subprojects/gradle/room-config/build.gradle.kts index 0ae820330c..f223c7eaf1 100644 --- a/subprojects/gradle/room-config/build.gradle.kts +++ b/subprojects/gradle/room-config/build.gradle.kts @@ -7,7 +7,7 @@ plugins { dependencies { implementation(projects.gradle.android) implementation(projects.gradle.gradleExtensions) - implementation(libs.kotlinPlugin) + implementation(libs.kotlinGradle) testImplementation(projects.gradle.testProject) diff --git a/subprojects/gradle/wrapper/gradle-wrapper.properties b/subprojects/gradle/wrapper/gradle-wrapper.properties index 1acc777d74..ad2de7bbba 100644 --- a/subprojects/gradle/wrapper/gradle-wrapper.properties +++ b/subprojects/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/subprojects/test-runner/test-inhouse-runner/src/main/kotlin/com/avito/android/runner/InHouseInstrumentationTestRunner.kt b/subprojects/test-runner/test-inhouse-runner/src/main/kotlin/com/avito/android/runner/InHouseInstrumentationTestRunner.kt index 35e476e894..11d9455e86 100644 --- a/subprojects/test-runner/test-inhouse-runner/src/main/kotlin/com/avito/android/runner/InHouseInstrumentationTestRunner.kt +++ b/subprojects/test-runner/test-inhouse-runner/src/main/kotlin/com/avito/android/runner/InHouseInstrumentationTestRunner.kt @@ -106,7 +106,8 @@ abstract class InHouseInstrumentationTestRunner : ) } - @Suppress("MemberVisibilityCanBePrivate") // Public for *TestApp to skip on orchestrator runs + // Public for *TestApp to skip on orchestrator runs + @Suppress("MemberVisibilityCanBePrivate") val testRunEnvironment: TestRunEnvironment by lazy { if (isRealRun(instrumentationArguments)) { createRunnerEnvironment(instrumentationArguments) @@ -115,7 +116,8 @@ abstract class InHouseInstrumentationTestRunner : } } - @Suppress("MemberVisibilityCanBePrivate") // Public for synth monitoring + // Public for synth monitoring + @Suppress("MemberVisibilityCanBePrivate") val screenshotCapturer: ScreenshotCapturer by lazy { ScreenshotCapturerFactory.create(testArtifactsProvider, activityProvider) } @@ -147,7 +149,8 @@ abstract class InHouseInstrumentationTestRunner : ) } - @Suppress("unused") // used in avito + // used in avito + @Suppress("unused") val reportViewerHttpInterceptor: ReportViewerHttpInterceptor by lazy { val runEnvironment = testRunEnvironment.asRunEnvironmentOrThrow() ReportViewerHttpInterceptor( @@ -156,7 +159,8 @@ abstract class InHouseInstrumentationTestRunner : ) } - @Suppress("unused") // used in avito + // used in avito + @Suppress("unused") val reportViewerWebsocketReporter: ReportViewerWebsocketReporter by lazy { ReportViewerWebsocketReporter(report) }