forked from serj-lotutovici/moshi-lazy-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
135 lines (121 loc) · 3.99 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
buildscript {
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 "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()
}
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')
//
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceSets {
// Setup source sets to split unit and integration tests
test {
java.srcDirs = ['src/unitTest/java']
resources.srcDirs = ['src/unitTest/resources']
}
}
dependencies {
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
}
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
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
}
}
}