Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Replace wildcard imports with explicit imports #5018

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7568c9a
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
1b2f258
Removed duplicating blank lines in the end of the file
soleil-colza Jun 24, 2024
ad904cb
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
afe15d3
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
d9dcbfa
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
2ff24ba
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
68ea940
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
f4172f0
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
225d52d
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
eb1d230
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
28ceb97
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
bc56a48
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
87d9155
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
e430858
Removed a duplicating blank line in the end of the file
soleil-colza Jun 24, 2024
998c6b9
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 24, 2024
31e8a8f
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 25, 2024
cfd5bc8
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
9835053
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
0a88a0b
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
646bdd6
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
9aea5e3
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
2f0e3f9
Replaced wildcard imports with the proper paths without abbreviations
soleil-colza Jun 27, 2024
79cd76b
Replaced wildcard imports with explicit imports
soleil-colza Jun 27, 2024
48cdfae
Replaced wildcard imports with explicit imports
soleil-colza Jun 27, 2024
544684b
Replaced wildcard imports with explicit imports
soleil-colza Jun 27, 2024
01fa995
Replaced wildcard imports with explicit imports
soleil-colza Jun 27, 2024
3759a48
Replaced wildcard imports with explicit imports
soleil-colza Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions benchmarks/desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.compose.compose
import kotlinx.benchmark.gradle.*
import org.jetbrains.kotlin.allopen.gradle.*
import kotlinx.benchmark.gradle.BenchmarkExtension
import kotlinx.benchmark.gradle.JvmBenchmarkTarget
import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension

plugins {
kotlin("jvm") version "1.4.20"
Expand Down
18 changes: 16 additions & 2 deletions benchmarks/kn-performance/src/macosMain/kotlin/main.macos.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.objcPtr
import org.jetbrains.skia.*
import platform.Metal.*
import org.jetbrains.skia.BackendRenderTarget
import org.jetbrains.skia.ColorSpace
import org.jetbrains.skia.DirectContext
import org.jetbrains.skia.GraphicsContext
import org.jetbrains.skia.PixelGeometry
import org.jetbrains.skia.Surface
import org.jetbrains.skia.SurfaceColorFormat
import org.jetbrains.skia.SurfaceOrigin
import org.jetbrains.skia.SurfaceProps
import platform.Metal.MTLCreateSystemDefaultDevice
import platform.Metal.MTLPixelFormatBGRA8Unorm
import platform.Metal.MTLTextureDescriptor
import platform.Metal.MTLTextureType2D
import platform.Metal.MTLTextureUsageRenderTarget
import platform.Metal.MTLTextureUsageShaderRead
import platform.Metal.MTLTextureUsageShaderWrite
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package org.jetbrains.compose.resources
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.*
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight

@Composable
actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.jetbrains.compose.resources

import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.InternalResourceApi
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberResourceState

/**
* Represents a string resource in the application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ package org.jetbrains.compose.resources

import androidx.compose.foundation.Image
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.InternalResourceApi
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.runComposeUiTest
import kotlinx.coroutines.test.runTest
import kotlin.test.*
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue

@OptIn(ExperimentalTestApi::class, InternalResourceApi::class)
class ComposeResourceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.jetbrains.compose.resources
import org.jetbrains.skiko.SystemTheme
import org.jetbrains.skiko.currentSystemTheme
import java.awt.Toolkit
import java.util.*
import java.util.Locale

internal actual fun getSystemEnvironment(): ResourceEnvironment {
val locale = Locale.getDefault()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.jetbrains.compose.resources

import org.jetbrains.compose.resources.vector.xmldom.*
import org.jetbrains.compose.resources.vector.xmldom.Element
import org.jetbrains.compose.resources.vector.xmldom.ElementImpl
import org.jetbrains.compose.resources.vector.xmldom.MalformedXMLException
import org.w3c.dom.parsing.DOMParser

internal actual fun ByteArray.toXmlElement(): Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,3 @@ private class DomXmlParser : NSObject(), NSXMLParserDelegateProtocol {
throw MalformedXMLException("parse error occurred")
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,30 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsHoveredAsState
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Icon
import androidx.compose.material.LocalContentColor
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material.icons.filled.Build
import androidx.compose.material.icons.filled.BrokenImage
import androidx.compose.material.icons.filled.Code
import androidx.compose.material.icons.filled.Description
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowRight
import androidx.compose.material.icons.filled.Launch
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.TextSnippet
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -17,7 +21,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import graphics_2d.shared.generated.resources.*
import graphics_2d.shared.generated.resources.Res
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.painterResource

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
package visualeffects

import androidx.compose.animation.core.*
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -20,8 +32,9 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import graphics_2d.shared.generated.resources.*
import graphics_2d.shared.generated.resources.Res
import org.jetbrains.compose.resources.painterResource
import kotlin.random.Random.Default.nextFloat as random

@Composable
fun Words() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,24 @@ package com.sample.content
import androidx.compose.runtime.Composable
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.value
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.dom.A
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.H2
import org.jetbrains.compose.web.dom.Img
import org.jetbrains.compose.web.dom.Li
import org.jetbrains.compose.web.dom.P
import org.jetbrains.compose.web.dom.Text
import org.jetbrains.compose.web.dom.Ul
import com.sample.components.Card
import com.sample.components.ContainerInSection
import com.sample.components.LinkOnCard
import com.sample.style.*
import com.sample.style.WtButtonThemeLight
import com.sample.style.WtButtons
import com.sample.style.WtCols
import com.sample.style.WtOffsets
import com.sample.style.WtRows
import com.sample.style.WtSections
import com.sample.style.WtTexts
import org.jetbrains.compose.web.attributes.ATarget
import org.jetbrains.compose.web.attributes.target
import org.jetbrains.compose.web.css.paddingTop
Expand Down
15 changes: 12 additions & 3 deletions examples/imageviewer/webApp/src/jsWasmMain/kotlin/Common.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import example.imageviewer.*
import example.imageviewer.style.ImageViewerTheme
import example.imageviewer.Dependencies
import example.imageviewer.ImageViewerCommon
import example.imageviewer.ImageStorage
import example.imageviewer.WebImageStorage
import example.imageviewer.WebSharePicture
import example.imageviewer.ioDispatcher
import example.imageviewer.style.ImageViewerTheme
import example.imageviewer.view.Toast
import example.imageviewer.view.ToastState
import example.imageviewer.view.WebPopupNotification
import kotlinx.coroutines.CoroutineScope

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -8,6 +13,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.UIKitView
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ComposeUIViewController
import androidx.compose.ui.window.WindowInsets
import androidx.compose.ui.window.systemBars
import kotlinx.cinterop.ExperimentalForeignApi
import platform.MapKit.MKMapView
import platform.UIKit.UIViewController
Expand Down
36 changes: 31 additions & 5 deletions experimental/lwjgl-integration/src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
import androidx.compose.ui.ComposeScene
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import org.jetbrains.skia.*
import org.jetbrains.skia.FramebufferFormat.Companion.GR_GL_RGBA8
import org.jetbrains.skia.BackendRenderTarget
import org.jetbrains.skia.Color
import org.jetbrains.skia.ColorSpace
import org.jetbrains.skia.DirectContext
import org.jetbrains.skia.FramebufferFormat
import org.jetbrains.skia.Surface
import org.jetbrains.skia.SurfaceColorFormat
import org.jetbrains.skia.SurfaceOrigin
import org.jetbrains.skiko.FrameDispatcher
import org.lwjgl.glfw.GLFW.*
import org.jetbrains.skiko.GlfwCoroutineDispatcher
import org.lwjgl.glfw.GLFW.GLFW_FALSE
import org.lwjgl.glfw.GLFW.GLFW_RESIZABLE
import org.lwjgl.glfw.GLFW.GLFW_TRUE
import org.lwjgl.glfw.GLFW.GLFW_VISIBLE
import org.lwjgl.glfw.GLFW.glfwCreateWindow
import org.lwjgl.glfw.GLFW.glfwDestroyWindow
import org.lwjgl.glfw.GLFW.glfwGetWindowSize
import org.lwjgl.glfw.GLFW.glfwInit
import org.lwjgl.glfw.GLFW.glfwMakeContextCurrent
import org.lwjgl.glfw.GLFW.glfwPollEvents
import org.lwjgl.glfw.GLFW.glfwSetKeyCallback
import org.lwjgl.glfw.GLFW.glfwSetWindowCloseCallback
import org.lwjgl.glfw.GLFW.glfwSetWindowSizeCallback
import org.lwjgl.glfw.GLFW.glfwShowWindow
import org.lwjgl.glfw.GLFW.glfwSwapBuffers
import org.lwjgl.glfw.GLFW.glfwSwapInterval
import org.lwjgl.glfw.GLFW.glfwTerminate
import org.lwjgl.glfw.GLFW.glfwWaitEvents
import org.lwjgl.glfw.GLFW.glfwWindowHint
import org.lwjgl.glfw.GLFW.glfwWindowShouldClose
import org.lwjgl.opengl.GL
import org.lwjgl.opengl.GL11
import org.lwjgl.opengl.GL30.GL_FRAMEBUFFER_BINDING
import org.lwjgl.system.MemoryUtil.NULL
import org.lwjgl.opengl.GL30
import org.lwjgl.system.MemoryUtil
import kotlin.system.exitProcess

fun main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ import org.jetbrains.compose.desktop.DesktopExtension
import org.jetbrains.compose.desktop.application.internal.configureDesktop
import org.jetbrains.compose.desktop.preview.internal.initializePreview
import org.jetbrains.compose.experimental.dsl.ExperimentalExtension
import org.jetbrains.compose.experimental.internal.*
import org.jetbrains.compose.internal.*
import org.jetbrains.compose.experimental.internal.ComposeCompilerCompatibility
import org.jetbrains.compose.experimental.internal.ExperimentalComposeLibrary
import org.jetbrains.compose.internal.ComposeBuildConfig
import org.jetbrains.compose.internal.Dependencies
import org.jetbrains.compose.internal.ComposeExtension
import org.jetbrains.compose.internal.configureComposeCompilerPlugin
import org.jetbrains.compose.internal.configureExperimentalTargetsFlagsCheck
import org.jetbrains.compose.internal.getKotlinPluginVersion
import org.jetbrains.compose.internal.mppExt
import org.jetbrains.compose.internal.mppExtOrNull
import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.resources.ResourcesExtension
import org.jetbrains.compose.resources.configureComposeResources
import org.jetbrains.compose.web.WebExtension
import org.jetbrains.compose.web.internal.configureWeb
import org.jetbrains.kotlin.com.github.gundy.semver4j.SemVer
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.plugin.*
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.KOTLIN_MPP_PLUGIN_ID
import org.jetbrains.kotlin.gradle.plugin.mppExt

internal val composeVersion get() = ComposeBuildConfig.composeVersion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import org.gradle.api.tasks.Internal
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import java.io.*
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.InputStream
import java.security.DigestInputStream
import java.security.MessageDigest
import java.util.zip.ZipEntry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Provider
import java.io.File
import java.util.*
import java.util.Properties

internal fun Provider<String>.toDir(project: Project): Provider<Directory> =
project.layout.dir(map { File(it) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.logging.Logger
import org.jetbrains.compose.ComposeBuildConfig
import java.util.*
import java.io.File
import java.util.Properties

internal inline fun Logger.info(fn: () -> String) {
if (isInfoEnabled) {
Expand Down
Loading