Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/scripts/changed-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ while IFS= read -r FILE; do
TESTING_SEEN_COMPOSE=true
fi
fi
if [[ "$FIRST" != "icons" && "$FIRST" != "testing" ]]; then
if [[ "$FIRST" != "icons" && "$FIRST" != "testing" && "$FIRST" != "gradle" ]]; then
MODULE=":sdds-core:$FIRST"
MODULES_SET+=("$MODULE")
echo "✅ Matched: $MODULE"
Expand Down
1 change: 1 addition & 0 deletions build-system/conventions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation("org.commonmark:commonmark:0.21.0")

implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(files(icons.javaClass.superclass.protectionDomain.codeSource.location))
testImplementation(libs.base.test.unit.jUnit)
testImplementation(libs.base.test.unit.mockk)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import utils.withVersionCatalogs
val extension = app() ?: lib() ?: throwApplyException()
extension.configureCompose()

fun app(): CommonExtension<*, *, *, *, *>? =
fun app(): CommonExtension<*, *, *, *, *, *>? =
extensions.findByType<ApplicationExtension>()

fun lib(): CommonExtension<*, *, *, *, *>? =
fun lib(): CommonExtension<*, *, *, *, *, *>? =
extensions.findByType<LibraryExtension>()

fun throwApplyException(): Nothing =
Expand All @@ -18,7 +18,7 @@ fun throwApplyException(): Nothing =
"The plugin can be applied for android application or android library."
)

fun CommonExtension<*, *, *, *, *>.configureCompose() = withVersionCatalogs {
fun CommonExtension<*, *, *, *, *, *>.configureCompose() = withVersionCatalogs {
buildFeatures.compose = true
composeOptions.kotlinCompilerExtensionVersion = versions.androidX.compose.compiler.get()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ subprojects {
@Suppress("LABEL_NAME_CLASH")
return@all
}
println("requested module ${moduleSelector.module}")
when (moduleSelector.module) {
"sdds-uikit-compose" -> useTarget(
"sdds-core:uikit-compose:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ val docsSnippets by configurations.creating {
}
}

afterEvaluate {
ksp {
arg("packageName", project.extensions.getByType(LibraryExtension::class.java).namespace.orEmpty())
}
}

dependencies {
"implementation"("sdds-core:docs")
"ksp"(":sdds-core:docs-ksp")
ksp("sdds-core:docs-ksp")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.TaskAction
import org.jetbrains.kotlin.com.google.gson.GsonBuilder
import org.jetbrains.kotlin.com.google.gson.JsonObject
Expand All @@ -28,7 +28,7 @@ abstract class BuildTokenChangelogTask : DefaultTask() {
@get:Input
abstract val libraryChangelogJsonPath: Property<String>

@get:OutputFile
@get:InputFile
abstract val outputChangelogMdFile: RegularFileProperty

@TaskAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package utils

import com.android.build.gradle.LibraryExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.accessors.dm.LibrariesForIcons
import java.io.File
import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType
Expand Down Expand Up @@ -42,6 +43,14 @@ fun Project.getVersionCatalog(): LibrariesForLibs? {
} else null
}

/**
* Возвращает делегат для доступа к каталогу версий
*/
fun Project.iconsCatalog(): LibrariesForIcons? =
if (name != "gradle-kotlin-dsl-accessors")
the<LibrariesForIcons>()
else null

/**
* Производит поиск свойства [propertyName] во всех файла gradle.properties,
* если не находит - возвращает [default]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ val Project.docsUikitComposeVersion: String
* Возвращает "latest", если версия не указана.
*/
val Project.docsIconsVersion: String
get() = getVersionCatalog()?.versions?.sdds?.icons?.get() ?: "latest"
get() = iconsCatalog()?.versions?.sdds?.icons?.get() ?: "latest"

/**
* Возвращает URL на API-документацию артефакта в зависимости от типа библиотеки (Compose или XML).
Expand Down
2 changes: 1 addition & 1 deletion build-system/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 22 10:32:29 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 3 additions & 4 deletions build-system/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
// Костыль. Версия иконок лежит в отдельном toml файле, чтобы избежать конфликтов из-за
// раздельных релизных процессов иконок и остальных библиотек
org.gradle.api.internal.catalog.parser.TomlCatalogFileParser
.parse(file("../gradle/icons.version.toml").toPath(), this)
}
create("icons") {
from(files("../gradle/icons.version.toml"))
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
global-gradle = "8.1.4"
global-gradle = "8.3.2"
global-jvmTarget = "1.8"
global-kotlin = "1.8.22"
global-compileSdk = "34"
global-targetSdk = "34"
global-kotlin = "1.9.25"
global-compileSdk = "35"
global-targetSdk = "35"
global-minSdk = "24"

staticAnalysis-detekt = "1.22.0"
Expand All @@ -14,9 +14,9 @@ staticAnalysis-spotless = "6.20.0"
android-material = "1.3.0"
androidX-core = "1.7.0"
androidX-appcompat = "1.3.1"
androidX-compose-compiler = "1.4.8"
androidX-compose-compiler = "1.5.15"
androidX-activity-compose = "1.3.1"
androidX-compose-bom = "2024.09.00"
androidX-compose-bom = "2025.05.00"
androidX-lifecycle-compose = "2.4.1"
androidX-navigation="2.7.2"
androidX-constraintLayout = "2.1.4"
Expand All @@ -34,7 +34,7 @@ test-androidX-runner = "1.5.2"
test-roborazzi = "1.44.0"

kotlinSerialization = "1.4.0"
kotlinKsp = "1.8.22-1.0.11"
kotlinKsp = "1.9.25-1.0.20"
kotlinPoet = "1.12.0"
glide = "4.16.0"

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 07 16:56:30 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion playground/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Mar 04 17:09:42 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 5 additions & 1 deletion playground/sandbox-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ tasks.register("generateVersionDescription") {
}

dependencies {
implementation(libs.sdds.icons)
implementation(icons.sdds.icons)
implementation("tokens:sdds.serv.view")
implementation("tokens:sdds.serv.compose")
implementation(project(":sandbox-sdds-serv-integration"))
Expand Down Expand Up @@ -197,3 +197,7 @@ dependencies {
testImplementation(libs.test.roborazzi.rule)
testImplementation(libs.base.test.unit.robolectric)
}

tasks.matching { it.name.matches(Regex("generate\\w+Resources")) }.configureEach {
dependsOn(tasks.withType<GenerateStarDimensTask>())
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ internal class BasicButtonViewModel(
name = PropertyName.Loading.value,
value = loading,
),
Property.BooleanProperty(
name = PropertyName.FixedSize.value,
value = fixedSize,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private fun consumeSwipeWithinBottomSheetBoundsNestedScrollConnection(
override suspend fun onPreFling(available: Velocity): Velocity {
val toFling = available.velocityToFloat()
val currentOffset = state.requireOffset()
return if (toFling < 0 && currentOffset > state.anchors.minAnchor()) {
return if (toFling < 0 && currentOffset > state.anchors.minPosition()) {
state.settle(toFling)
available
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ internal class BottomSheetState(
get() = currentValue == BottomSheetValue.Collapsed

private val hasHalfExpandedState: Boolean
get() = draggableState.anchors.hasAnchorFor(BottomSheetValue.HalfExpanded)
get() = draggableState.anchors.hasPositionFor(BottomSheetValue.HalfExpanded)

/**
* Show the bottom sheet with animation and suspend until it's shown.
Expand All @@ -153,7 +153,7 @@ internal class BottomSheetState(
* Expand the bottom sheet with an animation and suspend until the animation finishes or is cancelled.
*/
suspend fun expand() {
if (draggableState.anchors.hasAnchorFor(BottomSheetValue.Expanded)) {
if (draggableState.anchors.hasPositionFor(BottomSheetValue.Expanded)) {
animateTo(BottomSheetValue.Expanded)
}
}
Expand All @@ -162,7 +162,7 @@ internal class BottomSheetState(
* Half expand the bottom sheet with an animation and suspend until the animation finishes or is cancelled.
*/
suspend fun halfExpand() {
if (draggableState.anchors.hasAnchorFor(BottomSheetValue.HalfExpanded)) {
if (draggableState.anchors.hasPositionFor(BottomSheetValue.HalfExpanded)) {
animateTo(BottomSheetValue.HalfExpanded)
}
}
Expand All @@ -182,7 +182,7 @@ internal class BottomSheetState(
val peekHeightF = peekHeight.toFloat().coerceAtMost(layoutHeightF)
val newAnchors = DraggableAnchors {
BottomSheetValue
.values()
.entries
.forEach { anchor ->
when (anchor) {
BottomSheetValue.Collapsed -> anchor at (layoutHeightF - peekHeightF).coerceAtLeast(0f)
Expand Down
7 changes: 3 additions & 4 deletions playground/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
// Костыль. Версия иконок лежит в отдельном toml файле, чтобы избежать конфликтов из-за
// раздельных релизных процессов иконок и остальных библиотек
org.gradle.api.internal.catalog.parser.TomlCatalogFileParser
.parse(file("../gradle/icons.version.toml").toPath(), this)
}
create("icons") {
from(files("../gradle/icons.version.toml"))
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions sdds-core/docs-ksp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id("convention.kotlin-lib")
}

group = "sdds-core"

dependencies {
implementation(libs.base.kotlin.ksp)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.io.OutputStreamWriter
*/
class DocSamplesProcessorProvider : SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor =
DocSamplesProcessor(environment.codeGenerator, environment.logger)
DocSamplesProcessor(environment.codeGenerator, environment.logger, environment.options)
}

/**
Expand All @@ -32,12 +32,14 @@ class DocSamplesProcessorProvider : SymbolProcessorProvider {
class DocSamplesProcessor(
private val codeGenerator: CodeGenerator,
private val logger: KSPLogger,
options: Map<String, String>,
) : SymbolProcessor {

private val docSampleAnn = "com.sdds.docs.DocSample"
private val contextType = "android.content.Context"
private val viewType = "android.view.View"
private val composableAnn = "androidx.compose.runtime.Composable"
private val packageName: String = options["packageName"] ?: "com.sdds.docs"

private val kotlinEntries: LinkedHashMap<String, Entry> = linkedMapOf()
private val viewEntries: LinkedHashMap<String, Entry> = linkedMapOf()
Expand Down Expand Up @@ -174,7 +176,7 @@ class DocSamplesProcessor(
view: List<Entry>,
composable: List<Entry>,
) {
val pkg = "com.sdds.docs"
val pkg = packageName
val fileName = "DocSampleRegistry"

if (regular.isEmpty() && composable.isEmpty() && view.isEmpty()) return
Expand Down
2 changes: 1 addition & 1 deletion sdds-core/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 22 11:08:38 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 3 additions & 4 deletions sdds-core/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
// Костыль. Версия иконок лежит в отдельном toml файле, чтобы избежать конфликтов из-за
// раздельных релизных процессов иконок и остальных библиотек
org.gradle.api.internal.catalog.parser.TomlCatalogFileParser
.parse(file("../gradle/icons.version.toml").toPath(), this)
}
create("icons") {
from(files("../gradle/icons.version.toml"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ enum class PopoverPlacementMode {
fun Modifier.popoverTrigger(triggerInfo: MutableState<TriggerInfo>): Modifier {
return composed {
val currentScaleFactor = LocalFocusSelectorSettings.current.scale.scaleFactor
this then layout { measurable, constraints ->
layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
triggerInfo.value = triggerInfo.value.copy(
topAlignmentLine = placeable[topAlignmentLine],
Expand All @@ -179,12 +179,12 @@ fun Modifier.popoverTrigger(triggerInfo: MutableState<TriggerInfo>): Modifier {
return@layout layout(placeable.width, placeable.height) {
placeable.placeRelative(IntOffset.Zero)
}
} then onGloballyPositioned {
}.onGloballyPositioned {
triggerInfo.value = triggerInfo.value.copy(
size = it.size,
positionInRoot = it.positionInWindow().round(),
)
} then onFocusChanged {
}.onFocusChanged {
val scaleFactor = if (it.isFocused) {
currentScaleFactor
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,13 @@ private fun DrawerState.updateAnchorsFor(size: IntSize, peekOffset: Float) {
}

val hasAnchors = anchoredDraggableState.anchors.size > 0
val newTarget = if (!hasAnchors && anchors.hasAnchorFor(currentValue)) {
val newTarget = if (!hasAnchors && anchors.hasPositionFor(currentValue)) {
currentValue
} else {
when (targetValue) {
DrawerValue.Closed -> DrawerValue.Closed
DrawerValue.Opened -> {
val newTarget = if (anchors.hasAnchorFor(DrawerValue.Opened)) {
val newTarget = if (anchors.hasPositionFor(DrawerValue.Opened)) {
DrawerValue.Opened
} else {
DrawerValue.Closed
Expand Down
Loading
Loading