Skip to content

Commit

Permalink
Update examples (JetBrains#1740)
Browse files Browse the repository at this point in the history
* Update examples to Gradle 7.3.3

Resolves JetBrains#1654

* Update compose and agp in examples

Resolves JetBrains#1117

* Fix gradle plugins classloading in examples and templates

* Make falling balls mpp compatible with examples checker
  • Loading branch information
AlexeyTsvetkov authored Jan 24, 2022
1 parent 6da56d5 commit d23806a
Show file tree
Hide file tree
Showing 63 changed files with 173 additions and 93 deletions.
6 changes: 3 additions & 3 deletions examples/codeviewer/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
implementation(project(":common"))
implementation("androidx.activity:activity-compose:1.3.1")
implementation("androidx.activity:activity-compose:1.4.0")
}
21 changes: 20 additions & 1 deletion examples/codeviewer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
allprojects {
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("jvm") apply false
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
}

subprojects {
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

plugins.withId("org.jetbrains.kotlin.multiplatform") {
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
}
10 changes: 4 additions & 6 deletions examples/codeviewer/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ kotlin {
named("androidMain") {
kotlin.srcDirs("src/jvmMain/kotlin")
dependencies {
api("androidx.appcompat:appcompat:1.3.0-beta01")
api("androidx.core:core-ktx:1.3.1")
api("androidx.appcompat:appcompat:1.4.1")
api("androidx.core:core-ktx:1.7.0")
}
}
named("desktopMain") {
Expand All @@ -41,13 +41,11 @@ android {
defaultConfig {
minSdkVersion(21)
targetSdkVersion(31)
versionCode = 1
versionName = "1.0"
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

sourceSets {
Expand Down
4 changes: 2 additions & 2 deletions examples/codeviewer/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.version=1.6.10
agp.version=4.2.2
compose.version=1.0.1-rc2
agp.version=7.0.4
compose.version=1.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions examples/codeviewer/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pluginManagement {
kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion)
kotlin("android").version(kotlinVersion)
id("com.android.base").version(agpVersion)
id("com.android.application").version(agpVersion)
id("com.android.library").version(agpVersion)
id("org.jetbrains.compose").version(composeVersion)
Expand Down
2 changes: 1 addition & 1 deletion examples/falling-balls/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id("org.jetbrains.compose")
}

group = "me.user"
group = "org.jetbrains.compose.demo.falling"
version = "1.0"

repositories {
Expand Down
2 changes: 1 addition & 1 deletion examples/falling-balls/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin.code.style=official
kotlin.version=1.6.10
compose.version=1.0.1-rc2
compose.version=1.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/imageviewer/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

Expand Down
13 changes: 12 additions & 1 deletion examples/imageviewer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
allprojects {
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("jvm") apply false
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
}

subprojects {
repositories {
google()
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions examples/imageviewer/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

sourceSets {
Expand Down
4 changes: 2 additions & 2 deletions examples/imageviewer/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.version=1.6.10
agp.version=4.2.2
compose.version=1.0.1-rc2
agp.version=7.0.4
compose.version=1.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/intellij-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.compose.compose

plugins {
id("org.jetbrains.intellij") version "1.1.4"
id("org.jetbrains.intellij") version "1.3.0"
java
kotlin("jvm")
id("org.jetbrains.compose")
Expand All @@ -24,7 +24,7 @@ dependencies {

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set("2021.2")
version.set("2021.3")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Expand Down
2 changes: 1 addition & 1 deletion examples/intellij-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin.code.style=official
kotlin.version=1.6.10
compose.version=1.0.1-rc2
compose.version=1.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/issues/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

Expand Down
14 changes: 12 additions & 2 deletions examples/issues/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
allprojects {
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("jvm") apply false
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
}

subprojects {
repositories {
mavenLocal()
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
Expand Down
4 changes: 2 additions & 2 deletions examples/issues/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
kotlin.version=1.6.10
agp.version=4.2.2
compose.version=1.0.1-rc2
agp.version=7.0.4
compose.version=1.0.1
2 changes: 1 addition & 1 deletion examples/issues/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion examples/notepad/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official
kotlin.version=1.6.10
compose.version=1.0.1-rc2
compose.version=1.0.1
2 changes: 1 addition & 1 deletion examples/notepad/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/todoapp-lite/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

Expand Down
13 changes: 12 additions & 1 deletion examples/todoapp-lite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
allprojects {
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("jvm") apply false
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
}

subprojects {
repositories {
google()
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions examples/todoapp-lite/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

sourceSets {
Expand Down
4 changes: 2 additions & 2 deletions examples/todoapp-lite/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.version=1.6.10
agp.version=4.2.2
compose.version=1.0.1-rc2
agp.version=7.0.4
compose.version=1.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/todoapp/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

packagingOptions {
Expand Down
3 changes: 2 additions & 1 deletion examples/todoapp/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name="example.todo.android.MainActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
2 changes: 1 addition & 1 deletion examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object Deps {
object Android {
object Tools {
object Build {
const val gradlePlugin = "com.android.tools.build:gradle:4.1.0"
const val gradlePlugin = "com.android.tools.build:gradle:7.0.4"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todoapp/buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# TODO can we get rid of duplication with root gradle.properties?
kotlin.version=1.6.10
compose.version=1.0.1-rc2
compose.version=1.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kotlin {

named("androidMain") {
dependencies {
implementation("androidx.appcompat:appcompat:1.3.0-beta01")
implementation("androidx.appcompat:appcompat:1.3.0")
implementation("androidx.core:core-ktx:1.3.1")
}
}
Expand All @@ -36,6 +36,6 @@ kotlin {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ kotlin {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
}
2 changes: 1 addition & 1 deletion examples/todoapp/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ org.gradle.caching=true
kotlin.native.disableCompilerDaemon=true

kotlin.version=1.6.10
compose.version=1.0.1-rc2
compose.version=1.0.1
2 changes: 1 addition & 1 deletion examples/todoapp/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit d23806a

Please sign in to comment.