diff --git a/build.gradle.kts b/build.gradle.kts index 04429e2..67d0fe3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,22 +3,24 @@ import com.vanniktech.maven.publish.KotlinMultiplatform import com.vanniktech.maven.publish.MavenPublishBaseExtension plugins { - autowire(libs.plugins.kotlin.multiplatform) apply false - autowire(libs.plugins.android.application) apply false - autowire(libs.plugins.android.library) apply false - autowire(libs.plugins.jetbrains.compose) apply false - autowire(libs.plugins.compose.compiler) apply false - autowire(libs.plugins.maven.publish) apply false + alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.jetbrains.compose) apply false + alias(libs.plugins.compose.compiler) apply false + alias(libs.plugins.maven.publish) apply false } libraryProjects { afterEvaluate { resolveDevPublishWorkflow() + configure { repositories { val repositoryDir = gradle.gradleUserHomeDir .resolve("highcapable-maven-repository") .resolve("repository") + maven { name = "HighCapableMavenReleases" url = repositoryDir.resolve("releases").toURI() @@ -29,6 +31,7 @@ libraryProjects { } } } + configure { configure(KotlinMultiplatform(javadocJar = JavadocJar.Empty())) } @@ -47,17 +50,23 @@ libraryProjects { fun Project.resolveDevPublishWorkflow() { fun String.parseCode() = (trim().toIntOrNull() ?: 0).toString().padStart(4, '0') fun String.nextCode() = (toInt() + 1).toString().parseCode() + val devFile = projectDir.resolve("build").resolve("publish_dev") val isDevMode = devFile.exists() val code = (if (isDevMode) devFile.readText() else "1").parseCode() val devVersion = "$version-dev$code" + version = if (isDevMode) devVersion else version + if (isDevMode) println("Detected dev mode of $name, publish version is $devVersion") + tasks.register("publishDev") { group = "publishing" dependsOn("publishAllPublicationsToHighCapableMavenSnapShotsRepository") + doLast { val nextCode = code.nextCode() + println("Dev publish is finished, next dev code is $nextCode") devFile.writeText(nextCode) } diff --git a/flexiui-core/build.gradle.kts b/flexiui-core/build.gradle.kts index 963e8fe..b541d5a 100644 --- a/flexiui-core/build.gradle.kts +++ b/flexiui-core/build.gradle.kts @@ -1,30 +1,34 @@ plugins { - autowire(libs.plugins.kotlin.multiplatform) - autowire(libs.plugins.android.library) - autowire(libs.plugins.jetbrains.compose) - autowire(libs.plugins.compose.compiler) - autowire(libs.plugins.maven.publish) + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.compose) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.maven.publish) } -group = property.project.groupName -version = property.project.flexiui.core.version +group = gropify.project.groupName +version = gropify.project.flexiui.core.version kotlin { androidTarget { publishLibraryVariants("release") } + jvm("desktop") + listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { iosTarget -> iosTarget.binaries.framework { - baseName = property.project.flexiui.core.iosModuleName + baseName = gropify.project.flexiui.core.iosModuleName isStatic = true } } + jvmToolchain(17) + sourceSets { all { languageSettings { @@ -34,19 +38,20 @@ kotlin { optIn("androidx.compose.foundation.ExperimentalFoundationApi") } } + val commonMain by getting { dependencies { implementation(compose.runtime) // Mark foundation with api like material do. api(compose.foundation) - implementation(composeExt.material.ripple) + implementation(libs.composeExt.material.ripple) api(projects.flexiuiResources) - api(com.highcapable.betterandroid.compose.extension) + api(libs.betterandroid.compose.extension) } } val androidMain by getting { dependencies { - implementation(com.highcapable.betterandroid.ui.extension) + implementation(libs.betterandroid.ui.extension) } } val desktopMain by getting @@ -63,15 +68,15 @@ kotlin { } android { - namespace = property.project.flexiui.core.namespace - compileSdk = property.project.android.compileSdk + namespace = gropify.project.flexiui.core.namespace + compileSdk = gropify.project.android.compileSdk sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].res.srcDirs("src/androidMain/res") sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - minSdk = property.project.android.minSdk + minSdk = gropify.project.android.minSdk } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt index f4b946b..b45e44f 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt @@ -156,6 +156,8 @@ data class AutoCompleteOptions( val threshold: Int = 2 ) +// FIXME: (最后) TextField 重写,所有内容都需要定义到 decorationBox 中,不能在外部添加边框,否则会造成 KeyboardOptions 失效 + /** * Flexi UI text field. * @see TextField diff --git a/flexiui-resources/build.gradle.kts b/flexiui-resources/build.gradle.kts index 1d0e29e..6be512a 100644 --- a/flexiui-resources/build.gradle.kts +++ b/flexiui-resources/build.gradle.kts @@ -1,36 +1,40 @@ plugins { - autowire(libs.plugins.kotlin.multiplatform) - autowire(libs.plugins.android.library) - autowire(libs.plugins.jetbrains.compose) - autowire(libs.plugins.compose.compiler) - autowire(libs.plugins.maven.publish) + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.compose) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.maven.publish) } -group = property.project.groupName -version = property.project.flexiui.resources.version +group = gropify.project.groupName +version = gropify.project.flexiui.resources.version kotlin { androidTarget { publishLibraryVariants("release") } + jvm("desktop") + listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { iosTarget -> iosTarget.binaries.framework { - baseName = property.project.flexiui.resources.iosModuleName + baseName = gropify.project.flexiui.resources.iosModuleName isStatic = true } } + jvmToolchain(17) + sourceSets { val commonMain by getting { dependencies { implementation(compose.runtime) implementation(compose.foundation) - implementation(com.highcapable.betterandroid.compose.extension) + implementation(libs.betterandroid.compose.extension) } } val androidMain by getting @@ -48,15 +52,15 @@ kotlin { } android { - namespace = property.project.flexiui.resources.namespace - compileSdk = property.project.android.compileSdk + namespace = gropify.project.flexiui.resources.namespace + compileSdk = gropify.project.android.compileSdk sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].res.srcDirs("src/androidMain/res") sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - minSdk = property.project.android.minSdk + minSdk = gropify.project.android.minSdk } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index 953e849..f3d8828 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ project.android.compileSdk=35 project.android.minSdk=21 project.android.targetSdk=35 # Maven Publish Configuration -SONATYPE_HOST=S01 +SONATYPE_HOST=CENTRAL_PORTAL RELEASE_SIGNING_ENABLED=true # Maven POM Configuration POM_NAME=FlexiUI diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..fdb90f9 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,47 @@ +[versions] +agp = "8.13.1" +androidx-compose-android = "1.9.4" +kotlin-multiplatform = "2.2.21" +jetbrains-compose = "1.9.3" +maven-publish = "0.35.0" +androidx-activity = "1.11.0" +androidx-core-ktx = "1.17.0" +androidx-appcompat = "1.7.1" +# noinspection GradleDependency +material = "1.11.0" +junit = "4.13.2" +androidx-test-ext-junit = "1.3.0" +androidx-test-espresso-core = "3.7.0" +betterandroid-ui-component = "1.0.8" +betterandroid-ui-extension = "1.0.7" +betterandroid-system-extension = "1.0.3" +betterandroid-compose-extension = "1.0.2" +betterandroid-compose-multiplatform = "0.1.0" + +[plugins] +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-multiplatform" } +jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jetbrains-compose" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-multiplatform" } +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" } + +[libraries] +composeExt-material-ripple = { module = "org.jetbrains.compose.material:material-ripple", version.ref = "jetbrains-compose" } +# Use a placeholder for the android compose version +# In the project to use "androidx.compose.android.version" to obtain the version +# and use the "resolutionStrategy" to replace all the current "stable" versions +androidx-compose-android = { module = "androidx.compose.runtime:runtime-android", version.ref = "androidx-compose-android" } +betterandroid-ui-component = { module = "com.highcapable.betterandroid:ui-component", version.ref = "betterandroid-ui-component" } +betterandroid-ui-extension = { module = "com.highcapable.betterandroid:ui-extension", version.ref = "betterandroid-ui-extension" } +betterandroid-system-extension = { module = "com.highcapable.betterandroid:system-extension", version.ref = "betterandroid-system-extension" } +betterandroid-compose-extension = { module = "com.highcapable.betterandroid:compose-extension", version.ref = "betterandroid-compose-extension" } +betterandroid-compose-multiplatform = { module = "com.highcapable.betterandroid:compose-multiplatform", version.ref = "betterandroid-compose-multiplatform" } +androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" } +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core-ktx" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +material = { module = "com.google.android.material:material", version.ref = "material" } +junit = { module = "junit:junit", version.ref = "junit" } +androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" } +androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso-core" } \ No newline at end of file diff --git a/gradle/sweet-dependency/sweet-dependency-config.yaml b/gradle/sweet-dependency/sweet-dependency-config.yaml deleted file mode 100644 index 0d51775..0000000 --- a/gradle/sweet-dependency/sweet-dependency-config.yaml +++ /dev/null @@ -1,78 +0,0 @@ -preferences: - autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES - repositories-mode: FAIL_ON_PROJECT_REPOS - -repositories: - gradle-plugin-portal: - scope: PLUGINS - google: - maven-central: - highcapable-maven-releases: - url: https://raw.githubusercontent.com/HighCapable/maven-repository/main/repository/releases - -plugins: - org.jetbrains.kotlin.multiplatform: - alias: kotlin-multiplatform - version: 2.2.10 - org.jetbrains.compose: - alias: jetbrains-compose - version: 1.8.2 - org.jetbrains.kotlin.plugin.compose: - alias: compose-compiler - version-ref: kotlin-multiplatform - com.android.application: - alias: android-application - version: 8.12.1 - com.android.library: - alias: android-library - version-ref: android-application - com.vanniktech.maven.publish: - alias: maven-publish - version: 0.34.0 - -libraries: - org.jetbrains.compose.material: - material-ripple: - alias: composeExt-material-ripple - version-ref: ::jetbrains-compose - # Use a placeholder for the android compose version - # In the project to use "androidx.compose.android.version" to obtain the version - # and use the "resolutionStrategy" to replace all the current "stable" versions - androidx.compose.runtime: - runtime-android: - alias: androidx-compose-android - version: 1.9.0 - com.highcapable.betterandroid: - ui-component: - version: 1.0.8 - ui-extension: - version: 1.0.7 - system-extension: - version: 1.0.3 - compose-extension: - version: 1.0.2 - compose-multiplatform: - version: 0.1.0 - androidx.activity: - activity: - version: 1.10.1 - activity-compose: - version: 1.10.1 - androidx.core: - core-ktx: - version: 1.17.0 - androidx.appcompat: - appcompat: - version: 1.7.1 - com.google.android.material: - material: - version: 1.12.0 - androidx.test.ext: - junit: - version: 1.3.0 - androidx.test.espresso: - espresso-core: - version: 3.7.0 - junit: - junit: - version: 4.13.2 \ No newline at end of file diff --git a/samples/androidApp/build.gradle.kts b/samples/androidApp/build.gradle.kts index bc644f2..5d44891 100644 --- a/samples/androidApp/build.gradle.kts +++ b/samples/androidApp/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - autowire(libs.plugins.kotlin.multiplatform) - autowire(libs.plugins.android.application) - autowire(libs.plugins.jetbrains.compose) - autowire(libs.plugins.compose.compiler) + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.compose) + alias(libs.plugins.compose.compiler) } kotlin { @@ -18,19 +18,19 @@ kotlin { } android { - namespace = property.project.samples.androidApp.packageName - compileSdk = property.project.android.compileSdk + namespace = gropify.project.samples.androidApp.packageName + compileSdk = gropify.project.android.compileSdk sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].res.srcDirs("src/androidMain/res") sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - applicationId = property.project.samples.androidApp.packageName - minSdk = property.project.android.minSdk - targetSdk = property.project.android.targetSdk - versionName = property.project.samples.androidApp.versionName - versionCode = property.project.samples.androidApp.versionCode + applicationId = gropify.project.samples.androidApp.packageName + minSdk = gropify.project.android.minSdk + targetSdk = gropify.project.android.targetSdk + versionName = gropify.project.samples.androidApp.versionName + versionCode = gropify.project.samples.androidApp.versionCode } buildTypes { release { @@ -45,7 +45,7 @@ android { } } -val composeAndroidVersion = dependencies.androidx.compose.android.version +val composeAndroidVersion = libs.androidx.compose.android.get().version ?: error("Unresolved compose android version.") configurations.all { resolutionStrategy.eachDependency { diff --git a/samples/composeApp/build.gradle.kts b/samples/composeApp/build.gradle.kts index 6ae4f10..f417871 100644 --- a/samples/composeApp/build.gradle.kts +++ b/samples/composeApp/build.gradle.kts @@ -1,42 +1,46 @@ plugins { - autowire(libs.plugins.kotlin.multiplatform) - autowire(libs.plugins.android.library) - autowire(libs.plugins.jetbrains.compose) - autowire(libs.plugins.compose.compiler) + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.compose) + alias(libs.plugins.compose.compiler) } kotlin { androidTarget() jvm("desktop") + listOf( iosX64(), iosArm64(), iosSimulatorArm64(), ).forEach { iosTarget -> iosTarget.binaries.framework { - baseName = property.project.samples.composeApp.iosModuleName + baseName = gropify.project.samples.composeApp.iosModuleName isStatic = true } } + jvmToolchain(17) + sourceSets { val commonMain by getting { dependencies { implementation(compose.runtime) implementation(compose.foundation) + api(projects.flexiuiCore) - api(com.highcapable.betterandroid.compose.multiplatform) + api(libs.betterandroid.compose.multiplatform) } } val androidMain by getting { dependencies { - api(androidx.core.core.ktx) - api(androidx.appcompat.appcompat) - api(androidx.activity.activity) - api(androidx.activity.activity.compose) - api(com.highcapable.betterandroid.ui.component) - api(com.highcapable.betterandroid.ui.extension) - api(com.highcapable.betterandroid.system.extension) + api(libs.androidx.core.ktx) + api(libs.androidx.appcompat) + api(libs.androidx.activity) + api(libs.androidx.activity.compose) + api(libs.betterandroid.ui.component) + api(libs.betterandroid.ui.extension) + api(libs.betterandroid.system.extension) } } val desktopMain by getting { @@ -57,15 +61,15 @@ kotlin { } android { - namespace = property.project.samples.composeApp.namespace - compileSdk = property.project.android.compileSdk + namespace = gropify.project.samples.composeApp.namespace + compileSdk = gropify.project.android.compileSdk sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].res.srcDirs("src/androidMain/res") sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - minSdk = property.project.android.minSdk + minSdk = gropify.project.android.minSdk } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/samples/desktopApp/build.gradle.kts b/samples/desktopApp/build.gradle.kts index 9d20cc8..4eaced5 100644 --- a/samples/desktopApp/build.gradle.kts +++ b/samples/desktopApp/build.gradle.kts @@ -1,15 +1,16 @@ plugins { - autowire(libs.plugins.kotlin.multiplatform) - autowire(libs.plugins.jetbrains.compose) - autowire(libs.plugins.compose.compiler) + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.jetbrains.compose) + alias(libs.plugins.compose.compiler) } -group = property.project.samples.desktopApp.groupName -version = property.project.samples.desktopApp.version +group = gropify.project.samples.desktopApp.groupName +version = gropify.project.samples.desktopApp.version kotlin { jvm("desktop") jvmToolchain(17) + sourceSets { val desktopMain by getting { dependencies { diff --git a/settings.gradle.kts b/settings.gradle.kts index fba5d2f..56f71ac 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,5 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + pluginManagement { repositories { gradlePluginPortal() @@ -6,31 +7,56 @@ pluginManagement { mavenCentral() } } + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven("https://raw.githubusercontent.com/HighCapable/maven-repository/main/repository/releases") + } +} + plugins { - id("com.highcapable.sweetdependency") version "1.0.4" - id("com.highcapable.sweetproperty") version "1.0.8" + id("com.highcapable.gropify") version "1.0.0" } -sweetDependency { - isUseDependencyResolutionManagement = false -} -sweetProperty { + +gropify { global { - sourcesCode { + android { className = "FlexiUI" includeKeys("^project\\..*\$".toRegex()) - isEnableRestrictedAccess = true + isRestrictedAccessEnabled = true } } - rootProject { all { isEnable = false } } - project( + + rootProject { + common { + isEnabled = false + } + } + + projects( ":samples", ":samples:androidApp", ":samples:desktopApp", ":samples:composeApp", ":flexiui-core", ":flexiui-resources" - ) { sourcesCode { isEnable = false } } + ) { + android { + isEnabled = false + } + jvm { + isEnabled = false + } + kmp { + isEnabled = false + } + } } + rootProject.name = "FlexiUI" + include(":samples:androidApp", ":samples:desktopApp", ":samples:composeApp") include(":flexiui-core", ":flexiui-resources") \ No newline at end of file