Skip to content

Commit 9d6b683

Browse files
authored
Enable artifactory publication (#1146)
1 parent 6581aa7 commit 9d6b683

File tree

3 files changed

+51
-17
lines changed

3 files changed

+51
-17
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dependencies {
5757
// The following dependencies are not required to use the Firebase UI library.
5858
// They are used to make some aspects of the demo app implementation simpler for
5959
// demonstrative purposes, and you may find them useful in your own apps; YMMV.
60+
implementation "android.arch.lifecycle:runtime:$architectureVersion"
6061
implementation 'pub.devrel:easypermissions:1.1.3'
6162
implementation 'com.jakewharton:butterknife:8.8.1'
6263
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

build.gradle

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ buildscript {
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1313
classpath 'com.google.gms:google-services:3.2.0'
1414
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
15+
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4'
1516
}
1617
}
1718

@@ -87,6 +88,9 @@ allprojects { project ->
8788
archives sourcesJar
8889
}
8990

91+
// JFrog Artifactory integration
92+
project.apply plugin: 'com.jfrog.artifactory'
93+
9094
// So that we can define publication
9195
project.apply plugin: 'maven-publish'
9296

@@ -113,15 +117,18 @@ allprojects { project ->
113117
def publicationName = isLibrary ? 'monolithLibrary' : "${project.name}Library"
114118
def archivesBaseName = isLibrary ? 'firebase-ui' : "firebase-ui-${project.name}"
115119

120+
def groupName = project.ext.group
121+
def versionName = project.ext.version;
122+
116123
publishing {
117124
publications {
118125
"${publicationName}"(MavenPublication) {
119126

120-
groupId group
127+
groupId groupName
121128
artifactId archivesBaseName
122-
version version
129+
version versionName
123130

124-
artifact "$buildDir/outputs/aar/$archivesBaseName-release.aar"
131+
artifact "$buildDir/outputs/aar/${archivesBaseName}-release.aar"
125132
artifact javadocJar
126133
artifact sourcesJar
127134

@@ -134,30 +141,32 @@ allprojects { project ->
134141

135142
configurations.api.dependencies.each {
136143
def dependencyNode = dependenciesNode.appendNode('dependency')
137-
dependencyNode.appendNode('groupId', it.group)
138144

139145
if (submodules.contains(it.name)) {
146+
dependencyNode.appendNode('groupId', groupName)
140147
dependencyNode.appendNode('artifactId', "firebase-ui-${it.name}")
148+
dependencyNode.appendNode('version', versionName)
141149
} else {
150+
dependencyNode.appendNode('groupId', it.group)
142151
dependencyNode.appendNode('artifactId', it.name)
152+
dependencyNode.appendNode('version', it.version)
143153
}
144154

145-
dependencyNode.appendNode('version', it.version)
146-
147155
dependencyNode.appendNode('scope', 'compile')
148156
}
149157
configurations.implementation.dependencies.each {
150158
def dependencyNode = dependenciesNode.appendNode('dependency')
151-
dependencyNode.appendNode('groupId', it.group)
152159

153160
if (submodules.contains(it.name)) {
161+
dependencyNode.appendNode('groupId', groupName)
154162
dependencyNode.appendNode('artifactId', "firebase-ui-${it.name}")
163+
dependencyNode.appendNode('version', versionName)
155164
} else {
165+
dependencyNode.appendNode('groupId', it.group)
156166
dependencyNode.appendNode('artifactId', it.name)
167+
dependencyNode.appendNode('version', it.version)
157168
}
158169

159-
dependencyNode.appendNode('version', it.version)
160-
161170
dependencyNode.appendNode('scope', 'runtime')
162171
}
163172

@@ -206,26 +215,40 @@ allprojects { project ->
206215
}
207216
}
208217

218+
def bintrayUsername = hasProperty('BINTRAY_USER') ? getProperty('BINTRAY_USER') : System.getenv('BINTRAY_USER')
219+
def bintrayKey = hasProperty('BINTRAY_KEY') ? getProperty('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
220+
221+
artifactory {
222+
contextUrl = 'https://oss.jfrog.org'
223+
publish {
224+
repository {
225+
repoKey = 'oss-snapshot-local'
226+
227+
username = bintrayUsername
228+
password = bintrayKey
229+
}
230+
}
231+
}
232+
233+
artifactoryPublish {
234+
publications(publishing.publications."$publicationName")
235+
}
236+
209237
// Bintray Configuration (applies to submodule and the monolith)
210238
project.apply plugin: 'com.jfrog.bintray'
211239

212240
def pomLoc = isLibrary ? "$buildDir/publications/monolithLibrary/pom-default.xml" : "$buildDir/publications/${project.name}Library/pom-default.xml"
213241

214-
group = project.ext.group
215-
version = project.ext.version
216-
217-
def versionName = project.ext.version
218-
219242
bintray {
220-
user = hasProperty('BINTRAY_USER') ? getProperty('BINTRAY_USER') : System.getenv('BINTRAY_USER')
221-
key = hasProperty('BINTRAY_KEY') ? getProperty('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
243+
user = bintrayUsername
244+
key = bintrayKey
222245
publications = [publicationName]
223246

224247
filesSpec {
225248
from pomLoc
226249
into "com/firebaseui/$archivesBaseName/$versionName/"
227250
rename { String fileName ->
228-
"${archivesBaseName}-${version}.pom"
251+
"${archivesBaseName}-${versionName}.pom"
229252
}
230253
}
231254

scripts/artifactory.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
./gradlew :library:prepareArtifacts
6+
./gradlew :common:assembleRelease :common:prepareArtifacts :common:artifactoryPublish
7+
./gradlew :auth:assembleRelease :auth:prepareArtifacts :auth:artifactoryPublish
8+
./gradlew :database:assembleRelease :database:prepareArtifacts :database:artifactoryPublish
9+
./gradlew :firestore:assembleRelease :firestore:prepareArtifacts :firestore:artifactoryPublish
10+
./gradlew :storage:assembleRelease :storage:prepareArtifacts :storage:artifactoryPublish

0 commit comments

Comments
 (0)