Browse Source

Include java.logging module by default (#402)

It is probably frequently needed and relatively small
(the inclusion increases final app size by ~200 kb),
so it can be included by default

Fixes #401
pull/405/head
Alexey Tsvetkov 4 years ago committed by GitHub
parent
commit
c8a8a462aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt
  2. 8
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/DesktopApplicationTest.kt
  3. 1
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProjects.kt
  4. 24
      gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle
  5. 11
      gradle-plugins/compose/src/test/test-projects/application/javaLogger/settings.gradle
  6. 3
      gradle-plugins/compose/src/test/test-projects/application/javaLogger/src/main/kotlin/main.kt

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt

@ -21,7 +21,7 @@ open class NativeDistributions @Inject constructor(
set(layout.buildDirectory.dir("compose/binaries")) set(layout.buildDirectory.dir("compose/binaries"))
} }
var modules = arrayListOf("java.desktop") var modules = arrayListOf("java.desktop", "java.logging")
fun modules(vararg modules: String) { fun modules(vararg modules: String) {
this.modules.addAll(modules.toList()) this.modules.addAll(modules.toList())
} }

8
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/DesktopApplicationTest.kt

@ -113,4 +113,12 @@ class DesktopApplicationTest : GradlePluginTestBase() {
check.logContains("Called lib2#util()") check.logContains("Called lib2#util()")
} }
} }
@Test
fun testJavaLogger() = with(testProject(TestProjects.javaLogger)) {
gradle(":runDistributable").build().checks { check ->
check.taskOutcome(":runDistributable", TaskOutcome.SUCCESS)
check.logContains("Compose Gradle plugin test log warning!")
}
}
} }

1
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/TestProjects.kt

@ -5,4 +5,5 @@ object TestProjects {
const val mpp = "application/mpp" const val mpp = "application/mpp"
const val jvmKotlinDsl = "application/jvmKotlinDsl" const val jvmKotlinDsl = "application/jvmKotlinDsl"
const val moduleClashCli = "application/moduleClashCli" const val moduleClashCli = "application/moduleClashCli"
const val javaLogger = "application/javaLogger"
} }

24
gradle-plugins/compose/src/test/test-projects/application/javaLogger/build.gradle

@ -0,0 +1,24 @@
plugins {
id "org.jetbrains.kotlin.jvm"
id "org.jetbrains.compose"
}
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://maven.pkg.jetbrains.space/public/p/compose/dev"
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation compose.desktop.currentOs
}
compose.desktop {
application {
mainClass = "MainKt"
}
}

11
gradle-plugins/compose/src/test/test-projects/application/javaLogger/settings.gradle

@ -0,0 +1,11 @@
pluginManagement {
plugins {
id 'org.jetbrains.kotlin.jvm' version 'KOTLIN_VERSION_PLACEHOLDER'
id 'org.jetbrains.compose' version 'COMPOSE_VERSION_PLACEHOLDER'
}
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "javaLogger"

3
gradle-plugins/compose/src/test/test-projects/application/javaLogger/src/main/kotlin/main.kt

@ -0,0 +1,3 @@
fun main() {
java.util.logging.Logger.getAnonymousLogger().warning("Compose Gradle plugin test log warning!")
}
Loading…
Cancel
Save