Skip to content

Commit 6c99c56

Browse files
authored
Merge pull request #14 from skydoves/migrate/maven-central
Migrate to maven central publication and kts
2 parents ebf02e8 + c6572c7 commit 6c99c56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+452
-320
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

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

@@ -19,7 +19,7 @@
1919
## Download
2020
[![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)
2121

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

2525
### Gradle

app/build.gradle

-34
This file was deleted.

app/build.gradle.kts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@Suppress("DSL_SCOPE_VIOLATION")
2+
plugins {
3+
id(libs.plugins.android.application.get().pluginId)
4+
id(libs.plugins.kotlin.android.get().pluginId)
5+
}
6+
7+
android {
8+
compileSdk = Configuration.compileSdk
9+
10+
defaultConfig {
11+
applicationId = "com.skydoves.whatifdemo"
12+
minSdk = Configuration.minSdk
13+
targetSdk = Configuration.targetSdk
14+
versionCode = Configuration.versionCode
15+
versionName = Configuration.versionName
16+
}
17+
18+
buildFeatures {
19+
compose = true
20+
viewBinding = true
21+
}
22+
23+
composeOptions {
24+
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
25+
}
26+
27+
packagingOptions {
28+
resources {
29+
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
30+
}
31+
}
32+
33+
lint {
34+
abortOnError = false
35+
}
36+
}
37+
38+
dependencies {
39+
implementation(project(":whatif"))
40+
implementation(project(":whatif-android"))
41+
42+
implementation(libs.material)
43+
implementation(libs.androidx.activity.compose)
44+
implementation(libs.androidx.compose.ui)
45+
implementation(libs.androidx.compose.material)
46+
implementation(libs.androidx.compose.foundation)
47+
implementation(libs.androidx.compose.runtime)
48+
implementation(libs.landscapist.glide)
49+
}

app/src/main/kotlin/com/skydoves/whatifdemo/MainActivity.kt

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Designed and developed by 2019 skydoves (Jaewoong Eum)
2+
* Designed and developed by 2019-2023 skydoves (Jaewoong Eum)
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,14 +16,9 @@
1616

1717
package com.skydoves.whatifdemo
1818

19-
import android.graphics.Color
2019
import android.os.Bundle
2120
import android.util.Log
2221
import androidx.appcompat.app.AppCompatActivity
23-
import androidx.core.content.ContextCompat
24-
import com.skydoves.balloon.Balloon
25-
import com.skydoves.balloon.BalloonAnimation
26-
import com.skydoves.balloon.showAlignTop
2722
import com.skydoves.whatif.whatIf
2823
import com.skydoves.whatif.whatIfMap
2924
import com.skydoves.whatif.whatIfNotNull
@@ -80,25 +75,6 @@ class MainActivity : AppCompatActivity() {
8075
"short"
8176
}
8277
)
83-
84-
// example6 : what-if check in the builder pattern.
85-
val balloon = Balloon.Builder(this)
86-
.setArrowSize(10)
87-
.whatIf(nullableBoolean) { setTextColor(Color.YELLOW) }
88-
.whatIf(nullableBoolean, { setText("Hello, whatIf") }, { setText("Good-Bye whatIf") })
89-
.setWidthRatio(1.0f)
90-
.setMargin(12)
91-
.setPadding(12)
92-
.setTextSize(15f)
93-
.setArrowPosition(0.5f)
94-
.setCornerRadius(4f)
95-
.setAlpha(0.9f)
96-
.setBackgroundColor(ContextCompat.getColor(baseContext, R.color.colorPrimary))
97-
.setBalloonAnimation(BalloonAnimation.FADE)
98-
.setLifecycleOwner(this@MainActivity)
99-
.build()
100-
101-
binding.button.showAlignTop(balloon)
10278
}
10379

10480
private fun log(log: String) {

build.gradle

-33
This file was deleted.

build.gradle.kts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@Suppress("DSL_SCOPE_VIOLATION")
2+
plugins {
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.android.library) apply false
5+
alias(libs.plugins.kotlin.android) apply false
6+
alias(libs.plugins.nexusPlugin)
7+
alias(libs.plugins.spotless)
8+
alias(libs.plugins.dokka)
9+
alias(libs.plugins.kotlinBinaryCompatibilityValidator)
10+
}
11+
12+
apply(from ="${rootDir}/scripts/publish-root.gradle")
13+
14+
apiValidation {
15+
ignoredProjects.addAll(listOf("app"))
16+
}
17+
18+
subprojects {
19+
if (name != "app") {
20+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
21+
kotlinOptions.jvmTarget = libs.versions.jvmTarget.get()
22+
kotlinOptions.freeCompilerArgs += listOf(
23+
"-Xexplicit-api=strict",
24+
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
25+
)
26+
}
27+
}
28+
29+
apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)
30+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
31+
kotlin {
32+
target("**/*.kt")
33+
targetExclude("$buildDir/**/*.kt")
34+
ktlint().setUseExperimental(true).editorConfigOverride(
35+
mapOf(
36+
"indent_size" to "2",
37+
"continuation_indent_size" to "2"
38+
)
39+
)
40+
licenseHeaderFile(rootProject.file("spotless/spotless.license.kt"))
41+
trimTrailingWhitespace()
42+
endWithNewline()
43+
}
44+
format("kts") {
45+
target("**/*.kts")
46+
targetExclude("$buildDir/**/*.kts")
47+
licenseHeaderFile(rootProject.file("spotless/spotless.license.kt"), "(^(?![\\/ ]\\*).*$)")
48+
trimTrailingWhitespace()
49+
endWithNewline()
50+
}
51+
}
52+
}

buildSrc/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object Configuration {
2+
const val compileSdk = 33
3+
const val targetSdk = 33
4+
const val minSdk = 21
5+
const val majorVersion = 1
6+
const val minorVersion = 1
7+
const val patchVersion = 2
8+
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
9+
const val versionCode = 13
10+
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
11+
const val artifactGroup = "com.github.skydoves"
12+
}

dependencies.gradle

-25
This file was deleted.

gradle.properties

+25-29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#
2-
# Copyright 2018 skydoves (Jaewoong Eum)
1+
# Designed and developed by 2022 skydoves (Jaewoong Eum)
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
@@ -14,35 +13,32 @@
1413
# limitations under the License.
1514
#
1615

17-
# Jvm environments
18-
org.gradle.jvmargs=-Xmx4g
19-
20-
# AndroidX
21-
android.useAndroidX=true
22-
23-
# Required to publish to Nexus
24-
systemProp.org.gradle.internal.publish.checksums.insecure=true
16+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
17+
org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dlint.nullness.ignore-deprecated=true
2518

26-
# Increase timeout when pushing to Sonatype
27-
systemProp.org.gradle.internal.http.connectionTimeout=120000
28-
systemProp.org.gradle.internal.http.socketTimeout=120000
19+
# https://docs.gradle.org/current/userguide/build_cache.html
20+
org.gradle.caching=true
2921

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

33-
VERSION_NAME=1.1.2-SNAPSHOT
27+
# Configure only necessary projects, useful with multimodule projects
28+
org.gradle.configureondemand=true
3429

35-
POM_DESCRIPTION=WhatIf is kotlin extensions for expressing a single if-else statement, nullable and boolean.
36-
37-
POM_URL=https://github.com/skydoves/whatif/
38-
POM_SCM_URL=https://github.com/skydoves/whatif/
39-
POM_SCM_CONNECTION=scm:git:git://github.com/skydoves/whatif.git
40-
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/skydoves/whatif.git
41-
42-
POM_LICENCE_NAME=The Apache Software License, Version 2.0
43-
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
44-
POM_LICENCE_DIST=repo
30+
# AndroidX Migration https://developer.android.com/jetpack/androidx/migrate
31+
android.useAndroidX=true
4532

46-
POM_DEVELOPER_ID=skydoves
47-
POM_DEVELOPER_NAME=Jaewoong Eum
48-
POM_DEVELOPER_URL=https://github.com/skydoves/
33+
# Removes uneccessary default build features
34+
android.defaults.buildfeatures.aidl=false
35+
android.defaults.buildfeatures.buildconfig=false
36+
android.defaults.buildfeatures.renderscript=false
37+
android.defaults.buildfeatures.resvalues=false
38+
android.defaults.buildfeatures.shaders=false
39+
40+
# Enables namespacing of each library's R class so that its R class includes only the
41+
# resources declared in the library itself and none from the library's dependencies,
42+
# thereby reducing the size of the R class for that library
43+
# https://developer.android.com/studio/releases/gradle-plugin#4.1-nontransitive-r-class
44+
android.nonTransitiveRClass=true

0 commit comments

Comments
 (0)