Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #202 from andriydruk/feature/migrate-to-maven-central
Browse files Browse the repository at this point in the history
Migrate to Maven Central
  • Loading branch information
andriydruk authored May 12, 2021
2 parents e6fc838 + efd08b4 commit 0e1a0a1
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 135 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Android mDNSResponder [![Circle CI](https://circleci.com/gh/andriydruk/RxDNSSD.svg?style=shield&circle-token=5f0cb1ee907a20bdb08aa4b073b5690afbaaabe1)](https://circleci.com/gh/andriydruk/RxDNSSD) [![Download](https://api.bintray.com/packages/andriydruk/maven/dnssd/images/download.svg)](https://bintray.com/andriydruk/maven/rxdnssd/_latestVersion) [![Download](https://api.bintray.com/packages/andriydruk/maven/rxdnssd/images/download.svg)](https://bintray.com/andriydruk/maven/rxdnssd/_latestVersion)[ ![Download](https://api.bintray.com/packages/andriydruk/maven/rxdnssd/images/download.svg) ](https://bintray.com/andriydruk/maven/rxdnssd/_latestVersion)
# Android mDNSResponder [![Circle CI](https://circleci.com/gh/andriydruk/RxDNSSD.svg?style=shield&circle-token=5f0cb1ee907a20bdb08aa4b073b5690afbaaabe1)](https://circleci.com/gh/andriydruk/RxDNSSD) [![Download](https://img.shields.io/maven-central/v/com.github.andriydruk/dnssd?label=DNSSD)](https://search.maven.org/artifact/com.github.andriydruk/dnssd) [![Download](https://img.shields.io/maven-central/v/com.github.andriydruk/rxdnssd?label=RxDNSSD)](https://search.maven.org/artifact/com.github.andriydruk/rxdnssd) [![Download](https://img.shields.io/maven-central/v/com.github.andriydruk/rx2dnssd?label=Rx2DNSSD) ](https://search.maven.org/artifact/com.github.andriydruk/rx2dnssd)





Expand Down Expand Up @@ -53,27 +55,27 @@ Embedded version:
```

## Binaries
## Binaries on MavenCentral

My dnssd library:
DNSSD library:

```groovy
compile 'com.github.andriydruk:dnssd:0.9.13'
compile 'com.github.andriydruk:dnssd:0.9.15'
```

My rxdnssd library:
RxDNSSD library:

```groovy
compile 'com.github.andriydruk:rxdnssd:0.9.13'
compile 'com.github.andriydruk:rxdnssd:0.9.15'
```

My rx2dnssd library:
Rx2DNSSD library:

```
compile 'com.github.andriydruk:rx2dnssd:0.9.13'
compile 'com.github.andriydruk:rx2dnssd:0.9.15'
```

* It's built with Andorid NDK r18b for all platforms (1.7 MB). If you prefer another NDK version or subset of platforms, please build it from source with command:
* It's built with Andorid NDK 21 for all platforms (1.7 MB). If you prefer another NDK version or subset of platforms, please build it from source with command:

```groovy
./gradlew clean build
Expand Down Expand Up @@ -234,7 +236,7 @@ browseDisposable = rxDnssd.browse("_http._tcp", "local.")

License
-------
Copyright (C) 2016 Andriy Druk
Copyright (C) 2021 Andriy Druk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

ndkVersion "21.3.6528147"
ndkVersion "21.4.7075529"
}

dependencies {
implementation project(':rx2dnssd')
//implementation 'com.github.andriydruk:rx2dnssd:0.9.8-beta1'

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.github.druk.rx2dnssd.BonjourService;
import com.github.druk.rx2dnssd.Rx2Dnssd;
import com.github.druk.rx2dnssd.Rx2DnssdBindable;
import com.github.druk.rx2dnssd.Rx2DnssdEmbedded;

import java.util.Objects;
Expand All @@ -41,7 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

rxDnssd = new Rx2DnssdEmbedded(this);
rxDnssd = new Rx2DnssdBindable(this);

findViewById(R.id.check_threads).setOnClickListener(v -> {
/*
Expand Down
79 changes: 0 additions & 79 deletions bintray-publish.gradle

This file was deleted.

36 changes: 8 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}

Expand All @@ -37,25 +37,5 @@ task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
bintrayRepo = 'maven'
bintrayPackaging = 'aar'
bintrayConfigurations = ['archives']

bintrayGroup = 'com.github.andriydruk'
bintrayVersion = '0.9.14'

bintrayLibraryDescription = 'Android version of Apple DNSSD Java API'

bintrayDeveloperId = 'andriydruk'
bintrayDeveloperName = 'Andriy Druk'
bintrayDeveloperEmail = '[email protected]'

bintrayLicenseName = 'The Apache Software License, Version 2.0'
bintrayLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
bintrayAllLicenses = ["Apache-2.0"]

bintrayWebsiteUrl = "https://github.com/andriydruk/RxDNSSD"
bintrayIssueTrackerUrl = "https://github.com/andriydruk/RxDNSSD/issues"
binstrayVCSUrl = "https://github.com/andriydruk/RxDNSSD.git"
}
apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply from: "${rootDir}/publish-root.gradle"
14 changes: 10 additions & 4 deletions dnssd/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ repositories {
}

android {
compileSdkVersion 28
compileSdkVersion 30

defaultConfig {
minSdkVersion 14
targetSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
Expand All @@ -36,7 +36,7 @@ android {
}
}

ndkVersion "21.3.6528147"
ndkVersion "21.4.7075529"
}

dependencies {
Expand All @@ -53,4 +53,10 @@ dependencies {
}
}

apply from: rootProject.file('bintray-publish.gradle')
ext {
// Provide your own coordinates here
PUBLISH_GROUP_ID = 'com.github.andriydruk'
PUBLISH_ARTIFACT_ID = 'dnssd'
}

apply from: "${rootProject.projectDir}/publish-module.gradle"
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
76 changes: 76 additions & 0 deletions publish-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
// For Android libraries
from android.sourceSets.main.java.srcDirs
}
}

artifacts {
archives androidSourcesJar
}

group = PUBLISH_GROUP_ID
version = mavenCentralVersion

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
// The coordinates of the library, being set from variables that
// we'll set up later
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version mavenCentralVersion

// Two artifacts, the `aar` (or `jar`) and the sources
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
}

artifact androidSourcesJar

// Mostly self-explanatory metadata
pom {
name = PUBLISH_ARTIFACT_ID
description = 'Android version of Apple DNSSD Java API'
url = 'https://github.com/andriydruk/RxDNSSD'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://github.com/andriydruk/RxDNSSD/blob/master/LICENSE'
}
}
developers {
developer {
id = 'andriydruk'
name = 'Andrew Druk'
email = '[email protected]'
}
}

// Version control info - if you're using GitHub, follow the
// format as seen here
scm {
connection = 'scm:git:github.com/andriydruk/RxDNSSD.git'
developerConnection = 'scm:git:ssh://github.com/andriydruk/RxDNSSD.git'
url = 'https://github.com/andriydruk/RxDNSSD/tree/master'
}
}
}
}
}
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

signing {
sign publishing.publications
}
38 changes: 38 additions & 0 deletions publish-root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Create variables with empty default values
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''
ext["mavenCentralVersion"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
ext["mavenCentralVersion"] = System.getenv('PUBLISH_VERSION')
}

// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
//nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
//snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
Loading

0 comments on commit 0e1a0a1

Please sign in to comment.