diff --git a/build.gradle b/build.gradle index 96ceb9c..4acabde 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,88 @@ buildscript { - ext.kotlin_version = '1.2.60' + ext.kotlin_version = '1.5.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' - classpath 'com.palantir:jacoco-coverage:0.4.0' + classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.28.3" } } allprojects { + apply plugin: "com.jfrog.artifactory" + apply plugin: "maven-publish" + apply plugin: 'java-library' repositories { google() - jcenter() + mavenCentral() + } +} + +ext.versionName = { -> + def currentTag = 'git tag --points-at HEAD'.execute().in.text.toString().trim() + def currentBranch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.toString().trim() + def tagRegex = "[0-9.]*[0-9]" + if (!currentTag.isEmpty() && currentTag.matches(tagRegex)) { +// is not empty and is in following format 8.0 + return currentTag + } else { + return currentBranch + '-SNAPSHOT' } } -apply plugin: 'com.palantir.jacoco-full-report' +def libraryGroupId = 'com.meesho.android' +def libraryVersion = versionName() + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from sourceSets.main.java.srcDirs +} + +project('time') { + artifactoryPublish.dependsOn('build') + publishing { + publications { + mavenJava(MavenPublication) { + groupId = libraryGroupId + artifactId = 'time' + version = libraryVersion + // Tell maven to prepare the generated "*.jar" file for publishing + artifact("$buildDir/libs/time.jar") + artifact androidSourcesJar + + pom.withXml { + def dependencies = asNode().appendNode('dependencies') + configurations.implementation.allDependencies.each { + def dependency = dependencies.appendNode('dependency') + dependency.appendNode('groupId', it.group) + dependency.appendNode('artifactId', it.name) + dependency.appendNode('version', it.version) + } + } + } + } + } +} +artifactory { + //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = project.properties["JFROG_ARTIFACTORY_URL"] + publish { + repository { + repoKey = libraryVersion.endsWith('-SNAPSHOT') ? project.properties["SNAPSHOT_REPO_NAME"] : + project.properties["RELEASE_REPO_NAME"] + username = project.properties["JFROG_ARTIFACTORY_USERNAME"] + password = project.properties["JFROG_ARTIFACTORY_KEY"] + } + defaults { + // Tell the Artifactory Plugin which artifacts should be published to Artifactory. + publications('mavenJava') + publishArtifacts = true + // Publish generated POM files to Artifactory (true by default) + publishPom = true + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9096f07..2615d3b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip diff --git a/settings.gradle b/settings.gradle index d511466..2844dd6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ -include ':time', ':time-android' +include ':time' rootProject.name = 'Time' diff --git a/time-android/.gitignore b/time-android/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/time-android/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/time-android/build.gradle b/time-android/build.gradle deleted file mode 100644 index 960b744..0000000 --- a/time-android/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'com.github.dcendents.android-maven' - -group = 'com.github.kizitonwose' - -android { - compileSdkVersion 26 - buildToolsVersion "26.0.2" - - - defaultConfig { - minSdkVersion 14 - targetSdkVersion 26 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - sourceSets { - main { - java.srcDirs += 'src/main/kotlin' - } - } -} - - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation project(':time') -} diff --git a/time-android/proguard-rules.pro b/time-android/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/time-android/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/time-android/src/main/AndroidManifest.xml b/time-android/src/main/AndroidManifest.xml deleted file mode 100644 index d63e994..0000000 --- a/time-android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/time-android/src/main/kotlin/com/kizitonwose/timeandroid/AndroidExtensions.kt b/time-android/src/main/kotlin/com/kizitonwose/timeandroid/AndroidExtensions.kt deleted file mode 100644 index fb83766..0000000 --- a/time-android/src/main/kotlin/com/kizitonwose/timeandroid/AndroidExtensions.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.kizitonwose.timeandroid - -import android.os.Handler -import com.kizitonwose.time.* - -/** - * Created by Kizito Nwose on 19/10/2017 - */ - -fun Handler.postDelayed(r: Runnable, delay: Interval) - = postDelayed(r, delay.inMilliseconds.longValue) - -fun Handler.postDelayed(r: () -> Unit, delay: Interval) - = postDelayed(r, delay.inMilliseconds.longValue) - diff --git a/time-android/src/main/res/values/strings.xml b/time-android/src/main/res/values/strings.xml deleted file mode 100644 index e90a704..0000000 --- a/time-android/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Time Android - diff --git a/time/build.gradle b/time/build.gradle index 1c53f24..9b9dd8a 100644 --- a/time/build.gradle +++ b/time/build.gradle @@ -1,20 +1,15 @@ apply plugin: 'kotlin' -apply plugin: 'maven' -apply plugin: 'jacoco' group = 'com.github.kizitonwose' dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - // This is a false positive, documented at https://youtrack.jetbrains.com/issue/KT-23933 - // noinspection DifferentStdlibGradleVersion - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" testImplementation 'junit:junit:4.12' } compileKotlin { - kotlinOptions.jvmTarget = "1.6" + kotlinOptions.jvmTarget = "1.8" } compileTestKotlin { - kotlinOptions.jvmTarget = "1.6" + kotlinOptions.jvmTarget = "1.8" }