Skip to content

Commit

Permalink
Merge pull request #1 from Meesho/jfrog-migration
Browse files Browse the repository at this point in the history
Add publish script to Jfrog migration
  • Loading branch information
saini2sandeep authored Jun 24, 2022
2 parents 8dbb554 + c7a78cd commit cc027d0
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 96 deletions.
77 changes: 71 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':time', ':time-android'
include ':time'
rootProject.name = 'Time'

1 change: 0 additions & 1 deletion time-android/.gitignore

This file was deleted.

38 changes: 0 additions & 38 deletions time-android/build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions time-android/proguard-rules.pro

This file was deleted.

2 changes: 0 additions & 2 deletions time-android/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions time-android/src/main/res/values/strings.xml

This file was deleted.

11 changes: 3 additions & 8 deletions time/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit cc027d0

Please sign in to comment.