Skip to content

Commit

Permalink
Start publishing the library to maven central (#53)
Browse files Browse the repository at this point in the history
* setup publishing

* fix compose version

* update Docs to use maven central infos

* update doc link in README.md
  • Loading branch information
yveskalume authored Jun 25, 2024
1 parent e700608 commit 5f377a8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 57 deletions.
32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
![kotlin-version](https://img.shields.io/badge/kotlin-2.0.0-blue)
[![](https://jitpack.io/v/devscast/validable.svg)](https://jitpack.io/#devscast/validable)
[![Build](https://github.com/devscast/validable/actions/workflows/Build.yaml/badge.svg)](https://github.com/devscast/validable/actions/workflows/Build.yaml)

# validable

![Maven Central Version](https://img.shields.io/maven-central/v/tech.devscast/validable?color=blue)
[![build](https://github.com/devscast/validable/actions/workflows/build.yaml/badge.svg)](https://github.com/devscast/validable/actions/workflows/build.yaml)

Validating text fields when using jetpack compose can sometimes be challenging and verbose.

Validable is an extensible library that allows you to validate your text fields in a simpler way while having a reusable code.
Expand Down Expand Up @@ -53,33 +52,20 @@ fun MyScreen() {
}
```

## Installation

**Step 1.** Add the JitPack repository to your build file
## Gradle setup

Add it in your root build.gradle at the end of repositories:

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Include the **validable** dependency in your module `build.gradle` or `build.gradle.kts` :

**Step 2.** Add the dependency

```groovy
```kotlin
dependencies {
implementation 'com.github.devscast:validable:{latest-version}'
implementation("tech.devscast:validable:<version>")
}
```

The latest version of this library is [![](https://jitpack.io/v/devscast/validable.svg)](https://jitpack.io/#devscast/validable)
The latest version is ![Maven Central Version](https://img.shields.io/maven-central/v/tech.devscast/validable?color=blue)

## [Documentation](https://devscast.github.io/validable)
For more detailed information, visit the [doc](https://devscast.github.io/validable).
## For full documentation, check out [https://devscast.github.io/validable](https://devscast.github.io/validable)

## Contributing

Expand Down
23 changes: 5 additions & 18 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Validable

![kotlin-version](https://img.shields.io/badge/kotlin-2.0.0-blue)
[![](https://jitpack.io/v/devscast/validable.svg)](https://jitpack.io/#devscast/validable)
![Maven Central Version](https://img.shields.io/maven-central/v/tech.devscast/validable?color=blue)
[![build](https://github.com/devscast/validable/actions/workflows/build.yaml/badge.svg)](https://github.com/devscast/validable/actions/workflows/build.yaml)

Validating text fields when using jetpack compose can sometimes be challenging and verbose.
Expand Down Expand Up @@ -49,26 +48,14 @@ fun MyScreen() {
}
```

## Installation
## Gradle setup

**Step 1.** Add the JitPack repository to your build file
Include the **validable** dependency in your module `build.gradle` or `build.gradle.kts` :

Add it in your root build.gradle at the end of repositories:

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

**Step 2.** Add the dependency

```groovy
```kotlin
dependencies {
implementation 'com.github.devscast:validable:{latest-version}'
implementation("tech.devscast:validable:<version>")
}
```

Expand Down
60 changes: 44 additions & 16 deletions validable/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("maven-publish")
id("io.gitlab.arturbosch.detekt") version "1.23.6"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.14.0"
id("org.jetbrains.kotlin.plugin.compose")
id("com.vanniktech.maven.publish") version "0.28.0"
}

android {
Expand Down Expand Up @@ -54,24 +56,10 @@ dependencies {
implementation("androidx.core:core-ktx:1.13.1")
implementation(platform("androidx.compose:compose-bom:2024.06.00"))
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui:1.6.8")
testImplementation("junit:junit:4.13.2")
}

publishing {
publications {
register<MavenPublication>("release") {
groupId = "com.github.devscast"
artifactId = "validable"
version = "2.0.0-alpha01"

afterEvaluate {
from(components["release"])
}
}
}
}

detekt {
parallel = true

Expand All @@ -84,4 +72,44 @@ detekt {

// Specifying a baseline file. All findings stored in this file in subsequent runs of detekt.
baseline = file("$rootDir/detekt/baseline.xml")
}


mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()

coordinates("tech.devscast", "validable", "2.0.0-alpha01")

pom {
name.set("Validable")
description.set("An easy-to-use text field validator for Kotlin & Jetpack compose.")
inceptionYear.set("2021")
url.set("https://github.com/devscast/validable")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("yveskalume")
name.set("Yves Kalume")
url.set("https://github.com/yveskalume")
}
developer {
id.set("bernard-ng")
name.set("Bernard Ngandu")
url.set("https://github.com/bernard-ng")
}
}

scm {
url.set("https://github.com/devscast/validable")
connection.set("scm:git:git://github.com/devscast/validable.git")
developerConnection.set("scm:git:ssh://[email protected]/devscast/validable.git")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ValidatorTest {
}

@Test

fun `test validator when input are valid`(){
val validable1 = EmailValidable()
validable1.value = "[email protected]"
Expand Down

0 comments on commit 5f377a8

Please sign in to comment.