From a0f1c71f8427287a97693c895341dd5a8604f81a Mon Sep 17 00:00:00 2001 From: tclement0922 Date: Tue, 21 Jan 2025 21:14:11 +0100 Subject: [PATCH] Remove every packaged font modules --- build.gradle.kts | 2 +- buildSrc/build.gradle.kts | 9 -- .../src/main/kotlin/CreateFAVariantTask.kt | 65 -------- .../main/kotlin/CreateSymbolsVariantTask.kt | 141 ----------------- buildSrc/src/main/kotlin/fa-metadata.kt | 41 ----- .../kotlin/fonticons.fa-variant.gradle.kts | 46 ------ .../kotlin/fonticons.java-target.gradle.kts | 4 +- ...nticons.multiplatform-structure.gradle.kts | 2 +- .../fonticons.symbols-variant.gradle.kts | 54 ------- font-fa/.gitignore | 2 - font-fa/brands/build.gradle.kts | 18 --- font-fa/brands/consumer-rules.pro | 0 font-fa/brands/proguard-rules.pro | 21 --- font-fa/build.gradle.kts | 124 --------------- font-fa/consumer-rules.pro | 0 font-fa/proguard-rules.pro | 21 --- font-fa/regular/build.gradle.kts | 18 --- font-fa/regular/consumer-rules.pro | 0 font-fa/regular/proguard-rules.pro | 21 --- font-fa/solid/build.gradle.kts | 18 --- font-fa/solid/consumer-rules.pro | 0 font-fa/solid/proguard-rules.pro | 21 --- .../dev/tclement/fonticons/fa/FontAwesome.kt | 30 ---- font-symbols/.gitignore | 2 - font-symbols/build.gradle.kts | 142 ------------------ font-symbols/consumer-rules.pro | 0 font-symbols/outlined/build.gradle.kts | 18 --- font-symbols/outlined/consumer-rules.pro | 0 font-symbols/outlined/proguard-rules.pro | 21 --- font-symbols/proguard-rules.pro | 21 --- font-symbols/rounded/build.gradle.kts | 18 --- font-symbols/rounded/consumer-rules.pro | 0 font-symbols/rounded/proguard-rules.pro | 21 --- font-symbols/sharp/build.gradle.kts | 18 --- font-symbols/sharp/consumer-rules.pro | 0 font-symbols/sharp/proguard-rules.pro | 21 --- .../fonticons/symbols/MaterialSymbols.kt | 26 ---- glance/build.gradle.kts | 2 +- gradle/libs.versions.toml | 7 - settings.gradle.kts | 14 -- testapp/build.gradle.kts | 80 +++++++--- .../fonticons/testapp/widget/TestWidget.kt | 22 ++- .../dev/tclement/fonticons/testapp/Fonts.kt | 14 +- .../tclement/fonticons/testapp/MainContent.kt | 7 +- .../testapp/screen/MaterialSymbolsScreen.kt | 95 +++++++++++- 45 files changed, 176 insertions(+), 1031 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/CreateFAVariantTask.kt delete mode 100644 buildSrc/src/main/kotlin/CreateSymbolsVariantTask.kt delete mode 100644 buildSrc/src/main/kotlin/fa-metadata.kt delete mode 100644 buildSrc/src/main/kotlin/fonticons.fa-variant.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/fonticons.symbols-variant.gradle.kts delete mode 100644 font-fa/.gitignore delete mode 100644 font-fa/brands/build.gradle.kts delete mode 100644 font-fa/brands/consumer-rules.pro delete mode 100644 font-fa/brands/proguard-rules.pro delete mode 100644 font-fa/build.gradle.kts delete mode 100644 font-fa/consumer-rules.pro delete mode 100644 font-fa/proguard-rules.pro delete mode 100644 font-fa/regular/build.gradle.kts delete mode 100644 font-fa/regular/consumer-rules.pro delete mode 100644 font-fa/regular/proguard-rules.pro delete mode 100644 font-fa/solid/build.gradle.kts delete mode 100644 font-fa/solid/consumer-rules.pro delete mode 100644 font-fa/solid/proguard-rules.pro delete mode 100644 font-fa/src/commonMain/kotlin/dev/tclement/fonticons/fa/FontAwesome.kt delete mode 100644 font-symbols/.gitignore delete mode 100644 font-symbols/build.gradle.kts delete mode 100644 font-symbols/consumer-rules.pro delete mode 100644 font-symbols/outlined/build.gradle.kts delete mode 100644 font-symbols/outlined/consumer-rules.pro delete mode 100644 font-symbols/outlined/proguard-rules.pro delete mode 100644 font-symbols/proguard-rules.pro delete mode 100644 font-symbols/rounded/build.gradle.kts delete mode 100644 font-symbols/rounded/consumer-rules.pro delete mode 100644 font-symbols/rounded/proguard-rules.pro delete mode 100644 font-symbols/sharp/build.gradle.kts delete mode 100644 font-symbols/sharp/consumer-rules.pro delete mode 100644 font-symbols/sharp/proguard-rules.pro delete mode 100644 font-symbols/src/commonMain/kotlin/dev/tclement/fonticons/symbols/MaterialSymbols.kt diff --git a/build.gradle.kts b/build.gradle.kts index 213a0b09..91edb31c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ plugins { unversioned(libs.plugins.android.application) apply false unversioned(libs.plugins.kotlin.android) apply false unversioned(libs.plugins.android.library) apply false - unversioned(libs.plugins.undercouch.download) apply false + alias(libs.plugins.undercouch.download) apply false unversioned(libs.plugins.vanniktech.publish) apply false unversioned(libs.plugins.jetbrains.dokka) id("fonticons.dokka-vitepress") diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index faab445a..13336585 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -16,7 +16,6 @@ plugins { `kotlin-dsl` - alias(libs.plugins.kotlin.serialization) version embeddedKotlinVersion } repositories { @@ -31,18 +30,10 @@ fun DependencyHandler.pluginImplementation(plugin: Provider) { dependencies { implementation(gradleApi()) - implementation(libs.squareup.kotlinpoet) - implementation(libs.google.guava) - implementation(libs.kotlinx.serialization.json) { - version { - require("1.6.3") // Can be removed when Gradle's embedded Kotlin version is set to at least 2.0 - } - } pluginImplementation(libs.plugins.kotlin.multiplatform) pluginImplementation(libs.plugins.kotlin.compose.compiler) pluginImplementation(libs.plugins.jetbrains.compose) - pluginImplementation(libs.plugins.undercouch.download) pluginImplementation(libs.plugins.vanniktech.publish) pluginImplementation(libs.plugins.android.library) pluginImplementation(libs.plugins.jetbrains.dokka) diff --git a/buildSrc/src/main/kotlin/CreateFAVariantTask.kt b/buildSrc/src/main/kotlin/CreateFAVariantTask.kt deleted file mode 100644 index 74008ff1..00000000 --- a/buildSrc/src/main/kotlin/CreateFAVariantTask.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.squareup.kotlinpoet.ClassName -import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.FunSpec -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.TaskAction -import org.gradle.kotlin.dsl.support.uppercaseFirstChar - -private const val TARGET_PACKAGE = "dev.tclement.fonticons.fa" - -abstract class CreateFAVariantTask : DefaultTask() { - @get:Input - abstract val variant: Property - - @get:OutputDirectory - abstract val output: DirectoryProperty - - @TaskAction - fun runAction() { - val variant = variant.get() - - val baseFileName = "${variant.uppercaseFirstChar()}FontAwesomeFont" - val packageName = "$TARGET_PACKAGE.$variant" - - val fileSpecBuilder = FileSpec.builder(packageName, baseFileName) - val functionSpec = FunSpec.builder("remember${variant.uppercaseFirstChar()}FontAwesomeFont") - .addAnnotation(ClassName("androidx.compose.runtime", "Composable")) - .returns(ClassName("dev.tclement.fonticons", "StaticIconFont")) - .addStatement( - """ - return rememberStaticIconFont( - fontResource = Res.font.fontawesome_$variant, - fontFeatureSettings = "liga" - ) - """.trimIndent() - ) - .addKdoc(""" - The FontAwesome Free ${variant.uppercaseFirstChar()} font. - """.trimIndent()) - .build() - fileSpecBuilder.addFunction(functionSpec) - fileSpecBuilder.addImport("dev.tclement.fonticons", "rememberStaticIconFont") - fileSpecBuilder.addImport("$packageName.resources", "Res", "fontawesome_$variant") - fileSpecBuilder.build().writeTo(output.get().asFile) - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/CreateSymbolsVariantTask.kt b/buildSrc/src/main/kotlin/CreateSymbolsVariantTask.kt deleted file mode 100644 index 252162c4..00000000 --- a/buildSrc/src/main/kotlin/CreateSymbolsVariantTask.kt +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.squareup.kotlinpoet.* -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.TaskAction -import org.gradle.kotlin.dsl.support.uppercaseFirstChar - -private const val TARGET_PACKAGE = "dev.tclement.fonticons.symbols" - -abstract class CreateSymbolsVariantTask : DefaultTask() { - @get:Input - abstract val variant: Property - - @get:OutputDirectory - abstract val commonOutput: DirectoryProperty - - @get:OutputDirectory - abstract val skikoOutput: DirectoryProperty - - @get:OutputDirectory - abstract val androidOutput: DirectoryProperty - - @TaskAction - fun runAction() { - val variant = variant.get() - - fun commonFunSpec() = FunSpec.builder("remember${variant.uppercaseFirstChar()}MaterialSymbolsFont") - .addAnnotation(ClassName("androidx.compose.runtime", "Composable")) - .returns(ClassName("dev.tclement.fonticons", "IconFont")) - - val baseFileName = "${variant.uppercaseFirstChar()}MaterialSymbolsFont" - val packageName = "$TARGET_PACKAGE.$variant" - val commonFileSpecBuilder = FileSpec.builder(packageName, baseFileName) - val expectFunctionSpec = commonFunSpec() - .addParameter(ParameterSpec.builder("grade", Int::class).defaultValue("0").build()) - .addParameter(ParameterSpec.builder("fill", Boolean::class).defaultValue("false").build()) - .addKdoc( - """ - The Material Symbols variable font, ${variant.uppercaseFirstChar()} variant. - - @param grade grade of the font, between -50 and 200, 0 by default - @param fill whether to use the filled variation of the icons or not, false by default - """.trimIndent() - ) - .addModifiers(KModifier.EXPECT) - .build() - commonFileSpecBuilder.addFunction(expectFunctionSpec) - commonFileSpecBuilder.build().writeTo(commonOutput.get().asFile) - - val skikoFileSpecBuilder = FileSpec.builder(packageName, "$baseFileName.skiko") - val skikoFunctionSpec = commonFunSpec() - .addParameter("grade", Int::class) - .addParameter("fill", Boolean::class) - .addModifiers(KModifier.ACTUAL) - .addStatement( - """ - return rememberVariableIconFont( - fontResource = Res.font.material_symbols_$variant, - weights = arrayOf( - FontWeight.W100, - FontWeight.W200, - FontWeight.W300, - FontWeight.W400, - FontWeight.W500, - FontWeight.W600, - FontWeight.W700, - ), - fontVariationSettings = arrayOf( - FontVariation.grade(grade), - FontVariation.Setting("FILL", if (fill) 1f else 0f) - ), - fontFeatureSettings = "liga" - ) - """.trimIndent() - ) - .build() - skikoFileSpecBuilder.addFunction(skikoFunctionSpec) - skikoFileSpecBuilder.addImport("dev.tclement.fonticons", "rememberVariableIconFont") - skikoFileSpecBuilder.addImport("$packageName.resources", "Res", "material_symbols_$variant") - skikoFileSpecBuilder.addImport("androidx.compose.ui.text.font", "FontVariation", "FontWeight") - skikoFileSpecBuilder.build().writeTo(skikoOutput.get().asFile) - - val androidFileSpecBuilder = FileSpec.builder(packageName, "$baseFileName.android") - val androidFunctionSpec = commonFunSpec() - .addParameter("grade", Int::class) - .addParameter("fill", Boolean::class) - .addModifiers(KModifier.ACTUAL) - .addStatement( - """ - return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - rememberStaticIconFont( - fontResource = Res.font.material_symbols_$variant - ) - } else { - rememberVariableIconFont( - fontResource = Res.font.material_symbols_$variant, - weights = arrayOf( - FontWeight.W100, - FontWeight.W200, - FontWeight.W300, - FontWeight.W400, - FontWeight.W500, - FontWeight.W600, - FontWeight.W700, - ), - fontVariationSettings = arrayOf( - FontVariation.grade(grade), - FontVariation.Setting("FILL", if (fill) 1f else 0f) - ), - fontFeatureSettings = "liga" - ) - } - """.trimIndent() - ) - .build() - androidFileSpecBuilder.addFunction(androidFunctionSpec) - androidFileSpecBuilder.addImport("dev.tclement.fonticons", "rememberVariableIconFont", "rememberStaticIconFont") - androidFileSpecBuilder.addImport("$packageName.resources", "Res", "material_symbols_$variant") - androidFileSpecBuilder.addImport("androidx.compose.ui.text.font", "FontVariation", "FontWeight") - androidFileSpecBuilder.addImport("android.os", "Build") - androidFileSpecBuilder.build().writeTo(androidOutput.get().asFile) - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/fa-metadata.kt b/buildSrc/src/main/kotlin/fa-metadata.kt deleted file mode 100644 index e145ddac..00000000 --- a/buildSrc/src/main/kotlin/fa-metadata.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import kotlinx.serialization.ExperimentalSerializationApi -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.decodeFromStream -import java.io.File - -@Serializable -data class FAMetadataItem( - val unicode: String, - val free: List, - val aliases: Aliases? = null -) { - @Serializable - data class Aliases( - val names: List? = null - ) -} - -private val json = Json { ignoreUnknownKeys = true } - -@OptIn(ExperimentalSerializationApi::class) -fun readFAMetadata(file: File): Map = file.inputStream().use { - json.decodeFromStream>(it) -} - diff --git a/buildSrc/src/main/kotlin/fonticons.fa-variant.gradle.kts b/buildSrc/src/main/kotlin/fonticons.fa-variant.gradle.kts deleted file mode 100644 index b3492e33..00000000 --- a/buildSrc/src/main/kotlin/fonticons.fa-variant.gradle.kts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.create -import org.gradle.kotlin.dsl.support.uppercaseFirstChar -import org.jetbrains.compose.ComposeExtension -import org.jetbrains.compose.resources.ResourcesExtension -import org.jetbrains.kotlin.gradle.dsl.kotlinExtension - -plugins { - id("fonticons.dokka") -} - -val mVariant = name.substringAfter("font-fa-") - -val createFAVariantFiles = tasks.create( - name = "createFA${mVariant.uppercaseFirstChar()}Files", - type = CreateFAVariantTask::class -) { - this.variant.set(mVariant) - output.set(layout.buildDirectory.dir("generated/fa/common")) -} - -kotlinExtension.sourceSets.named("commonMain") { - kotlin.srcDir(createFAVariantFiles.output) -} - -configure { - configure { - customDirectory("commonMain", project.layout.buildDirectory.dir("composeResources")) - } -} diff --git a/buildSrc/src/main/kotlin/fonticons.java-target.gradle.kts b/buildSrc/src/main/kotlin/fonticons.java-target.gradle.kts index 5bc2495b..29c6828b 100644 --- a/buildSrc/src/main/kotlin/fonticons.java-target.gradle.kts +++ b/buildSrc/src/main/kotlin/fonticons.java-target.gradle.kts @@ -1,7 +1,7 @@ @file:OptIn(ExperimentalKotlinGradlePluginApi::class) import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi -import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension /* * Copyright 2024 T. Clément (@tclement0922) @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension val javaVersion = properties["JAVA_VERSION"] as? String ?: "1.8" val javaVersionInt = if (javaVersion.contains('.')) javaVersion.substringAfterLast('.').toInt() else javaVersion.toInt() -extensions.configure(KotlinTopLevelExtension::class) { +extensions.configure(KotlinBaseExtension::class) { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(javaVersionInt)) } diff --git a/buildSrc/src/main/kotlin/fonticons.multiplatform-structure.gradle.kts b/buildSrc/src/main/kotlin/fonticons.multiplatform-structure.gradle.kts index 8a1c4973..6a67ec12 100644 --- a/buildSrc/src/main/kotlin/fonticons.multiplatform-structure.gradle.kts +++ b/buildSrc/src/main/kotlin/fonticons.multiplatform-structure.gradle.kts @@ -155,7 +155,7 @@ if (isLibrary) { extensions.configure { namespace = packageName - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 21 diff --git a/buildSrc/src/main/kotlin/fonticons.symbols-variant.gradle.kts b/buildSrc/src/main/kotlin/fonticons.symbols-variant.gradle.kts deleted file mode 100644 index 0a9c5c39..00000000 --- a/buildSrc/src/main/kotlin/fonticons.symbols-variant.gradle.kts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.gradle.kotlin.dsl.support.uppercaseFirstChar -import org.jetbrains.compose.ComposeExtension -import org.jetbrains.compose.resources.ResourcesExtension -import org.jetbrains.kotlin.gradle.dsl.kotlinExtension - -plugins { - id("fonticons.dokka") -} - -val mVariant = name.substringAfter("font-symbols-") - -val createSymbolsVariantFiles = tasks.create( - name = "createSymbols${mVariant.uppercaseFirstChar()}Files", - type = CreateSymbolsVariantTask::class -) { - this.variant.set(mVariant) - commonOutput.set(layout.buildDirectory.dir("generated/symbols/common")) - skikoOutput.set(layout.buildDirectory.dir("generated/symbols/skiko")) - androidOutput.set(layout.buildDirectory.dir("generated/symbols/android")) -} - -kotlinExtension.sourceSets.named("commonMain") { - kotlin.srcDir(createSymbolsVariantFiles.commonOutput) -} - -kotlinExtension.sourceSets.named("skikoMain") { - kotlin.srcDir(createSymbolsVariantFiles.skikoOutput) -} - -kotlinExtension.sourceSets.named("androidMain") { - kotlin.srcDir(createSymbolsVariantFiles.androidOutput) -} - -configure { - configure { - customDirectory("commonMain", project.layout.buildDirectory.dir("composeResources")) - } -} \ No newline at end of file diff --git a/font-fa/.gitignore b/font-fa/.gitignore deleted file mode 100644 index cec19127..00000000 --- a/font-fa/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/*/build \ No newline at end of file diff --git a/font-fa/brands/build.gradle.kts b/font-fa/brands/build.gradle.kts deleted file mode 100644 index 6a0d1941..00000000 --- a/font-fa/brands/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.fa-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-fa")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-fa/brands/consumer-rules.pro b/font-fa/brands/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-fa/brands/proguard-rules.pro b/font-fa/brands/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-fa/brands/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-fa/build.gradle.kts b/font-fa/build.gradle.kts deleted file mode 100644 index e4009019..00000000 --- a/font-fa/build.gradle.kts +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.google.common.base.CaseFormat -import com.squareup.kotlinpoet.* -import de.undercouch.gradle.tasks.download.Download -import org.gradle.kotlin.dsl.support.uppercaseFirstChar - -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.dokka") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":core")) - implementation(compose.components.resources) - } - } - } -} - -val downloadFiles by tasks.creating(Download::class) { - val urlPrefix = "https://github.com/FortAwesome/Font-Awesome/raw/${properties["FONT_FA_REVISION"]}" - val fonts = mapOf( - "Font%20Awesome%206%20Brands-Regular-400.otf" to "brands", - "Font%20Awesome%206%20Free-Regular-400.otf" to "regular", - "Font%20Awesome%206%20Free-Solid-900.otf" to "solid" - ) - - src(fonts.map { (file, _) -> "$urlPrefix/otfs/$file" } + "$urlPrefix/metadata/icons.json") - dest(layout.projectDirectory) - eachFile { - path = if (name.endsWith(".json")) { - "build/icons.json" - } else { - "${fonts[name]}/build/composeResources/font/fontawesome_${fonts[name]}.otf" - } - } - overwrite(false) -} - -private val targetPackage = "dev.tclement.fonticons.fa" -private val targetFile = "FontAwesomeChars" -private val receiverPackage = targetPackage -private val receiverClass = "FontAwesome" - -val createFAFile by tasks.creating(Task::class) { - dependsOn(downloadFiles) - kotlin.sourceSets.commonMain { - kotlin.srcDir(this@creating) - } - - val metadataFile = project.layout.buildDirectory.file("icons.json") - inputs.file(metadataFile) - outputs.dir(project.layout.buildDirectory.dir("generated/font-fa/kotlin/")) - - doFirst { - val variants = setOf("brands", "regular", "solid") - val metadata = readFAMetadata(metadataFile.get().asFile) - - val codepoints = - variants.associateWith { v -> project.layout.buildDirectory.file("fa-$v.txt").get().asFile } - - val fileSpecBuilder = FileSpec.builder(targetPackage, targetFile) - fileSpecBuilder.addAnnotation( - AnnotationSpec.Companion.builder(Suppress::class) - .addMember("\"RedundantVisibilityModifier\", \"UnusedReceiverParameter\", \"Unused\", \"ObjectPropertyName\", \"SpellCheckingInspection\"") - .build() - ) - - for ((icon, details) in metadata) { - for (variant in details.free.filter { it in variants }) { - for (iconName in details.aliases?.names.orEmpty() + icon) { - codepoints[variant]?.appendText("$iconName\n") - val formattedIconName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, iconName).let { - if (it.first().isDigit()) "_$it" else it - } - val property = PropertySpec.builder(formattedIconName, Char::class) - .receiver(ClassName(receiverPackage, "$receiverClass.${variant.uppercaseFirstChar()}")) - .getter( - FunSpec.getterBuilder() - .addCode( - buildCodeBlock { - addStatement("return '\\u${details.unicode.padStart(4, '0')}'") - } - ) - .build() - ) - .addKdoc("@suppress") - .build() - fileSpecBuilder.addProperty(property) - } - } - } - - fileSpecBuilder.build() - .writeTo(project.layout.buildDirectory.file("generated/font-fa/kotlin/").get().asFile) - } -} - -childProjects.forEach { (_, child) -> - child.afterEvaluate { - child.tasks.named("copyNonXmlValueResourcesForCommonMain") { dependsOn(downloadFiles) } - } -} diff --git a/font-fa/consumer-rules.pro b/font-fa/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-fa/proguard-rules.pro b/font-fa/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-fa/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-fa/regular/build.gradle.kts b/font-fa/regular/build.gradle.kts deleted file mode 100644 index 6a0d1941..00000000 --- a/font-fa/regular/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.fa-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-fa")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-fa/regular/consumer-rules.pro b/font-fa/regular/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-fa/regular/proguard-rules.pro b/font-fa/regular/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-fa/regular/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-fa/solid/build.gradle.kts b/font-fa/solid/build.gradle.kts deleted file mode 100644 index 6a0d1941..00000000 --- a/font-fa/solid/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.fa-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-fa")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-fa/solid/consumer-rules.pro b/font-fa/solid/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-fa/solid/proguard-rules.pro b/font-fa/solid/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-fa/solid/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-fa/src/commonMain/kotlin/dev/tclement/fonticons/fa/FontAwesome.kt b/font-fa/src/commonMain/kotlin/dev/tclement/fonticons/fa/FontAwesome.kt deleted file mode 100644 index aa0cd190..00000000 --- a/font-fa/src/commonMain/kotlin/dev/tclement/fonticons/fa/FontAwesome.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.tclement.fonticons.fa - -/** - * [Font Awesome icons](https://fontawesome.com/). - * - * A Font Awesome icon can be called like this: `FontAwesome.Regular.IconName` - * - * Those icons are Unicode [Char]s, so they're incompatible with the official Icon composable. - */ -public object FontAwesome { - public object Brands - public object Regular - public object Solid -} diff --git a/font-symbols/.gitignore b/font-symbols/.gitignore deleted file mode 100644 index cec19127..00000000 --- a/font-symbols/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/*/build \ No newline at end of file diff --git a/font-symbols/build.gradle.kts b/font-symbols/build.gradle.kts deleted file mode 100644 index 16ddeaad..00000000 --- a/font-symbols/build.gradle.kts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.google.common.base.CaseFormat -import com.squareup.kotlinpoet.* -import de.undercouch.gradle.tasks.download.Download - -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.dokka") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":core")) - implementation(compose.components.resources) - } - } - } -} - -val downloadFiles by tasks.creating(Download::class) { - val fontNamePrefix = "MaterialSymbols" - val urlPrefix = - "https://github.com/google/material-design-icons/raw/${properties["FONT_SYMBOLS_REVISION"]}/variablefont/" - val fontNameSuffix = "%5BFILL%2CGRAD%2Copsz%2Cwght%5D" - val fonts = mapOf( - "${fontNamePrefix}Outlined${fontNameSuffix}" to "outlined", - "${fontNamePrefix}Rounded${fontNameSuffix}" to "rounded", - "${fontNamePrefix}Sharp${fontNameSuffix}" to "sharp" - ) - - src(fonts.flatMap { (file, _) -> - listOf( - "$urlPrefix$file.ttf", - "$urlPrefix$file.codepoints" - ) - }) - dest(layout.projectDirectory) - eachFile { - path = if (name.endsWith(".codepoints")) { - "build/$name" - } else { - val variant = fonts[name.removeSuffix(".ttf")] - "$variant/build/composeResources/font/material_symbols_$variant.ttf" - } - } - overwrite(false) -} - -private val targetPackage = "dev.tclement.fonticons.symbols" -private val targetFile = "MaterialSymbolsChars" -private val receiverPackage = targetPackage -private val receiverClass = "MaterialSymbols" - -val createSymbolsFile by tasks.creating(Task::class) { - dependsOn(downloadFiles) - kotlin.sourceSets.commonMain { - kotlin.srcDir(this@creating) - } - - val codepointsFiles = project.layout.buildDirectory.let { - listOf( - it.file("MaterialSymbolsOutlined%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints"), - it.file("MaterialSymbolsRounded%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints"), - it.file("MaterialSymbolsSharp%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints"), - ) - } - inputs.files(codepointsFiles) - outputs.dir(project.layout.buildDirectory.dir("generated/font-symbols/kotlin/")) - - doFirst { - if (!codepointsFiles.all { it.isPresent } - || !codepointsFiles[0].get().asFile.readBytes() - .contentEquals(codepointsFiles[1].get().asFile.readBytes()) - || !codepointsFiles[1].get().asFile.readBytes() - .contentEquals(codepointsFiles[2].get().asFile.readBytes())) { - error("Some codepoints files are not available or some of their content are not the same") - } - - val codepoints = codepointsFiles[0].get().asFile.readLines().map { - val split = it.split(' ') - split[0] to split[1] - } - - project.layout.buildDirectory.file("symbols.txt") - .get().asFile.writeText(codepoints.joinToString("\n") { it.first }) - - val fileSpecBuilder = FileSpec.builder(targetPackage, targetFile) - fileSpecBuilder.addAnnotation( - AnnotationSpec.Companion.builder(Suppress::class) - .addMember("\"RedundantVisibilityModifier\", \"UnusedReceiverParameter\", \"Unused\", \"ObjectPropertyName\", \"SpellCheckingInspection\"") - .build() - ) - for (codepoint in codepoints) { - val iconName = - CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, codepoint.first).let { - if (it.first().isDigit()) "_$it" else it - } - val property = PropertySpec.builder(iconName, Char::class) - .receiver(ClassName(receiverPackage, receiverClass)) - .getter( - FunSpec.getterBuilder() - .addCode( - buildCodeBlock { - addStatement("return '\\u${codepoint.second}'") - } - ) - .build() - ) - .addKdoc("@suppress") - .build() - fileSpecBuilder.addProperty(property) - } - fileSpecBuilder.build() - .writeTo(project.layout.buildDirectory.file("generated/font-symbols/kotlin/").get().asFile) - } -} - -childProjects.forEach { (_, child) -> - child.afterEvaluate { - child.tasks.named("copyNonXmlValueResourcesForCommonMain") { dependsOn(downloadFiles) } - } -} diff --git a/font-symbols/consumer-rules.pro b/font-symbols/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-symbols/outlined/build.gradle.kts b/font-symbols/outlined/build.gradle.kts deleted file mode 100644 index 8410c36f..00000000 --- a/font-symbols/outlined/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.symbols-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-symbols")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-symbols/outlined/consumer-rules.pro b/font-symbols/outlined/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-symbols/outlined/proguard-rules.pro b/font-symbols/outlined/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-symbols/outlined/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-symbols/proguard-rules.pro b/font-symbols/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-symbols/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-symbols/rounded/build.gradle.kts b/font-symbols/rounded/build.gradle.kts deleted file mode 100644 index 8410c36f..00000000 --- a/font-symbols/rounded/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.symbols-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-symbols")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-symbols/rounded/consumer-rules.pro b/font-symbols/rounded/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-symbols/rounded/proguard-rules.pro b/font-symbols/rounded/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-symbols/rounded/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-symbols/sharp/build.gradle.kts b/font-symbols/sharp/build.gradle.kts deleted file mode 100644 index 8410c36f..00000000 --- a/font-symbols/sharp/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - unversioned(libs.plugins.android.library) - unversioned(libs.plugins.jetbrains.dokka) - id("fonticons.multiplatform-structure") - id("fonticons.publish") - id("fonticons.symbols-variant") -} - -kotlin { - sourceSets { - commonMain { - dependencies { - api(project(":font-symbols")) - implementation(compose.components.resources) - } - } - } -} diff --git a/font-symbols/sharp/consumer-rules.pro b/font-symbols/sharp/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/font-symbols/sharp/proguard-rules.pro b/font-symbols/sharp/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/font-symbols/sharp/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/font-symbols/src/commonMain/kotlin/dev/tclement/fonticons/symbols/MaterialSymbols.kt b/font-symbols/src/commonMain/kotlin/dev/tclement/fonticons/symbols/MaterialSymbols.kt deleted file mode 100644 index 1772a065..00000000 --- a/font-symbols/src/commonMain/kotlin/dev/tclement/fonticons/symbols/MaterialSymbols.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 T. Clément (@tclement0922) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.tclement.fonticons.symbols - -/** - * [Material Symbols icons](https://m3.material.io/styles/icons/overview) as seen on [Google Fonts](https://fonts.google.com/icons). - * - * A Material Symbols icon can be called like this: `MaterialSymbols.IconName` - * - * Those icons are Unicode [Char]s, so they're incompatible with the official Icon composable. - */ -public object MaterialSymbols diff --git a/glance/build.gradle.kts b/glance/build.gradle.kts index 869d0ca7..49f0a207 100644 --- a/glance/build.gradle.kts +++ b/glance/build.gradle.kts @@ -31,7 +31,7 @@ kotlin { android { namespace = "dev.tclement.fonticons.glance" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 21 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9194b8e5..5687e448 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,14 +5,11 @@ androidx-core = "1.15.0" androidx-glance = "1.1.1" androidx-lifecycle-runtime = "2.8.7" fasterxml-jackson = "2.12.7" -google-guava = "33.4.0-jre" jetbrains-compose = "1.7.3" jetbrains-navigation-compose = "2.8.0-alpha12" kotlin = "2.1.0" -kotlinx-serialization = "1.8.0" kotlinx-coroutines = "1.10.1" dokka = "2.0.0" -squareup-kotlinpoet = "1.18.1" undercouch-download = "5.6.0" vanniktech-publish = "0.30.0" @@ -23,15 +20,12 @@ androidx-glance = { group = "androidx.glance", name = "glance", version.ref = "a androidx-glance-appwidget = { group = "androidx.glance", name = "glance-appwidget", version.ref = "androidx-glance" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle-runtime" } fasterxml-jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "fasterxml-jackson" } -google-guava = { group = "com.google.guava", name = "guava", version.ref = "google-guava" } jetbrains-dokka-core = { group = "org.jetbrains.dokka", name = "dokka-core", version.ref = "dokka" } jetbrains-dokka-base = { group = "org.jetbrains.dokka", name = "dokka-base", version.ref = "dokka" } jetbrains-dokka-allmodulespage = { group = "org.jetbrains.dokka", name = "all-modules-page-plugin", version.ref = "dokka" } jetbrains-dokka-templating = { group = "org.jetbrains.dokka", name = "templating-plugin", version.ref = "dokka" } jetbrains-navigation-compose = { group = "org.jetbrains.androidx.navigation", name = "navigation-compose", version.ref = "jetbrains-navigation-compose" } -kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization" } kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } -squareup-kotlinpoet = { group = "com.squareup", name = "kotlinpoet", version.ref = "squareup-kotlinpoet" } [plugins] android-application = { id = "com.android.application", version.ref = "android-gradle" } @@ -41,6 +35,5 @@ jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } undercouch-download = { id = "de.undercouch.download", version.ref = "undercouch-download" } vanniktech-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-publish" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 770e105f..52030894 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -37,21 +37,7 @@ rootProject.name = "ComposeFontIcons" include( ":core", ":glance", - ":font-symbols", - ":font-symbols:outlined", - ":font-symbols:rounded", - ":font-symbols:sharp", - ":font-fa", - ":font-fa:brands", - ":font-fa:regular", - ":font-fa:solid", ":testapp", ":dokka-vitepress-renderer", ":dokka-vitepress-renderer:multimodule" ) - -rootProject.children.filter { it.name.startsWith("font-") }.forEach { parent -> - parent.children.forEach { child -> - child.name = parent.name + "-" + child.name // changing their names for maven artifact ids - } -} diff --git a/testapp/build.gradle.kts b/testapp/build.gradle.kts index 9e73c56a..c9748544 100644 --- a/testapp/build.gradle.kts +++ b/testapp/build.gradle.kts @@ -14,31 +14,33 @@ * limitations under the License. */ +import de.undercouch.gradle.tasks.download.Download +import org.gradle.kotlin.dsl.support.uppercaseFirstChar import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { unversioned(libs.plugins.android.application) - unversioned(libs.plugins.undercouch.download) + alias(libs.plugins.undercouch.download) id("fonticons.multiplatform-structure") } kotlin { androidTarget { } - sequence { - yield(iosX64()) - yield(iosArm64()) - yield(iosSimulatorArm64()) - yield(macosArm64()) - yield(macosX64()) - // yield(tvosX64()) - // yield(tvosArm64()) - // yield(tvosSimulatorArm64()) - // yield(watchosX64()) - // yield(watchosArm64()) - // yield(watchosDeviceArm64()) - // yield(watchosSimulatorArm64()) - }.forEach { target -> + setOf( + iosX64(), + iosArm64(), + iosSimulatorArm64(), + macosArm64(), + macosX64(), + // tvosX64(), + // tvosArm64(), + // tvosSimulatorArm64(), + // watchosX64(), + // watchosArm64(), + // watchosDeviceArm64(), + // watchosSimulatorArm64(), + ).forEach { target -> target.binaries.framework { binaryOption("bundleId", "shared") binaryOption("bundleVersion", "1") @@ -51,10 +53,6 @@ kotlin { commonMain { dependencies { implementation(project(":core")) - implementation(project(":font-symbols")) - implementation(project(":font-symbols:font-symbols-rounded")) - implementation(project(":font-fa:font-fa-regular")) - implementation(project(":font-fa:font-fa-solid")) implementation(compose.ui) implementation(compose.foundation) implementation(compose.material3) @@ -82,8 +80,6 @@ kotlin { } } } - - } compose.resources { @@ -92,12 +88,12 @@ compose.resources { android { namespace = "dev.tclement.fonticons.testapp" - compileSdk = 34 + compileSdk = 35 defaultConfig { applicationId = "dev.tclement.fonticons.testappp" minSdk = 24 - targetSdk = 34 + targetSdk = 35 versionCode = 1 versionName = "1.0" @@ -125,3 +121,41 @@ compose.desktop { } } } + +// Should be run at least once before running the app +val downloadFonts by tasks.registering(Download::class) { + fun ms(name: String) = + "https://github.com/google/material-design-icons/raw/${ + properties["FONT_SYMBOLS_REVISION"] + }/variablefont/MaterialSymbols${ + name.uppercaseFirstChar() + }%5BFILL%2CGRAD%2Copsz%2Cwght%5D.ttf" to "material_symbols_${name}" + + fun fa(name: String) = + "https://github.com/FortAwesome/Font-Awesome/raw/${ + properties["FONT_FA_REVISION"] + }/otfs/Font%20Awesome%206%20${name}.otf" to "font_awesome_${ + name.replace('-', '_').lowercase() + }" + + val fonts = mapOf( + ms("outlined"), + ms("rounded"), + ms("sharp"), + fa("Brands-Regular-400"), + fa("Free-Regular-400"), + fa("Free-Solid-900") + ) + + src(fonts.keys) + dest(layout.projectDirectory) + eachFile { + val url = sourceURL.toExternalForm() + path = "build/composeResources/font/${fonts[url]}.${url.substringAfterLast(".")}" + } + overwrite(false) +} + +compose.resources { + customDirectory("commonMain", project.layout.buildDirectory.dir("composeResources")) +} diff --git a/testapp/src/androidMain/kotlin/dev/tclement/fonticons/testapp/widget/TestWidget.kt b/testapp/src/androidMain/kotlin/dev/tclement/fonticons/testapp/widget/TestWidget.kt index a3e2da77..0fcbb017 100644 --- a/testapp/src/androidMain/kotlin/dev/tclement/fonticons/testapp/widget/TestWidget.kt +++ b/testapp/src/androidMain/kotlin/dev/tclement/fonticons/testapp/widget/TestWidget.kt @@ -18,6 +18,7 @@ package dev.tclement.fonticons.testapp.widget import android.content.Context import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.FontWeight import androidx.glance.GlanceId import androidx.glance.GlanceModifier import androidx.glance.appwidget.GlanceAppWidget @@ -27,17 +28,28 @@ import androidx.glance.appwidget.provideContent import androidx.glance.color.ColorProvider import androidx.glance.layout.Alignment import androidx.glance.layout.Box +import dev.tclement.fonticons.ExperimentalFontIconsApi import dev.tclement.fonticons.glance.FontIcon import dev.tclement.fonticons.glance.ProvideGlanceIconParameters -import dev.tclement.fonticons.symbols.AccountCircle -import dev.tclement.fonticons.symbols.MaterialSymbols -import dev.tclement.fonticons.symbols.rounded.rememberRoundedMaterialSymbolsFont +import dev.tclement.fonticons.rememberVariableIconFont +import dev.tclement.fonticons.testapp.res.Res +import dev.tclement.fonticons.testapp.res.material_symbols_rounded class TestWidget : GlanceAppWidget() { + @OptIn(ExperimentalFontIconsApi::class) override suspend fun provideGlance(context: Context, id: GlanceId) { provideContent { ProvideGlanceIconParameters( - iconFont = rememberRoundedMaterialSymbolsFont(), + iconFont = rememberVariableIconFont( + fontResource = Res.font.material_symbols_rounded, + weights = arrayOf( + FontWeight.W300, + FontWeight.W400, + FontWeight.W500, + FontWeight.W600, + FontWeight.W700, + ) + ), tint = ColorProvider(Color.Black, Color.White) ) { Box( @@ -45,7 +57,7 @@ class TestWidget : GlanceAppWidget() { contentAlignment = Alignment.Center ) { FontIcon( - icon = MaterialSymbols.AccountCircle, + iconName = "account_circle", contentDescription = null ) } diff --git a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/Fonts.kt b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/Fonts.kt index b25c56c3..2523cc75 100644 --- a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/Fonts.kt +++ b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/Fonts.kt @@ -20,14 +20,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontVariation import androidx.compose.ui.text.font.FontWeight import dev.tclement.fonticons.IconFont -import dev.tclement.fonticons.fa.regular.resources.fontawesome_regular -import dev.tclement.fonticons.fa.solid.resources.fontawesome_solid import dev.tclement.fonticons.rememberStaticIconFont import dev.tclement.fonticons.rememberVariableIconFont -import dev.tclement.fonticons.symbols.rounded.resources.material_symbols_rounded -import dev.tclement.fonticons.fa.regular.resources.Res as FARegularRes -import dev.tclement.fonticons.fa.solid.resources.Res as FASolidRes -import dev.tclement.fonticons.symbols.rounded.resources.Res as RoundedSymbolsRes +import dev.tclement.fonticons.testapp.res.Res +import dev.tclement.fonticons.testapp.res.font_awesome_free_regular_400 +import dev.tclement.fonticons.testapp.res.font_awesome_free_solid_900 +import dev.tclement.fonticons.testapp.res.material_symbols_rounded @Composable fun rememberMaterialSymbolsFont( @@ -36,7 +34,7 @@ fun rememberMaterialSymbolsFont( manualOpsz: Boolean = false, opsz: Float = 24f ): IconFont = rememberVariableIconFont( - fontResource = RoundedSymbolsRes.font.material_symbols_rounded, + fontResource = Res.font.material_symbols_rounded, weights = arrayOf( FontWeight.W100, FontWeight.W200, @@ -57,6 +55,6 @@ fun rememberMaterialSymbolsFont( @Composable fun rememberFontAwesomeFont(solid: Boolean = false) = rememberStaticIconFont( - fontResource = if (solid) FASolidRes.font.fontawesome_solid else FARegularRes.font.fontawesome_regular, + fontResource = if (solid) Res.font.font_awesome_free_solid_900 else Res.font.font_awesome_free_regular_400, fontFeatureSettings = "liga" ) diff --git a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/MainContent.kt b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/MainContent.kt index 2e6b32b2..0e3b4449 100644 --- a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/MainContent.kt +++ b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/MainContent.kt @@ -28,9 +28,6 @@ import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import dev.tclement.fonticons.FontIcon import dev.tclement.fonticons.LocalIconTintProvider -import dev.tclement.fonticons.fa.FontAwesome -import dev.tclement.fonticons.symbols.MaterialSymbols -import dev.tclement.fonticons.symbols.Star import dev.tclement.fonticons.testapp.screen.FontAwesomeScreen import dev.tclement.fonticons.testapp.screen.MaterialSymbolsScreen import dev.tclement.fonticons.testapp.ui.theme.MaterialSymbolsExperimentsTheme @@ -60,7 +57,7 @@ fun MainContent() { }, icon = { FontIcon( - icon = MaterialSymbols.Star, + iconName = "star", contentDescription = "Material Symbols", iconFont = rememberMaterialSymbolsFont() ) @@ -76,7 +73,7 @@ fun MainContent() { }, icon = { FontIcon( - icon = FontAwesome.Regular.FontAwesome, + iconName = "font-awesome", contentDescription = "FontAwesome", iconFont = rememberFontAwesomeFont() ) diff --git a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/screen/MaterialSymbolsScreen.kt b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/screen/MaterialSymbolsScreen.kt index 6c930161..4503e8a3 100644 --- a/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/screen/MaterialSymbolsScreen.kt +++ b/testapp/src/commonMain/kotlin/dev/tclement/fonticons/testapp/screen/MaterialSymbolsScreen.kt @@ -26,7 +26,9 @@ import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha -import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.* +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import dev.tclement.fonticons.FontIcon @@ -34,13 +36,94 @@ import dev.tclement.fonticons.ProvideIconParameters import dev.tclement.fonticons.testapp.additionalPreviews import dev.tclement.fonticons.testapp.rememberMaterialSymbolsFont import dev.tclement.fonticons.testapp.res.Res -import dev.tclement.fonticons.testapp.res.account_circle_24px import org.jetbrains.compose.resources.painterResource +private val accountCircle: ImageVector = ImageVector.Builder( + name = "Account_circle", + defaultWidth = 24.dp, + defaultHeight = 24.dp, + viewportWidth = 960f, + viewportHeight = 960f +).apply { + path( + fill = SolidColor(Color.Black), + fillAlpha = 1.0f, + stroke = null, + strokeAlpha = 1.0f, + strokeLineWidth = 1.0f, + strokeLineCap = StrokeCap.Butt, + strokeLineJoin = StrokeJoin.Miter, + strokeLineMiter = 1.0f, + pathFillType = PathFillType.NonZero + ) { + moveTo(234f, 684f) + quadToRelative(51f, -39f, 114f, -61.5f) + reflectiveQuadTo(480f, 600f) + reflectiveQuadToRelative(132f, 22.5f) + reflectiveQuadTo(726f, 684f) + quadToRelative(35f, -41f, 54.5f, -93f) + reflectiveQuadTo(800f, 480f) + quadToRelative(0f, -133f, -93.5f, -226.5f) + reflectiveQuadTo(480f, 160f) + reflectiveQuadToRelative(-226.5f, 93.5f) + reflectiveQuadTo(160f, 480f) + quadToRelative(0f, 59f, 19.5f, 111f) + reflectiveQuadToRelative(54.5f, 93f) + moveToRelative(246f, -164f) + quadToRelative(-59f, 0f, -99.5f, -40.5f) + reflectiveQuadTo(340f, 380f) + reflectiveQuadToRelative(40.5f, -99.5f) + reflectiveQuadTo(480f, 240f) + reflectiveQuadToRelative(99.5f, 40.5f) + reflectiveQuadTo(620f, 380f) + reflectiveQuadToRelative(-40.5f, 99.5f) + reflectiveQuadTo(480f, 520f) + moveToRelative(0f, 360f) + quadToRelative(-83f, 0f, -156f, -31.5f) + reflectiveQuadTo(197f, 763f) + reflectiveQuadToRelative(-85.5f, -127f) + reflectiveQuadTo(80f, 480f) + reflectiveQuadToRelative(31.5f, -156f) + reflectiveQuadTo(197f, 197f) + reflectiveQuadToRelative(127f, -85.5f) + reflectiveQuadTo(480f, 80f) + reflectiveQuadToRelative(156f, 31.5f) + reflectiveQuadTo(763f, 197f) + reflectiveQuadToRelative(85.5f, 127f) + reflectiveQuadTo(880f, 480f) + reflectiveQuadToRelative(-31.5f, 156f) + reflectiveQuadTo(763f, 763f) + reflectiveQuadToRelative(-127f, 85.5f) + reflectiveQuadTo(480f, 880f) + moveToRelative(0f, -80f) + quadToRelative(53f, 0f, 100f, -15.5f) + reflectiveQuadToRelative(86f, -44.5f) + quadToRelative(-39f, -29f, -86f, -44.5f) + reflectiveQuadTo(480f, 680f) + reflectiveQuadToRelative(-100f, 15.5f) + reflectiveQuadToRelative(-86f, 44.5f) + quadToRelative(39f, 29f, 86f, 44.5f) + reflectiveQuadTo(480f, 800f) + moveToRelative(0f, -360f) + quadToRelative(26f, 0f, 43f, -17f) + reflectiveQuadToRelative(17f, -43f) + reflectiveQuadToRelative(-17f, -43f) + reflectiveQuadToRelative(-43f, -17f) + reflectiveQuadToRelative(-43f, 17f) + reflectiveQuadToRelative(-17f, 43f) + reflectiveQuadToRelative(17f, 43f) + reflectiveQuadToRelative(43f, 17f) + moveToRelative(0f, 300f) + } +}.build() + +private var _Account_circle: ImageVector? = null + + @OptIn(ExperimentalLayoutApi::class) @Composable fun MaterialSymbolsScreen() { - var weight by remember { mutableIntStateOf(300) } + var weight by remember { mutableIntStateOf(400) } var grade by remember { mutableIntStateOf(0) } var manualOpsz by remember { mutableStateOf(true) } var size by remember { mutableIntStateOf(24) } @@ -90,7 +173,7 @@ fun MaterialSymbolsScreen() { Box { if (iconName == "account_circle") Icon( - painter = painterResource(Res.drawable.account_circle_24px), + imageVector = accountCircle, contentDescription = null, modifier = Modifier .size(iconSize) @@ -121,7 +204,7 @@ fun MaterialSymbolsScreen() { ) { if (iconName == "account_circle") Icon( - painter = painterResource(Res.drawable.account_circle_24px), + imageVector = accountCircle, contentDescription = null, modifier = Modifier .size(iconSize) @@ -139,7 +222,7 @@ fun MaterialSymbolsScreen() { ) { if (iconName == "account_circle") Icon( - painter = painterResource(Res.drawable.account_circle_24px), + imageVector = accountCircle, contentDescription = null, modifier = Modifier .size(iconSize)