From 7ce86a615b13fe206a15960a18321067bf860a91 Mon Sep 17 00:00:00 2001 From: skydoves Date: Sun, 1 Oct 2023 18:23:05 +0900 Subject: [PATCH 1/2] Migrate to kts gradle scripts --- .github/workflows/android.yml | 6 +- app/build.gradle | 65 ------------------ app/build.gradle.kts | 55 +++++++++++++++ app/src/main/AndroidManifest.xml | 17 ++++- .../colorpickercomposedemo/MainActivity.kt | 3 +- .../colorpickercomposedemo/MainScreen.kt | 3 +- .../colorpickercomposedemo/PhotoPickerIcon.kt | 3 +- .../HsvColorPickerColoredSelectorScreen.kt | 3 +- .../screens/ImageColorPickerScreen.kt | 3 +- .../drawable-v24/ic_launcher_foreground.xml | 18 ++++- app/src/main/res/drawable/ic_gallery.xml | 21 +++++- .../res/drawable/ic_launcher_background.xml | 15 ++++ app/src/main/res/drawable/image_24px.xml | 16 +++++ app/src/main/res/drawable/palette_24px.xml | 16 +++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 17 ++++- .../mipmap-anydpi-v26/ic_launcher_round.xml | 17 ++++- app/src/main/res/values-night/themes.xml | 18 ++++- app/src/main/res/values/colors.xml | 17 ++++- app/src/main/res/values/strings.xml | 18 ++++- app/src/main/res/values/themes.xml | 18 ++++- build.gradle | 26 ------- build.gradle.kts | 40 +++++++++++ .../colorpicker/compose/Dependencies.kt | 49 ------------- colorpicker-compose/build.gradle | 68 ------------------- colorpicker-compose/build.gradle.kts | 62 +++++++++++++++++ .../src/main/AndroidManifest.xml | 17 ++++- .../colorpicker/compose/AlphaSlider.kt | 3 +- .../skydoves/colorpicker/compose/AlphaTile.kt | 3 +- .../colorpicker/compose/AlphaTileDrawable.kt | 3 +- .../colorpicker/compose/BitmapCalculator.kt | 3 +- .../colorpicker/compose/BrightnessSlider.kt | 3 +- .../colorpicker/compose/ColorEnvelope.kt | 3 +- .../colorpicker/compose/ColorExtensions.kt | 3 +- .../compose/ColorPickerController.kt | 3 +- .../colorpicker/compose/DefaultColors.kt | 3 +- .../compose/DrawScopeExtensions.kt | 3 +- .../colorpicker/compose/HsvBitmapDrawable.kt | 3 +- .../colorpicker/compose/HsvColorPicker.kt | 3 +- .../colorpicker/compose/ImageColorPicker.kt | 3 +- .../compose/PaletteContentScale.kt | 3 +- .../colorpicker/compose/PointMapper.kt | 3 +- gradle/libs.versions.toml | 53 +++++++++++++++ settings.gradle | 17 ----- settings.gradle.kts | 17 +++++ spotless.gradle | 11 --- spotless.license.kt => spotless/copyright.kt | 5 +- spotless/copyright.kts | 15 ++++ spotless/copyright.xml | 16 +++++ 48 files changed, 496 insertions(+), 294 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/com/github/skydoves/colorpicker/compose/Dependencies.kt delete mode 100644 colorpicker-compose/build.gradle create mode 100644 colorpicker-compose/build.gradle.kts create mode 100644 gradle/libs.versions.toml delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts delete mode 100644 spotless.gradle rename spotless.license.kt => spotless/copyright.kt (90%) create mode 100644 spotless/copyright.kts create mode 100644 spotless/copyright.xml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 437c10b..d56ac86 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -17,7 +17,7 @@ jobs: uses: actions/setup-java@v3.5.1 with: distribution: adopt - java-version: 11 + java-version: 17 - name: spotless run: ./gradlew spotlessCheck @@ -31,7 +31,7 @@ jobs: uses: actions/setup-java@v3.5.1 with: distribution: adopt - java-version: 11 + java-version: 17 - name: API check run: ./gradlew apiCheck @@ -44,7 +44,7 @@ jobs: uses: actions/setup-java@v3.5.1 with: distribution: adopt - java-version: 11 + java-version: 17 - name: Cache Gradle and wrapper uses: actions/cache@v3 diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 12d904e..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -import com.github.skydoves.colorpicker.compose.Configuration -import com.github.skydoves.colorpicker.compose.Dependencies -import com.github.skydoves.colorpicker.compose.Versions - -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - compileSdk Configuration.compileSdk - namespace "com.github.skydoves.colorpickercomposedemo" - defaultConfig { - applicationId "com.github.skydoves.colorpickercomposedemo" - minSdkVersion Configuration.minSdk - targetSdkVersion Configuration.targetSdk - versionCode Configuration.versionCode - versionName Configuration.versionName - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - composeOptions { - kotlinCompilerExtensionVersion Versions.COMPOSE_COMPILER - } - - buildFeatures { - compose true - } - - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } - - lintOptions { - abortOnError false - } -} - -dependencies { - implementation project(":colorpicker-compose") - - implementation Dependencies.material - - implementation platform(Dependencies.composeBom) - implementation Dependencies.composeUI - implementation Dependencies.composeMaterial - implementation Dependencies.composeRuntime - implementation Dependencies.composeTooling - implementation Dependencies.composeActivity - implementation Dependencies.composeNavigation - - implementation Dependencies.photoPicker -} - -apply from: "$rootDir/spotless.gradle" \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..0c34b71 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,55 @@ +import com.github.skydoves.colorpicker.compose.Configuration + +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + id(libs.plugins.android.application.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.baseline.profile.get().pluginId) +} +android { + namespace = "com.github.skydoves.colorpickercomposedemo" + compileSdk = Configuration.compileSdk + defaultConfig { + applicationId = "com.github.skydoves.colorpickercomposedemo" + minSdk = Configuration.minSdk + targetSdk = Configuration.targetSdk + versionCode = Configuration.versionCode + versionName = Configuration.versionName + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = libs.versions.jvmTarget.get() + } + + buildFeatures { + compose = true + buildConfig = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get() + } + + lint { + abortOnError = false + } +} + +dependencies { + implementation(project(":colorpicker-compose")) + + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.tooling) + implementation(libs.androidx.compose.material) + implementation(libs.androidx.compose.foundation) + implementation(libs.androidx.compose.runtime) + + implementation(libs.photo.picker) +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 64a614f..d15fbfd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,4 +1,19 @@ + @@ -20,4 +35,4 @@ - \ No newline at end of file + diff --git a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainActivity.kt b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainActivity.kt index 2c88dc9..e16d191 100644 --- a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainActivity.kt +++ b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpickercomposedemo import android.os.Bundle diff --git a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainScreen.kt b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainScreen.kt index b1f0055..803a15d 100644 --- a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainScreen.kt +++ b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/MainScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpickercomposedemo import androidx.annotation.DrawableRes diff --git a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/PhotoPickerIcon.kt b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/PhotoPickerIcon.kt index c794d40..2d91e37 100644 --- a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/PhotoPickerIcon.kt +++ b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/PhotoPickerIcon.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpickercomposedemo import android.annotation.SuppressLint diff --git a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/HsvColorPickerColoredSelectorScreen.kt b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/HsvColorPickerColoredSelectorScreen.kt index 21d2a2e..5e7b2ec 100644 --- a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/HsvColorPickerColoredSelectorScreen.kt +++ b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/HsvColorPickerColoredSelectorScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpickercomposedemo.screens import androidx.compose.foundation.layout.Box diff --git a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/ImageColorPickerScreen.kt b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/ImageColorPickerScreen.kt index f3ab27a..a2b2aa2 100644 --- a/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/ImageColorPickerScreen.kt +++ b/app/src/main/kotlin/com/github/skydoves/colorpickercomposedemo/screens/ImageColorPickerScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpickercomposedemo.screens import androidx.compose.foundation.layout.Column diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2b068d1..dab65d1 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,3 +1,19 @@ + + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/ic_gallery.xml b/app/src/main/res/drawable/ic_gallery.xml index aec96b2..a81571e 100644 --- a/app/src/main/res/drawable/ic_gallery.xml +++ b/app/src/main/res/drawable/ic_gallery.xml @@ -1,6 +1,21 @@ - + + - + - + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 07d5da9..51e9ae6 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,4 +1,19 @@ + + + + - \ No newline at end of file + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cf..84fba1c 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,20 @@ + - \ No newline at end of file + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 70ab1c7..79856dc 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,3 +1,19 @@ + + - \ No newline at end of file + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..9faa29a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,4 +1,19 @@ + #FFBB86FC #FF6200EE @@ -7,4 +22,4 @@ #FF018786 #FF000000 #FFFFFFFF - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eea3c5b..c01525f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,19 @@ + + ColorPickerCompose - \ No newline at end of file + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index c4ca9ad..61df10a 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,3 +1,19 @@ + + - \ No newline at end of file + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 62acef4..0000000 --- a/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import com.github.skydoves.colorpicker.compose.Dependencies - -apply plugin: 'io.github.gradle-nexus.publish-plugin' -apply plugin: 'org.jetbrains.dokka' - -buildscript { - repositories { - google() - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath Dependencies.androidGradlePlugin - classpath Dependencies.kotlinGradlePlugin - classpath Dependencies.spotlessGradlePlugin - classpath Dependencies.gradleNexusPublishPlugin - classpath Dependencies.dokka - classpath Dependencies.kotlinBinaryValidator - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -apply from: "${rootDir}/scripts/publish-root.gradle" \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..672e67d --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,40 @@ +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.baseline.profile) apply false + alias(libs.plugins.nexus.plugin) + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.kotlin.binary.compatibility) +} + +subprojects { + apply(plugin = rootProject.libs.plugins.spotless.get().pluginId) + + configure { + kotlin { + target("**/*.kt") + targetExclude("$buildDir/**/*.kt") + ktlint().editorConfigOverride( + mapOf( + "indent_size" to "2", + "continuation_indent_size" to "2" + ) + ) + licenseHeaderFile(rootProject.file("spotless/copyright.kt")) + trimTrailingWhitespace() + endWithNewline() + } + format("xml") { + target("**/*.xml") + targetExclude("**/build/**/*.xml") + // Look for the first XML tag that isn't a comment ( + diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaSlider.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaSlider.kt index 7cc4cda..f854ab9 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaSlider.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaSlider.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.annotation.FloatRange diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTile.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTile.kt index 39602ae..8a68abc 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTile.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTile.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.compose.foundation.Canvas diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTileDrawable.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTileDrawable.kt index 47a0fe3..96a5e3d 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTileDrawable.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/AlphaTileDrawable.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.BitmapShader diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt index 3424f20..cc107bc 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.Bitmap diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BrightnessSlider.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BrightnessSlider.kt index 47ec811..caf4cdc 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BrightnessSlider.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BrightnessSlider.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.annotation.FloatRange diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorEnvelope.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorEnvelope.kt index 9783eaa..1f72f66 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorEnvelope.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorEnvelope.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.compose.runtime.Immutable diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorExtensions.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorExtensions.kt index 0463995..7a5bdc8 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorExtensions.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.compose.ui.graphics.Color diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt index faa9fcd..74facbb 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ColorPickerController.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.Bitmap diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DefaultColors.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DefaultColors.kt index 323ea97..2633d11 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DefaultColors.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DefaultColors.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import androidx.compose.ui.graphics.Color diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DrawScopeExtensions.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DrawScopeExtensions.kt index 6ea328b..d5ee3e2 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DrawScopeExtensions.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/DrawScopeExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.PointF diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvBitmapDrawable.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvBitmapDrawable.kt index cb0c213..3cbd5fa 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvBitmapDrawable.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvBitmapDrawable.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.content.res.Resources diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvColorPicker.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvColorPicker.kt index 175ebb7..44094e5 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvColorPicker.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/HsvColorPicker.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.Matrix diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ImageColorPicker.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ImageColorPicker.kt index 82fc881..6b438f3 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ImageColorPicker.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/ImageColorPicker.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.Matrix diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PaletteContentScale.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PaletteContentScale.kt index 9efca58..57c9834 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PaletteContentScale.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PaletteContentScale.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose /** Represents a rule to apply to scale a source rectangle to be inscribed into a destination. */ diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PointMapper.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PointMapper.kt index 634386e..d11f09c 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PointMapper.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/PointMapper.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.skydoves.colorpicker.compose import android.graphics.PointF diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..b679057 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,53 @@ +[versions] +agp = "8.1.1" +dokka = "1.9.0" +nexusPlugin = "0.25.3" +kotlin = "1.9.10" +kotlinBinaryCompatibility = "0.13.2" +jvmTarget = "11" +androidxComposeBom = "2023.09.01" +androidxComposeCompiler = "1.5.3" +androidxActivity = "1.7.2" +androidxTest = "1.5.2" +androidxCore = "1.8.0" +androidxNavigation = "2.6.0" +photoPicker = "1.0.0-alpha06" +baselineProfiles = "1.3.1" +macroBenchmark = "1.2.0-rc01" +uiAutomator = "2.3.0-alpha04" +spotless = "6.21.0" +junit = "1.1.5" +espresso-core = "3.5.1" +androidxMacroBenchmark = "1.2.0-rc01" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +android-test = { id = "com.android.test", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +nexus-plugin = { id = "com.vanniktech.maven.publish", version.ref = "nexusPlugin" } +kotlin-binary-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinBinaryCompatibility" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +baseline-profile = { id = "androidx.baselineprofile", version.ref = "androidxMacroBenchmark" } + +[libraries] +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-material = { group = "androidx.compose.material", name = "material" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } +androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } +androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } +androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } +androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } +photo-picker = { group = "com.google.modernstorage", name = "modernstorage-photopicker", version.ref = "photoPicker" } + +# unit test +androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTest" } +androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "baselineProfiles" } +androidx-benchmark-macro = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "macroBenchmark" } +androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" } +junit = { group = "androidx.test.ext", name = "junit", version.ref = "junit" } +espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e6077e4..0000000 --- a/settings.gradle +++ /dev/null @@ -1,17 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} -rootProject.name = "ColorPickerComposeDemo" -include ':app' -include ':colorpicker-compose' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..433935c --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "ColorPickerComposeDemo" +include(":app") +include(":colorpicker-compose") diff --git a/spotless.gradle b/spotless.gradle deleted file mode 100644 index 6a05793..0000000 --- a/spotless.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply plugin: "com.diffplug.spotless" - -spotless { - kotlin { - target "**/*.kt" - ktlint().editorConfigOverride(['indent_size': '2', 'continuation_indent_size': '2']) - licenseHeaderFile "$rootDir/spotless.license.kt" - trimTrailingWhitespace() - endWithNewline() - } -} \ No newline at end of file diff --git a/spotless.license.kt b/spotless/copyright.kt similarity index 90% rename from spotless.license.kt rename to spotless/copyright.kt index 329d1f5..34ff5cc 100644 --- a/spotless.license.kt +++ b/spotless/copyright.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 skydoves (Jaewoong Eum) + * Designed and developed by 2022 skydoves (Jaewoong Eum) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,5 +12,4 @@ * 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. - */ - \ No newline at end of file + */ \ No newline at end of file diff --git a/spotless/copyright.kts b/spotless/copyright.kts new file mode 100644 index 0000000..34ff5cc --- /dev/null +++ b/spotless/copyright.kts @@ -0,0 +1,15 @@ +/* + * Designed and developed by 2022 skydoves (Jaewoong Eum) + * + * 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. + */ \ No newline at end of file diff --git a/spotless/copyright.xml b/spotless/copyright.xml new file mode 100644 index 0000000..0e36c43 --- /dev/null +++ b/spotless/copyright.xml @@ -0,0 +1,16 @@ + + From 57c458f559aac6c48ef4e5428d042114180f8bbb Mon Sep 17 00:00:00 2001 From: skydoves Date: Sun, 1 Oct 2023 18:27:42 +0900 Subject: [PATCH 2/2] Migrate maven publication scripts --- .github/workflows/publish-snapshot.yml | 30 +++++---- .github/workflows/publish.yml | 35 ++++++----- colorpicker-compose/build.gradle.kts | 18 +++++- gradle.properties | 29 ++++++++- scripts/publish-module.gradle | 85 -------------------------- scripts/publish-module.gradle.kts | 13 ++++ scripts/publish-root.gradle | 45 -------------- 7 files changed, 93 insertions(+), 162 deletions(-) delete mode 100644 scripts/publish-module.gradle create mode 100644 scripts/publish-module.gradle.kts delete mode 100644 scripts/publish-root.gradle diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 7425db2..a841f52 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -13,22 +13,26 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3.1.0 - - name: Set up JDK 11 + + - name: Set up JDK 17 uses: actions/setup-java@v3.5.1 with: - distribution: adopt - java-version: 11 + distribution: 'zulu' + java-version: 17 + + - name: Grant Permission to Execute Gradle + run: chmod +x gradlew + - name: Release build - run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan + run: ./gradlew assemble --scan -x :benchmark:pixel6api31Setup -x :benchmark:pixel6api31NonMinifiedReleaseAndroidTest -x :benchmark:collectNonMinifiedReleaseBaselineProfile + - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --scan + run: | + ./gradlew publishAllPublicationsToMavenCentral --no-daemon --no-parallel env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} SNAPSHOT: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d6623ef..7114759 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,30 +2,35 @@ name: Publish on: release: - types: [released] + types: [ released ] + workflow_dispatch: jobs: publish: - name: Release build and publish + name: Snapshot build and publish runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v3.1.0 - - name: Set up JDK 11 + + - name: Set up JDK 17 uses: actions/setup-java@v3.5.1 with: - distribution: adopt - java-version: 11 + distribution: 'zulu' + java-version: 17 + + - name: Grant Permission to Execute Gradle + run: chmod +x gradlew + - name: Release build - run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan + run: ./gradlew assemble --scan -x :benchmark:pixel6api31Setup -x :benchmark:pixel6api31NonMinifiedReleaseAndroidTest -x :benchmark:collectNonMinifiedReleaseBaselineProfile + - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --scan + run: | + ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} diff --git a/colorpicker-compose/build.gradle.kts b/colorpicker-compose/build.gradle.kts index d9e982a..a49f5cf 100644 --- a/colorpicker-compose/build.gradle.kts +++ b/colorpicker-compose/build.gradle.kts @@ -9,6 +9,22 @@ plugins { id(libs.plugins.baseline.profile.get().pluginId) } +apply(from = "${rootDir}/scripts/publish-module.gradle.kts") + +mavenPublishing { + val artifactId = "colorpicker-compose" + coordinates( + Configuration.artifactGroup, + artifactId, + rootProject.extra.get("libVersion").toString() + ) + + pom { + name.set(artifactId) + description.set("Jetpack Compose color picker for getting colors from any images by tapping on the desired color.") + } +} + android { compileSdk = Configuration.compileSdk namespace = "com.github.skydoves.colorpicker.compose" @@ -33,8 +49,6 @@ android { kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get() } - resourcePrefix = "snitcher" - lint { abortOnError = false } diff --git a/gradle.properties b/gradle.properties index cd0519b..2024bfc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true # AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app"s APK +# Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Kotlin code style for this project: "official" or "obsolete": @@ -20,4 +20,29 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +android.suppressUnsupportedCompileSdk=34 + +# Required to publish to Nexus (see https://github.com/gradle/gradle/issues/11308) +systemProp.org.gradle.internal.publish.checksums.insecure=true + +# Increase timeout when pushing to Sonatype (otherwise we get timeouts) +systemProp.org.gradle.internal.http.socketTimeout=120000 + +POM_URL=https://github.com/skydoves/colorpicker-compose/ +POM_SCM_URL=https://github.com/skydoves/colorpicker-compose/ +POM_SCM_CONNECTION=scm:git:git://github.com/skydoves/colorpicker-compose.git +POM_SCM_DEV_CONNECTION=scm:git:git://github.com/skydoves/colorpicker-compose.git + +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=skydoves +POM_DEVELOPER_NAME=Jaewoong Eum +POM_DEVELOPER_URL=https://github.com/skydoves/ +POM_DEVELOPER_EMAIL=skydoves2@gmail.com + +SONATYPE_HOST=DEFAULT +RELEASE_SIGNING_ENABLED=true +SONATYPE_AUTOMATIC_RELEASE=true \ No newline at end of file diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle deleted file mode 100644 index 7f7bb63..0000000 --- a/scripts/publish-module.gradle +++ /dev/null @@ -1,85 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' -apply plugin: 'org.jetbrains.dokka' - -task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - if (project.plugins.findPlugin("com.android.library")) { - from android.sourceSets.main.java.srcDirs - from android.sourceSets.main.kotlin.srcDirs - } else { - from sourceSets.main.java.srcDirs - from sourceSets.main.kotlin.srcDirs - } -} - -tasks.withType(dokkaHtmlPartial.getClass()).configureEach { - pluginsMapConfiguration.set( - ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""] - ) -} - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - archiveClassifier.set('javadoc') - from dokkaJavadoc.outputDirectory -} - -artifacts { - archives androidSourcesJar - archives javadocJar -} - -group = PUBLISH_GROUP_ID -version = PUBLISH_VERSION - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - if (project.plugins.findPlugin("com.android.library")) { - from components.release - } else { - from components.java - } - - artifact androidSourcesJar - artifact javadocJar - - pom { - name = PUBLISH_ARTIFACT_ID - description = 'Jetpack Compose color picker for getting colors from any images by tapping on the desired color.' - url = 'https://github.com/skydoves/colorpicker-compose' - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id = 'skydoves' - name = 'Jaewoong Eum' - } - } - scm { - connection = 'scm:git:github.com/skydoves/colorpicker-compose.git' - developerConnection = 'scm:git:ssh://github.com/skydoves/colorpicker-compose.git' - url = 'https://github.com/skydoves/colorpicker-compose/tree/main' - } - } - } - } - } -} - -signing { - useInMemoryPgpKeys( - rootProject.ext["signing.keyId"], - rootProject.ext["signing.key"], - rootProject.ext["signing.password"], - ) - sign publishing.publications -} diff --git a/scripts/publish-module.gradle.kts b/scripts/publish-module.gradle.kts new file mode 100644 index 0000000..84ce571 --- /dev/null +++ b/scripts/publish-module.gradle.kts @@ -0,0 +1,13 @@ +import com.github.skydoves.colorpicker.compose.Configuration + +apply(plugin = "com.vanniktech.maven.publish") + +rootProject.extra.apply { + val snapshot = System.getenv("SNAPSHOT").toBoolean() + val libVersion = if (snapshot) { + Configuration.snapshotVersionName + } else { + Configuration.versionName + } + set("libVersion", libVersion) +} diff --git a/scripts/publish-root.gradle b/scripts/publish-root.gradle deleted file mode 100644 index 27680b1..0000000 --- a/scripts/publish-root.gradle +++ /dev/null @@ -1,45 +0,0 @@ -import com.github.skydoves.colorpicker.compose.Configuration - -// Create variables with empty default values -ext["ossrhUsername"] = '' -ext["ossrhPassword"] = '' -ext["sonatypeStagingProfileId"] = '' -ext["signing.keyId"] = '' -ext["signing.password"] = '' -ext["signing.key"] = '' -ext["snapshot"] = '' - -File secretPropsFile = project.rootProject.file('local.properties') -if (secretPropsFile.exists()) { - // Read local.properties file first if it exists - Properties p = new Properties() - new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } - p.each { name, value -> ext[name] = value } -} else { - // Use system environment variables - ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') - ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') - ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') - ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') - ext["signing.password"] = System.getenv('SIGNING_PASSWORD') - ext["signing.key"] = System.getenv('SIGNING_KEY') - ext["snapshot"] = System.getenv('SNAPSHOT') -} - -if (snapshot) { - ext["rootVersionName"] = Configuration.snapshotVersionName -} else { - ext["rootVersionName"] = Configuration.versionName -} - -// Set up Sonatype repository -nexusPublishing { - repositories { - sonatype { - stagingProfileId = sonatypeStagingProfileId - username = ossrhUsername - password = ossrhPassword - version = rootVersionName - } - } -}