This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.experimental.DefaultDispatcher | |
import kotlinx.coroutines.experimental.channels.BroadcastChannel | |
import kotlinx.coroutines.experimental.channels.ReceiveChannel | |
import kotlinx.coroutines.experimental.channels.filter | |
import kotlinx.coroutines.experimental.channels.map | |
import kotlinx.coroutines.experimental.launch | |
import kotlin.coroutines.experimental.CoroutineContext | |
class EventBus { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'maven-publish' // Apply this plugin at the top of your library build.gradle | |
def githubProperties = new Properties() | |
githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) //Set env variable GPR_USER & GPR_API_KEY if not adding a properties file | |
def getVersionName = { -> | |
return "1.0.2" // Replace with version Name | |
} | |
def getArtificatId = { -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file(“github.properties”))) | |
repositories { | |
maven { | |
name = "GitHubPackages" | |
/* Configure path to the library hosted on GitHub Packages Registry | |
* Replace UserID with package owner userID and REPOSITORY with the repository name | |
* e.g. "https://maven.pkg.github.com/enefce/AndroidLibraryForGitHubPackagesDemo"*/ | |
url = uri("https://maven.pkg.github.com/UserID/REPOSITORY") | |
credentials { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
//consume library | |
implementation 'com.example:package' // Replace with the groupd id / package id and version number of library as required | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream | |
import java.util.* | |
plugins { | |
id("com.android.library") | |
kotlin("android") | |
kotlin("android.extensions") | |
id("maven-publish") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream | |
import java.util.* | |
plugins { | |
id("com.android.application") | |
kotlin("android") | |
kotlin("android.extensions") | |
} | |
/**Create github.properties in root project folder file with gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publishing { | |
publications { | |
create<MavenPublication>("gpr") { | |
run { | |
groupId = "com.enefce.libraries" | |
artifactId = getArtificatId() | |
version = getVersionName() | |
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publishing { | |
repositories { | |
maven { | |
name = "GitHubPackages" | |
/** Configure path of your package repository on Github | |
* Replace GITHUB_USERID with your/organisation Github userID and REPOSITORY with the repository name on GitHub | |
*/ | |
url = uri("https://maven.pkg.github.com/GITHUB_USERID/REPOSITORY") // Github Package | |
credentials { | |
//Fetch these details from the properties file or from Environment variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android{ | |
repositories { | |
maven { | |
name = "GitHubPackages" | |
/* Configure path to the library hosted on GitHub Packages Registry | |
* Replace UserID with package owner userID and REPOSITORY with the repository name | |
* e.g. "https://maven.pkg.github.com/enefce/AndroidLibrary-GPR-KDSL" | |
*/ | |
//url = uri("https://maven.pkg.github.com/UserID/REPOSITORY") | |
url = uri("https://maven.pkg.github.com/enefce/AndroidLibrary-GPR-KDSL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publications { | |
bar(MavenPublication) { | |
groupId getGroupId() | |
artifactId getArtificatId() | |
version getVersionName() | |
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar") | |
//generate .pom file with transitive dependencies | |
pom.withXml { | |
final dependenciesNode = asNode().appendNode('dependencies') | |
ext.addDependency = { Dependency dep, String scope -> |