1616 * along with this program. If not, see <http://www.gnu.org/licenses/>
1717 */
1818
19+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
20+
1921plugins {
2022 id " com.android.application"
2123 id " kotlin-android"
@@ -98,7 +100,6 @@ android {
98100 applicationIdSuffix = " .BETA"
99101 versionNameSuffix = " -BETA"
100102 minifyEnabled = false
101- shrinkResources = false
102103 debuggable = true
103104 enableUnitTestCoverage = true
104105 }
@@ -107,23 +108,27 @@ android {
107108 testOptions {
108109 unitTests {
109110 includeAndroidResources = true
110- all {
111- jvmArgs(" -XX:+EnableDynamicAgentLoading" )
112- testLogging {
113- events = [" passed" , " skipped" , " failed" , " standardOut" , " standardError" ]
114- outputs. upToDateWhen { false }
115- showStandardStreams = true
116- }
117- }
111+ }
112+ }
113+
114+ tasks. withType(Test ). configureEach {
115+ jvmArgs(" -XX:+EnableDynamicAgentLoading" )
116+ testLogging {
117+ events = [" passed" , " skipped" , " failed" , " standardOut" , " standardError" ]
118+ outputs. upToDateWhen { false }
119+ showStandardStreams = true
118120 }
119121 }
120122
121123 compileOptions {
122124 sourceCompatibility = JavaVersion . VERSION_17
123125 targetCompatibility = JavaVersion . VERSION_17
124126 }
125- kotlinOptions {
126- jvmTarget = " 17"
127+
128+ kotlin {
129+ compilerOptions {
130+ jvmTarget = JvmTarget . JVM_17
131+ }
127132 }
128133
129134 lint {
@@ -213,9 +218,9 @@ def isReleaseTask() {
213218static Properties readProperties (propertiesFile ) {
214219 if (propertiesFile. canRead()) {
215220 Properties properties = new Properties ()
216- def inputStream = new FileInputStream (propertiesFile)
217- properties. load(inputStream)
218- inputStream . close()
221+ propertiesFile . withInputStream { inputStream ->
222+ properties. load(inputStream)
223+ }
219224 return properties
220225 } else {
221226 def message = " >>> Could not read " + propertiesFile. name + " file!"
@@ -225,12 +230,12 @@ static Properties readProperties(propertiesFile) {
225230}
226231
227232def static writeProperties (propertiesFile , properties ) {
228- def writer = propertiesFile . newWriter()
229- properties. store(writer, " Build Properties" )
230- writer . close()
233+ propertiesFile . withWriter { writer ->
234+ properties. store(writer, " Build Properties" )
235+ }
231236}
232237
233- configurations. all {
238+ configurations. configureEach {
234239 exclude group : ' org.hamcrest' , module : ' hamcrest-core'
235240 exclude group : ' org.hamcrest' , module : ' hamcrest-library'
236241}
0 commit comments