Skip to content

Commit

Permalink
[*] Updated gradle.
Browse files Browse the repository at this point in the history
  • Loading branch information
VicMikhailau committed Apr 1, 2021
1 parent 26aa623 commit 7d57fc4
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 46 deletions.
48 changes: 14 additions & 34 deletions MaskedEditText/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,44 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

ext {
bintrayRepo = 'maven'
bintrayName = 'MaskedEditText'

publishedGroupId = 'com.vicmikhailau'
libraryName = 'MaskedEditText'
artifact = 'MaskedEditText'

libraryDescription = 'Add a mask to EditText'

siteUrl = 'https://github.com/VicMikhailau/MaskedEditText'
gitUrl = 'https://github.com/VicMikhailau/MaskedEditText.git'

libraryVersion = '3.1.1'

developerId = 'VicMikhailau'
developerName = 'Vic Mikhailau'
developerEmail = '[email protected]'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
PUBLISH_GROUP_ID = 'io.github.vicmikhailau'
PUBLISH_VERSION = '4.0.5'
PUBLISH_ARTIFACT_ID = 'MaskedEditText'
}
apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"

android {
compileSdkVersion 30

defaultConfig {
minSdkVersion 14
targetSdkVersion 30
versionCode 10
versionName "3.1.1"
versionCode 15
versionName "4.0.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

tasks.withType(Javadoc).all {
excludes = ['**/*.kt']
sourceSets {
all {
it.java.srcDir "src/$it.name/kotlin"
}
}
}


ext {
androidx_appcompat = '1.2.0'
androidx_core_ktx = '1.3.2'
}

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api "androidx.appcompat:appcompat:$androidx_appcompat"
implementation "androidx.appcompat:appcompat:$androidx_appcompat"
implementation "androidx.core:core-ktx:$androidx_core_ktx"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
repositories {
mavenCentral()
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ It allows you to add a mask to EditText

# Version

3.1.1
4.0.5

# Installation

To use this library in your android project, just simply add the following dependency into your build.gradle
**Step 1**: Add MavenCentral and Jitpack to your repositories in your *project* level `build.gradle` file:

```gradle
allprojects {
repositories {
mavenCentral()
}
}
```

**Step 2**: Add the library as a dependency in your *module* level `build.gradle` file:

```sh
dependencies {
implementation 'com.vicmikhailau:MaskedEditText:3.1.1'
implementation 'io.github.vicmikhailau:MaskedEditText:4.0.5'
}
```

Expand Down Expand Up @@ -74,6 +84,10 @@ Unfortunately, there is no way to devote much time to the project. Please feel f
# Change Logs
### v4.0.5
Moved project to the MavenCentral. Changed groupId to io.github.vicmikhailau
### v3.1.1
Updated Gradle and libraries.
Expand All @@ -100,7 +114,7 @@ Moved library to androidx and kotlin.
## Licence
Copyright 2016 Vic Mikhailau<br />
Copyright 2021 Victor Mikhailau<br />
<br />
Licensed under the Apache License, Version 2.0 (the "License");<br />
you may not use this file except in compliance with the License.<br />
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ android {
}

ext {
desugar_jdk_libs = '1.0.10'
desugar_jdk_libs = '1.1.5'
androidx_appcompat = '1.2.0'
androidx_core_ktx = '1.3.2'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs"
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
implementation "androidx.appcompat:appcompat:$androidx_appcompat"
implementation project(':MaskedEditText')
implementation "androidx.core:core-ktx:$androidx_core_ktx"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
repositories {
mavenCentral()
Expand Down
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.32'
repositories {
jcenter()
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
jcenter()
google()
mavenCentral()
gradlePluginPortal()
}
}
110 changes: 110 additions & 0 deletions scripts/publish-mavencentral.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
// For Android libraries
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
} else {
// For pure Kotlin libraries, in case you have them
from sourceSets.main.java.srcDirs
from sourceSets.main.kotlin.srcDirs
}
}
artifacts {
archives androidSourcesJar
}

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is ->
p.load(is)
}
p.each { name, value ->
ext[name] = value
}
} else {
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
}

publishing {
publications {
release(MavenPublication) {
// The coordinates of the library, being set from variables that
// we'll set up later
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

// Two artifacts, the `aar` (or `jar`) and the sources
if (project.plugins.findPlugin("com.android.library")) {
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
} else {
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
}
artifact androidSourcesJar

// Mostly self-explanatory metadata
pom {
name = PUBLISH_ARTIFACT_ID
description = 'It allows you to add a mask to EditText.'
url = 'https://github.com/VicMikhailau/MaskedEditText'
licenses {
license {
name = 'MaskedEditText License'
url = 'https://github.com/VicMikhailau/MaskedEditText/blob/master/LICENSE'
}
}
developers {
developer {
id = 'VicMikhailau'
name = 'Victor Mikhailau'
email = '[email protected]'
}
// Add all other devs here...
}
// Version control info - if you're using GitHub, follow the format as seen here
scm {
connection = 'scm:git:github.com:VicMikhailau/MaskedEditText.git'
developerConnection = 'scm:git:ssh://github.com:VicMikhailau/MaskedEditText.git'
url = 'https://github.com:VicMikhailau/MaskedEditText/tree/main'
}
}
}
}
// The repository to publish to, Sonatype/MavenCentral
repositories {
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
name = "sonatype"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

signing {
sign publishing.publications
}

0 comments on commit 7d57fc4

Please sign in to comment.