Skip to content

Commit

Permalink
Update build.gradle to allow gradle publishing (#7)
Browse files Browse the repository at this point in the history
* Update build.gradle to allow gradle publishing

* Add extra task to build.gradle necessary for the publishPlugins task

* Update logic to use firely plugin already published

* Update build.gradle to allow more easily local testing of changes to the firely-plugin module;
Update Readme section

* Update lib version to 0.2.1

* Comment debug code only
  • Loading branch information
ruimendesM authored Sep 16, 2022
1 parent 2c80c8e commit 771c433
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 29 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ jobs:
<<: *android_config
steps:
- checkout
- run-gradle-cmd:
desc: Publish Plugin to MavenLocal
cmd: "firely-plugin::publishToMavenLocal"
- run-gradle-cmd:
desc: Build Release
cmd: "clean assembleRelease"
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,28 @@ can track the configuration changes over time.
## Use in the project
You need to apply the plugin (TODO integrate in maven repo):
You need to apply the plugin:
```
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath group: 'com.busbud.android', name: 'firely-plugin', version: '0.2.0'
}
plugins {
<... all your other plugins ...>
id 'com.busbud.android.firely' version '0.2.0'
}
apply plugin: 'com.busbud.android.firely'
```
You also need to import the aar (TODO integrate in maven repo):
`compile project(':firely-0.2.0')`
## If you need to update the plugin on the Gradle Plugin Portal (ADMINS ONLY)
Currently this process is manual and it is not being done via CI.
In order to do this you need to have access to this [account](https://plugins.gradle.org/u/android-busbud).
- Bump the version of library
- Run the following command (keys are available on the account):
```
./gradlew publishPlugins -Pgradle.publish.key=<key> -Pgradle.publish.secret=<secret>
```
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ buildscript {
ext.buildtools_version = '33.0.0'
ext.corektx_version = '1.7.0'
ext.compilesdk_version = 32
ext.lib_version = '0.2.1'

repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion firely-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ publishing {
firely(MavenPublication) {
groupId 'com.busbud.android'
artifactId 'firely'
version '0.2.0'
version "$lib_version"
artifact(sourceJar)
artifact("$buildDir/outputs/aar/firely-lib-release.aar")
}
Expand Down
34 changes: 30 additions & 4 deletions firely-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'kotlinx-serialization'
plugins {
id 'kotlin'
id 'maven-publish'
id 'kotlinx-serialization'
id "com.gradle.plugin-publish" version "1.0.0"
}

dependencies {
repositories {
Expand Down Expand Up @@ -48,16 +51,39 @@ task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}

tasks.withType(Copy).all { duplicatesStrategy 'exclude' }

artifacts {
archives sourcesJar
}

version = "$lib_version"
group = "com.busbud"

pluginBundle {
website = 'https://github.com/busbud/firely'
vcsUrl = 'https://github.com/busbud/firely'
description = "Library to simplify the integration and management of A/B testing"
tags = ['firely', 'remote_configs', 'firebase']
}


gradlePlugin {
plugins {
firelyPlugin {
id = 'com.busbud.android.firely'
implementationClass = 'com.busbud.android.firely.FirelyPlugin'
displayName = "Firely Plugin"
}
}
}

publishing {
publications {
main(MavenPublication) {
groupId 'com.busbud.android'
artifactId 'firely-plugin'
version '0.2.0'
version "$lib_version"

from components.java
artifact sourcesJar
Expand Down
20 changes: 10 additions & 10 deletions firely-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.busbud.android.firely'
apply plugin: 'com.google.gms.google-services'

buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
// mavenLocal()
}
// dependencies {
// classpath group: 'com.busbud.android', name: 'firely-plugin', version: "$lib_version"
// }
}

dependencies {
classpath group: 'com.busbud.android', name: 'firely-plugin', version: '0.2.0'
}
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.gms.google-services'
id "com.busbud.android.firely" version "0.2.1"
}

android {
Expand Down

0 comments on commit 771c433

Please sign in to comment.