Skip to content

Commit 8b5385b

Browse files
authored
bump versions and build cleanup (android#11)
* bump versions and build cleanup * gradle version catalogs
1 parent e855cc6 commit 8b5385b

File tree

13 files changed

+105
-67
lines changed

13 files changed

+105
-67
lines changed

DiceRoller/.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

DiceRoller/.idea/gradle.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

DiceRoller/androidApp/build.gradle.kts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
* limitations under the License.
1515
*/
1616
plugins {
17-
id("com.android.application")
18-
kotlin("android")
17+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
18+
alias(libs.plugins.android.application)
19+
id("org.jetbrains.kotlin.android")
1920
}
2021

2122
android {
2223
compileSdk = 33
24+
namespace = "com.google.samples.apps.diceroller"
2325
defaultConfig {
2426
applicationId = "com.google.samples.apps.diceroller"
2527
minSdk = 26
@@ -36,19 +38,23 @@ android {
3638
targetCompatibility = JavaVersion.VERSION_1_8
3739
}
3840
composeOptions {
39-
kotlinCompilerExtensionVersion = "1.4.0"
41+
kotlinCompilerExtensionVersion = "1.4.4"
42+
}
43+
kotlinOptions {
44+
jvmTarget = "1.8"
4045
}
4146
}
4247

4348
dependencies {
4449
implementation(project(":shared"))
4550

46-
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")
47-
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.0-alpha05")
48-
implementation("androidx.activity:activity-compose:1.6.1")
51+
implementation(platform(libs.androidx.compose.bom))
52+
53+
implementation(libs.androidx.lifecycle.viewmodel.compose)
54+
implementation(libs.androidx.lifecycle.runtime.compose)
55+
implementation(libs.androidx.activity.compose)
56+
implementation(libs.androidx.compose.ui.tooling.preview)
57+
implementation(libs.androidx.compose.material)
4958

50-
implementation(platform("androidx.compose:compose-bom:2023.01.00"))
51-
debugImplementation("androidx.compose.ui:ui-tooling")
52-
implementation("androidx.compose.ui:ui-tooling-preview")
53-
implementation("androidx.compose.material:material")
59+
debugImplementation(libs.androidx.compose.ui.tooling)
5460
}

DiceRoller/androidApp/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.google.samples.apps.diceroller">
19-
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2018
<application
2119
android:label="@string/app_name"
2220
android:supportsRtl="true"

DiceRoller/androidApp/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<item quantity="other">Roll %1$d pieces of %2$d-sided diceitem>
2525
plurals>
2626
<string name="roll_button_text_unique_suffix">for unique valuesstring>
27-
<string name="roll_result">Result:\n%d (%s)string>
27+
<string name="roll_result">Result:\n%1$d (%2$s)string>
2828
<string name="roll_result_waiting">Waiting for a roll…string>
2929
<string name="roll_result_error">Failed to roll dice,\ncheck settings and try againstring>
3030

DiceRoller/build.gradle.kts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
buildscript {
17-
repositories {
18-
gradlePluginPortal()
19-
google()
20-
mavenCentral()
21-
}
22-
dependencies {
23-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
24-
classpath("com.android.tools.build:gradle:7.3.0")
25-
}
16+
plugins {
17+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
18+
alias(libs.plugins.android.application) apply false
19+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
20+
alias(libs.plugins.kotlin.multiplatform) apply false
2621
}
2722

28-
tasks.register("clean", Delete::class) {
23+
tasks.register<Delete>("clean") {
2924
delete(rootProject.buildDir)
3025
}

DiceRoller/gradle/libs.versions.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[versions]
2+
agp = "7.4.2"
3+
dataStoreVersion = "1.1.0-alpha03"
4+
kotlin = "1.8.10"
5+
nativecoroutines = "0.13.3"
6+
compose = "1.4.2"
7+
compileSdk = "33"
8+
minSdk = "24"
9+
androidx-core = "1.9.0"
10+
androidx-lifecycle = "2.6.1"
11+
activityCompose = "1.7.0"
12+
androidxComposeBom = "2023.03.00"
13+
14+
[plugins]
15+
android-application = { id = "com.android.application", version.ref = "agp" }
16+
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
17+
nativecoroutines = { id = "com.rickclephas.kmp.nativecoroutines", version.ref = "nativecoroutines" }
18+
19+
[libraries]
20+
androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
21+
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
22+
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
23+
24+
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
25+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" }
26+
androidx-datastore-core-okio = { group = "androidx.datastore", name = "datastore-core-okio", version.ref = "dataStoreVersion" }
27+
androidx-datastore-preferences-core = { group = "androidx.datastore", name = "datastore-preferences-core", version.ref = "dataStoreVersion" }
28+
androidx-lifecycle-runtime-kts = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle"}
29+
30+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
31+
androidx-compose-material = { group = "androidx.compose.material", name = "material" }
32+
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
33+
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
34+
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
1.75 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

DiceRoller/gradlew

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

DiceRoller/gradlew.bat

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

DiceRoller/shared/build.gradle.kts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
* limitations under the License.
1515
*/
1616
plugins {
17-
kotlin("multiplatform")
18-
kotlin("native.cocoapods")
17+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
18+
alias(libs.plugins.kotlin.multiplatform)
19+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
20+
alias(libs.plugins.nativecoroutines)
21+
id("org.jetbrains.kotlin.native.cocoapods")
1922
id("com.android.library")
20-
id("com.rickclephas.kmp.nativecoroutines") version "0.13.3"
2123
}
2224

2325
version = "1.0"
@@ -38,18 +40,24 @@ kotlin {
3840
}
3941
}
4042

41-
val dataStoreVersion = "1.1.0-alpha03"
43+
android {
44+
compilations.all {
45+
kotlinOptions {
46+
jvmTarget = "1.8"
47+
}
48+
}
49+
}
4250

4351
sourceSets {
4452
val commonMain by getting {
4553
dependencies {
46-
api("androidx.datastore:datastore-preferences-core:$dataStoreVersion")
47-
api("androidx.datastore:datastore-core-okio:$dataStoreVersion")
54+
api(libs.androidx.datastore.preferences.core)
55+
api(libs.androidx.datastore.core.okio)
4856
}
4957
}
5058
val commonTest by getting {
5159
dependencies {
52-
implementation(kotlin("test"))
60+
implementation(libs.kotlin.test)
5361
}
5462
}
5563
val androidMain by getting
@@ -73,16 +81,21 @@ kotlin {
7381
iosSimulatorArm64Test.dependsOn(this)
7482
}
7583
}
84+
7685
}
7786

7887
android {
7988
compileSdk = 33
89+
namespace = "com.google.samples.apps.diceroller.shared"
8090
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
8191
buildFeatures {
8292
buildConfig = false
8393
}
8494
defaultConfig {
8595
minSdk = 26
86-
targetSdk = 33
96+
}
97+
compileOptions {
98+
sourceCompatibility = JavaVersion.VERSION_1_8
99+
targetCompatibility = JavaVersion.VERSION_1_8
87100
}
88101
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
xml version="1.0" encoding="utf-8"?>
2-
<manifest package="com.google.samples.apps.diceroller" />
2+
<manifest />

0 commit comments

Comments
 (0)