Skip to content

Commit

Permalink
PAINTROID-762 Update to Android 14
Browse files Browse the repository at this point in the history
  • Loading branch information
foenabua committed Feb 10, 2025
1 parent 87082dd commit 4140a31
Show file tree
Hide file tree
Showing 23 changed files with 210 additions and 145 deletions.
50 changes: 25 additions & 25 deletions Paintroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

apply plugin: 'com.android.library'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: "com.mxalbert.gradle.jacoco-android"
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'kotlin-android'
apply plugin: 'org.catrobat.gradle.androidemulators'
Expand Down Expand Up @@ -51,14 +51,14 @@ emulators {
}

jacoco {
toolVersion = "0.8.7"
toolVersion = "0.8.10"
}

jacocoAndroidUnitTestReport {
csv.enabled false
html.enabled true
xml.enabled true
destination project.getBuildDir().getPath() + "/reports/jacoco/jacocoTestDebugUnitTestReport"
csv.required = false
html.required = true
xml.required = true
destination = project.getBuildDir().getPath() + "/reports/jacoco/jacocoTestDebugUnitTestReport"
}

android {
Expand All @@ -68,8 +68,6 @@ android {
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
versionCode rootProject.ext.androidVersionCode
versionName rootProject.ext.androidVersionName
}

compileOptions {
Expand All @@ -85,33 +83,36 @@ android {
signedRelease {
}
debug {
testCoverageEnabled = project.hasProperty('enableCoverage')
// Multidex is required as espresso and mockito/bytebuddy are adding more functions
// than should be allowed by law.
// See https://github.com/mockito/mockito/issues/1112
multiDexEnabled true
enableUnitTestCoverage = 'project.hasProperty(\'enableCoverage\')'
enableAndroidTestCoverage = 'project.hasProperty(\'enableCoverage\')'
}
}

lintOptions {
// specific ignores should be defined via lint.xml file
lintConfig file('config/lint.xml')
ignore 'ClickableViewAccessibility', 'StaticFieldLeak', 'GradleDependency', 'OldTargetApi', 'LintBaseline'
textReport true
xmlReport true
htmlReport true
xmlOutput file("build/reports/lint-report.xml")
htmlOutput file("build/reports/lint-report.html")
}

testOptions {
unitTests.returnDefaultValues = true
animationsDisabled = true
}

packagingOptions {
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
resources {
excludes += ['META-INF/AL2.0', 'META-INF/LGPL2.1', "**/attach_hotspot_windows.dll"]
merges += ['META-INF/licenses/ASM']
}
}

namespace 'org.catrobat.paintroid'
lint {
htmlOutput file('build/reports/lint-report.html')
htmlReport true
ignore 'ClickableViewAccessibility', 'StaticFieldLeak', 'GradleDependency', 'OldTargetApi', 'LintBaseline'
lintConfig file('config/lint.xml')
textReport true
xmlOutput file('build/reports/lint-report.xml')
xmlReport true
}
}

Expand All @@ -135,16 +136,15 @@ dependencies {
implementation 'com.jraska:falcon:2.2.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.18.3'
testImplementation 'org.mockito:mockito-core:3.6.28'
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'

androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'org.mockito:mockito-android:2.18.3'
androidTestImplementation 'org.mockito:mockito-android:5.15.2'
androidTestImplementation 'tools.fastlane:screengrab:2.1.0'
androidTestImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0'
Expand Down
6 changes: 3 additions & 3 deletions Paintroid/gradle/code_quality_tasks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ task checkstyle(type: Checkstyle) {
ignoreFailures false

reports {
xml.enabled = true
xml.required = true
xml.destination file("build/reports/checkstyle.xml")
}
}
Expand All @@ -63,8 +63,8 @@ task pmd(type: Pmd) {
ignoreFailures false

reports {
xml.enabled = true
html.enabled = true
xml.required = true
html.required = true
xml.destination file("build/reports/pmd.xml")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ class FileFromOtherSourceIntegrationTest {
val fos = requireNonNull.let {
it?.let { it1 -> resolver?.openOutputStream(it1) }
}
Assert.assertTrue(bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos))
assert(fos != null)
fos?.let { bitmap.compress(Bitmap.CompressFormat.JPEG, 100, it) }
?.let { Assert.assertTrue(it) }
fos!!.close()
} catch (e: IOException) {
throw AssertionError("Picture file could not be created.", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,8 @@ class LayerIntegrationTest {
)
val imageUri = Uri.fromFile(imageFile)
launchActivityRule.activity.myContentResolver.openOutputStream(imageUri).use { fos ->
Assert.assertTrue(bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos))
fos?.let { bitmap.compress(Bitmap.CompressFormat.JPEG, 100, it) }
?.let { Assert.assertTrue(it) }
}
deletionFileList.add(imageFile)
return imageUri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class MainActivityIntentTest {
try {
val fos = Objects.requireNonNull(imageUri)
?.let { contentResolver?.openOutputStream(it) }
Assert.assertTrue(bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos))
fos?.let { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
?.let { Assert.assertTrue(it) }
assert(fos != null)
fos?.close()
} catch (e: IOException) {
Expand Down
Loading

0 comments on commit 4140a31

Please sign in to comment.