Merge pull request #3954 from vector-im/dependabot/gradle/com.android.tools.build-gradle-7.0.2

Bump gradle from 4.2.2 to 7.0.2
This commit is contained in:
Benoit Marty 2021-09-03 12:11:52 +02:00 committed by GitHub
commit 377c4e00a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 90 additions and 84 deletions

View File

@ -6,6 +6,24 @@ on:
branches: [ main, develop ] branches: [ main, develop ]
jobs: jobs:
# Temporary add build of Android tests, which cannot be run on the CI right now, but they need to at least compile
# So it will be mandatory for this action to be successful on every PRs
compile-android-test:
name: Compile Android tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Compile Android tests
run: ./gradlew clean assembleAndroidTest --stacktrace -PallWarningsAsErrors=false
integration-tests: integration-tests:
name: Integration Tests (Synapse) name: Integration Tests (Synapse)
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ jobs:
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.36.0/ktlint && chmod a+x ktlint curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.36.0/ktlint && chmod a+x ktlint
./ktlint --android --experimental -v ./ktlint --android --experimental -v
# Lint for main module and all the other modules
android-lint: android-lint:
name: Android Linter name: Android Linter
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -37,14 +38,16 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Lint analysis of the SDK - name: Lint analysis
run: ./gradlew clean :matrix-sdk-android:lintRelease --stacktrace run: ./gradlew clean :vector:lint --stacktrace
- name: Upload reports - name: Upload reports
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: linting-report-android-sdk name: lint-report
path: matrix-sdk-android/build/reports/*.* path: |
vector/build/reports/*.*
# Lint for Gplay and Fdroid release APK
apk-lint: apk-lint:
name: Lint APK (${{ matrix.target }}) name: Lint APK (${{ matrix.target }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -69,6 +72,6 @@ jobs:
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: always() if: always()
with: with:
name: release-debug-linting-report-${{ matrix.target }} name: release-lint-report-${{ matrix.target }}
path: | path: |
vector/build/reports/*.* vector/build/reports/*.*

View File

@ -34,11 +34,11 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = "11"
} }
buildFeatures { buildFeatures {

View File

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:visibility="visible"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:importantForAccessibility="no"
android:visibility="visible" />
<ProgressBar <ProgressBar
android:layout_centerInParent="true"
android:id="@+id/imageLoaderProgress" android:id="@+id/imageLoaderProgress"
style="?android:attr/progressBarStyle" style="?android:attr/progressBarStyle"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_centerInParent="true"
android:visibility="visible" android:visibility="visible"
tools:visibility="gone" /> tools:visibility="gone" />

View File

@ -9,6 +9,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:importantForAccessibility="no"
android:scaleType="centerInside" /> android:scaleType="centerInside" />
<VideoView <VideoView
@ -22,6 +23,7 @@
android:layout_width="44dp" android:layout_width="44dp"
android:layout_height="44dp" android:layout_height="44dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:contentDescription="@string/a11y_play_pause"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TODO Create a dedicated module for translations to be able to translate this string like the others (See #3955) -->
<string name="a11y_play_pause">Play or pause the video</string>
</resources>

View File

@ -12,7 +12,9 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.2' // Release notes of Android Gradle Plugin (AGP):
// https://developer.android.com/studio/releases/gradle-plugin
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3' classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'

2
changelog.d/3954.feature Normal file
View File

@ -0,0 +1,2 @@
Upgrade AGP to 7.0.2.
When compiling using command line, make sure to use the JDK 11 by adding for instance `-Dorg.gradle.java.home=/Applications/Android\ Studio\ Preview.app/Contents/jre/Contents/Home` or by setting JAVA_HOME.

View File

@ -3,6 +3,3 @@ apply plugin: 'java-library'
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
} }
sourceCompatibility = "8"
targetCompatibility = "8"

View File

@ -39,13 +39,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = "11"
} }
buildFeatures { buildFeatures {
viewBinding true viewBinding true
} }

View File

@ -1,2 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="im.vector.lib.ui.styles"/> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.vector.lib.ui.styles">
<application android:supportsRtl="true" />
</manifest>

View File

@ -2,7 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
tools:ignore="UselessParent">
<!-- Inspired from https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/layout/progress_dialog.xml --> <!-- Inspired from https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/layout/progress_dialog.xml -->
<LinearLayout <LinearLayout

View File

@ -24,12 +24,12 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
} }

View File

@ -67,17 +67,13 @@ android {
installOptions "-g" installOptions "-g"
} }
lintOptions {
lintConfig file("lint.xml")
}
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
sourceSets { sourceSets {

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Modify some severity -->
<!-- Resource -->
<issue id="MissingTranslation" severity="warning" />
<issue id="TypographyEllipsis" severity="error" />
<issue id="ImpliedQuantity" severity="warning" />
<!-- UX -->
<issue id="ButtonOrder" severity="error" />
<!-- Layout -->
<issue id="UnknownIdInLayout" severity="error" />
<issue id="StringFormatCount" severity="error" />
<issue id="HardcodedText" severity="error" />
<issue id="SpUsage" severity="error" />
<issue id="ObsoleteLayoutParam" severity="error" />
<issue id="InefficientWeight" severity="error" />
<issue id="DisableBaselineAlignment" severity="error" />
<issue id="ScrollViewSize" severity="error" />
<!-- RTL -->
<issue id="RtlEnabled" severity="error" />
<issue id="RtlHardcoded" severity="error" />
<issue id="RtlSymmetry" severity="error" />
<!-- Code -->
<issue id="SetTextI18n" severity="error" />
<issue id="ViewConstructor" severity="error" />
<issue id="UseValueOf" severity="error" />
<issue id="ObsoleteSdkInt" severity="error" />
</lint>

View File

@ -0,0 +1,18 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.matrix.android.sdk">
<application>
<!--
This is mandatory to run integration tests
-->
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:exported="false"
tools:node="remove" />
</application>
</manifest>

View File

@ -10,15 +10,6 @@
<application android:networkSecurityConfig="@xml/network_security_config"> <application android:networkSecurityConfig="@xml/network_security_config">
<!--
This is mandatory to run integration tests
-->
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:exported="false"
tools:node="remove" />
<!-- <!--
The SDK offers a secured File provider to access downloaded files. The SDK offers a secured File provider to access downloaded files.
Access to these file will be given via the FileService, with a temporary Access to these file will be given via the FileService, with a temporary

View File

@ -284,16 +284,17 @@ android {
lintOptions { lintOptions {
lintConfig file("lint.xml") lintConfig file("lint.xml")
checkDependencies true
abortOnError true abortOnError true
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "11"
} }
sourceSets { sourceSets {

View File

@ -21,7 +21,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.media.AudioManager import android.media.AudioManager
import android.os.Build
import timber.log.Timber import timber.log.Timber
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
@ -69,11 +68,7 @@ class WiredHeadsetStateReceiver : BroadcastReceiver() {
fun createAndRegister(context: Context, listener: HeadsetEventListener): WiredHeadsetStateReceiver { fun createAndRegister(context: Context, listener: HeadsetEventListener): WiredHeadsetStateReceiver {
val receiver = WiredHeadsetStateReceiver() val receiver = WiredHeadsetStateReceiver()
receiver.delegate = WeakReference(listener) receiver.delegate = WeakReference(listener)
val action = if (Build.VERSION.SDK_INT >= 21) { val action = AudioManager.ACTION_HEADSET_PLUG
AudioManager.ACTION_HEADSET_PLUG
} else {
Intent.ACTION_HEADSET_PLUG
}
context.registerReceiver(receiver, IntentFilter(action)) context.registerReceiver(receiver, IntentFilter(action))
return receiver return receiver
} }