Skip to content

Commit

Permalink
Merge pull request #1 from Meesho/lazy-adapters-kotlin-migration
Browse files Browse the repository at this point in the history
Lazy adapters kotlin migration
  • Loading branch information
amanarora12 authored Jul 4, 2022
2 parents 5f2d890 + 5c732e8 commit 7c5f25b
Show file tree
Hide file tree
Showing 55 changed files with 881 additions and 3,996 deletions.
138 changes: 111 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,51 +1,135 @@
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext.kotlin_version = '1.6.21'
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}

// Needed to use auto-value-moshi in tests
dependencies {
classpath 'com.github.tbroyer:gradle-apt-plugin:v0.12'
}
// Needed to use auto-value-moshi in tests
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.28.3"
}
}

repositories {
mavenCentral()
mavenCentral()
}

apply plugin: 'net.ltgt.apt-idea'
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: "com.jfrog.artifactory"
apply plugin: "maven-publish"
apply plugin: 'java-library'
apply plugin: 'kotlin-kapt'

apply from: rootProject.file('dependencies.gradle')
apply from: rootProject.file('checkstyle.gradle')
apply from: rootProject.file('jacoco.gradle')
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
//

sourceCompatibility = javaVersion
targetCompatibility = javaVersion

sourceSets {
// Setup source sets to split unit and integration tests
test {
java.srcDirs = ['src/unitTest/java', 'src/integrationTest/java']
resources.srcDirs = ['src/unitTest/resources', 'src/integrationTest/resources']
}
// Setup source sets to split unit and integration tests
test {
java.srcDirs = ['src/unitTest/java']
resources.srcDirs = ['src/unitTest/resources']
}
}

dependencies {
compile moshi
implementation moshi
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.13.0"

testImplementation junit
testImplementation assertJ
testImplementation privateConstructorChecker
testImplementation retrofit
testImplementation retrofitMoshiConverter
testImplementation mockWebServer
testImplementation rxJava2
}
compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
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'
}
}

def libraryGroupId = 'com.meesho.android'
def libraryVersion = versionName()

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.java.srcDirs
}


testCompile junit
testCompile assertJ
testCompile privateConstructorChecker
testCompile retrofit
testCompile retrofitMoshiConverter
testCompile mockWebServer
testCompile rxJava2
artifactoryPublish.dependsOn('build')
publishing {
publications {
mavenJava(MavenPublication) {
groupId = libraryGroupId
artifactId = 'moshi-lazy-adapters'
version = libraryVersion
// Tell maven to prepare the generated "*.jar" file for publishing
artifact("$buildDir/libs/moshi-lazy-adapters.jar")
artifact androidSourcesJar

// This is needed to test integration with auto-value-moshi
testCompileOnly autoValueMoshiAnnotations
testCompileOnly autoValueAnnotations
testApt autoValueMoshi
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
}
}
}
8 changes: 2 additions & 6 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ext {
javaVersion = JavaVersion.VERSION_1_7
javaVersion = JavaVersion.VERSION_11

ci = 'true'.equals(System.getenv('CI'))

/* Dependencies */
moshi = 'com.squareup.moshi:moshi:1.5.0'
moshi = 'com.squareup.moshi:moshi:1.13.0'

/* Testing */
junit = 'junit:junit:4.12'
Expand All @@ -14,8 +14,4 @@ ext {
mockWebServer = 'com.squareup.okhttp3:mockwebserver:3.4.1'
privateConstructorChecker = 'com.pushtorefresh.java-private-constructor-checker:checker:1.2.0'
rxJava2 = 'io.reactivex.rxjava2:rxjava:2.0.3'

autoValueMoshi = 'com.ryanharter.auto.value:auto-value-moshi:0.4.2'
autoValueMoshiAnnotations = 'com.ryanharter.auto.value:auto-value-moshi-annotations:0.4.2'
autoValueAnnotations = 'com.jakewharton.auto.value:auto-value-annotations:1.3'
}
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Oct 09 10:31:26 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
2 changes: 1 addition & 1 deletion jacoco.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'jacoco'

jacoco {
toolVersion = '0.7.7.201606060606' // See http://www.eclemma.org/jacoco/.
toolVersion = '0.8.7' // See http://www.eclemma.org/jacoco/.
}

jacocoTestReport {
Expand Down
41 changes: 0 additions & 41 deletions src/integrationTest/java/com/serjltt/moshi/adapters/Data.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7c5f25b

Please sign in to comment.