Skip to content

Commit

Permalink
Merge pull request #14 from skydoves/migrate/maven-central
Browse files Browse the repository at this point in the history
Migrate to maven central publication and kts
  • Loading branch information
skydoves authored Jan 24, 2023
2 parents ebf02e8 + c6572c7 commit 6c99c56
Show file tree
Hide file tree
Showing 47 changed files with 452 additions and 320 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


<p align="center">
☔ Fluent expressions of Kotlin for handling single if-else statements, nullable, collections, and boolean.
☔ Fluent Kotlin expressions for handling single if-else statements, nullable, collections, and boolean.
</p>
<br>

Expand All @@ -19,7 +19,7 @@
## Download
[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/whatif.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22whatif%22)

☔ WhatIf has been downloaded in more than __70k__ Kotlin and Android projects all over the world! <br><br>
☔ WhatIf has been downloaded in more than __100k__ Kotlin and Android projects all over the world! <br><br>
![downloads](https://user-images.githubusercontent.com/24237865/101273131-2187a980-37d6-11eb-9000-e1cd10f87b0d.png)

### Gradle
Expand Down
34 changes: 0 additions & 34 deletions app/build.gradle

This file was deleted.

49 changes: 49 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.android.application.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
}

android {
compileSdk = Configuration.compileSdk

defaultConfig {
applicationId = "com.skydoves.whatifdemo"
minSdk = Configuration.minSdk
targetSdk = Configuration.targetSdk
versionCode = Configuration.versionCode
versionName = Configuration.versionName
}

buildFeatures {
compose = true
viewBinding = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}

packagingOptions {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}

lint {
abortOnError = false
}
}

dependencies {
implementation(project(":whatif"))
implementation(project(":whatif-android"))

implementation(libs.material)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.runtime)
implementation(libs.landscapist.glide)
}
26 changes: 1 addition & 25 deletions app/src/main/kotlin/com/skydoves/whatifdemo/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Designed and developed by 2019 skydoves (Jaewoong Eum)
* Designed and developed by 2019-2023 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.
Expand All @@ -16,14 +16,9 @@

package com.skydoves.whatifdemo

import android.graphics.Color
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.skydoves.balloon.Balloon
import com.skydoves.balloon.BalloonAnimation
import com.skydoves.balloon.showAlignTop
import com.skydoves.whatif.whatIf
import com.skydoves.whatif.whatIfMap
import com.skydoves.whatif.whatIfNotNull
Expand Down Expand Up @@ -80,25 +75,6 @@ class MainActivity : AppCompatActivity() {
"short"
}
)

// example6 : what-if check in the builder pattern.
val balloon = Balloon.Builder(this)
.setArrowSize(10)
.whatIf(nullableBoolean) { setTextColor(Color.YELLOW) }
.whatIf(nullableBoolean, { setText("Hello, whatIf") }, { setText("Good-Bye whatIf") })
.setWidthRatio(1.0f)
.setMargin(12)
.setPadding(12)
.setTextSize(15f)
.setArrowPosition(0.5f)
.setCornerRadius(4f)
.setAlpha(0.9f)
.setBackgroundColor(ContextCompat.getColor(baseContext, R.color.colorPrimary))
.setBalloonAnimation(BalloonAnimation.FADE)
.setLifecycleOwner(this@MainActivity)
.build()

binding.button.showAlignTop(balloon)
}

private fun log(log: String) {
Expand Down
33 changes: 0 additions & 33 deletions build.gradle

This file was deleted.

52 changes: 52 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@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.nexusPlugin)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinBinaryCompatibilityValidator)
}

apply(from ="${rootDir}/scripts/publish-root.gradle")

apiValidation {
ignoredProjects.addAll(listOf("app"))
}

subprojects {
if (name != "app") {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = libs.versions.jvmTarget.get()
kotlinOptions.freeCompilerArgs += listOf(
"-Xexplicit-api=strict",
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
)
}
}

apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
ktlint().setUseExperimental(true).editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2"
)
)
licenseHeaderFile(rootProject.file("spotless/spotless.license.kt"))
trimTrailingWhitespace()
endWithNewline()
}
format("kts") {
target("**/*.kts")
targetExclude("$buildDir/**/*.kts")
licenseHeaderFile(rootProject.file("spotless/spotless.license.kt"), "(^(?![\\/ ]\\*).*$)")
trimTrailingWhitespace()
endWithNewline()
}
}
}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/Configuration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
object Configuration {
const val compileSdk = 33
const val targetSdk = 33
const val minSdk = 21
const val majorVersion = 1
const val minorVersion = 1
const val patchVersion = 2
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 13
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "com.github.skydoves"
}
25 changes: 0 additions & 25 deletions dependencies.gradle

This file was deleted.

54 changes: 25 additions & 29 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#
# Copyright 2018 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.
Expand All @@ -14,35 +13,32 @@
# limitations under the License.
#

# Jvm environments
org.gradle.jvmargs=-Xmx4g

# AndroidX
android.useAndroidX=true

# Required to publish to Nexus
systemProp.org.gradle.internal.publish.checksums.insecure=true
# https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dlint.nullness.ignore-deprecated=true

# Increase timeout when pushing to Sonatype
systemProp.org.gradle.internal.http.connectionTimeout=120000
systemProp.org.gradle.internal.http.socketTimeout=120000
# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true

# Maven
GROUP=com.github.skydoves
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

VERSION_NAME=1.1.2-SNAPSHOT
# Configure only necessary projects, useful with multimodule projects
org.gradle.configureondemand=true

POM_DESCRIPTION=WhatIf is kotlin extensions for expressing a single if-else statement, nullable and boolean.

POM_URL=https://github.com/skydoves/whatif/
POM_SCM_URL=https://github.com/skydoves/whatif/
POM_SCM_CONNECTION=scm:git:git://github.com/skydoves/whatif.git
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/skydoves/whatif.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
# AndroidX Migration https://developer.android.com/jetpack/androidx/migrate
android.useAndroidX=true

POM_DEVELOPER_ID=skydoves
POM_DEVELOPER_NAME=Jaewoong Eum
POM_DEVELOPER_URL=https://github.com/skydoves/
# Removes uneccessary default build features
android.defaults.buildfeatures.aidl=false
android.defaults.buildfeatures.buildconfig=false
android.defaults.buildfeatures.renderscript=false
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false

# 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
# https://developer.android.com/studio/releases/gradle-plugin#4.1-nontransitive-r-class
android.nonTransitiveRClass=true
Loading

0 comments on commit 6c99c56

Please sign in to comment.