diff --git a/README.md b/README.md index ef9c581b..ba459efe 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,27 @@ Util library used as a wrapper around WiFi and Connectivity manager for Android [![Build Status](https://travis-ci.org/isuPatches/WiseFy.svg?branch=master)](https://travis-ci.org/isuPatches/WiseFy) +[ ![Download](https://api.bintray.com/packages/isupatches/Maven/wisefy/images/download.svg) ](https://bintray.com/isupatches/Maven/wisefy/_latestVersion) + +## Adding to your project + +Gradle: + +``` +compile 'com.isupatches:wisefy:1.0.5' +``` + +Maven: + +``` + + com.isupatches + wisefy + 1.0.5 + pom + +``` + ## Getting An Instance WiseFy now supports the builder pattern so cool functionality can be added later! @@ -21,8 +42,6 @@ To grab an instance with logging enabled: WiseFy mWiseFy = new WiseFy.withContext(getActivity()).logging(true).getSmarts(); ``` -**IMPORTANT!** Please make sure you call withContext for WiseFy to work properly - ## Commands To add an open network: diff --git a/app/build.gradle b/app/build.gradle index 09e1e3aa..79b965ab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,10 +1,9 @@ apply plugin: 'com.android.library' apply plugin: 'jacoco' apply plugin: 'com.getkeepsafe.dexcount' -apply plugin: "com.github.dcendents.android-maven" -group = 'com.isupatches' -version = '1.0.4' +group = rootProject.ext.GROUP +version = rootProject.ext.VERSION_NAME def coverageSourceDirs = [ '../app/src/main/java' @@ -100,57 +99,6 @@ dependencies { testCompile 'junit:junit:4.12' } -install { - repositories.mavenInstaller { - pom { - project { - artifactId 'wisefy' - packaging 'aar' - - name 'WiseFy' - url 'https://github.com/isuPatches/WiseFy' - - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id 'isuPatches' - name 'Sarah Klinefelter' - email 'isuPatches@yahoo.com' - } - } - scm { - connection 'https://github.com/isuPatches/WiseFy.git' - developerConnection 'https://github.com/isuPatches/WiseFy.git' - url 'https://github.com/isuPatches/WiseFy' - } - } - } - } -} - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} -task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - destinationDir = file("../javadoc/") - failOnError false -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -artifacts { - archives javadocJar - archives sourcesJar -} +apply from: rootProject.file('gradle/gradle-bintray-install.gradle') +apply from: rootProject.file('gradle/gradle-bintray-upload.gradle') \ No newline at end of file diff --git a/build.gradle b/build.gradle index 44c32b5a..489b960a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,7 @@ buildscript { classpath 'com.android.tools.build:gradle:2.2.2' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.6' classpath "com.github.dcendents:android-maven-gradle-plugin:1.5" + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.2' classpath "org.jacoco:org.jacoco.core:0.7.7.201606060606" classpath "org.jacoco:org.jacoco.agent:0.7.7.201606060606" classpath "org.jacoco:org.jacoco.report:0.7.7.201606060606" @@ -41,4 +42,32 @@ subprojects { } } } +} + +ext { + GROUP = "com.isupatches" + VERSION_NAME = "1.0.5" + + BINTRAY_REPO = "Maven" + BINTRAY_NAME = "wisefy" + + LIBRARY_DESCRIPTION = "Wrapper around WifiManager and ConfigurationManager for Android" + + POM_PACKAGING = "aar" + POM_DESCRIPTION = "wisefy" + POM_URL = "https://github.com/isuPatches/WiseFy" + + POM_SCM_URL = "https://github.com/isuPatches/WiseFy" + POM_SCM_ISSUE_URL = 'https://github.com/isuPatches/WiseFy/issues' + POM_SCM_CONNECTION = "scm:git:https://github.com/isuPatches/WiseFy.git" + POM_SCM_DEV_CONNECTION = "scm:git:git@github.com:isuPatches/WiseFy.git" + + POM_LICENSE_NAME = "The Apache Software License, Version 2.0" + POM_LICENSE_URL = "http://www.apache.org/licenses/LICENSE-2.0.txt" + POM_LICENSE_DIST = "repo" + ALL_LICENSES = ["Apache-2.0"] + + POM_DEVELOPER_ID = "isuPatches" + POM_DEVELOPER_NAME = "Patches Klinefelter" + POM_DEVELOPER_EMAIL = "isuPatches@yahoo.com" } \ No newline at end of file diff --git a/gradle/gradle-bintray-install.gradle b/gradle/gradle-bintray-install.gradle new file mode 100644 index 00000000..6e50fdf1 --- /dev/null +++ b/gradle/gradle-bintray-install.gradle @@ -0,0 +1,40 @@ +// Source: https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle + +apply plugin: 'com.github.dcendents.android-maven' + +group = GROUP // Maven Group ID for the artifact + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom.project { + packaging POM_PACKAGING + groupId GROUP + artifactId BINTRAY_NAME + + name POM_DESCRIPTION + description LIBRARY_DESCRIPTION + url POM_URL + + // Set your license + licenses { + license { + name POM_LICENSE_NAME + url POM_LICENSE_URL + } + } + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + email POM_DEVELOPER_EMAIL + } + } + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + } + } +} \ No newline at end of file diff --git a/gradle/gradle-bintray-upload.gradle b/gradle/gradle-bintray-upload.gradle new file mode 100644 index 00000000..298c298f --- /dev/null +++ b/gradle/gradle-bintray-upload.gradle @@ -0,0 +1,66 @@ +// Source: https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle + +apply plugin: 'com.jfrog.bintray' + +version = VERSION_NAME + +if (project.hasProperty("android")) { // Android libraries + task sourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.srcDirs + } + + task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } +} else { // Java libraries + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar +} + +// Bintray +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) + +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + + println("user: " + user) + println("key: " + key) + + + configurations = ['archives'] + pkg { + repo = BINTRAY_REPO + name = BINTRAY_NAME + desc = LIBRARY_DESCRIPTION + websiteUrl = POM_URL + vcsUrl = POM_SCM_URL + issueTrackerUrl = POM_SCM_ISSUE_URL + licenses = ALL_LICENSES + labels = ['Wifi', 'WifiManager', 'ConnectivityManager', 'Android', 'isuPatches', 'Patches'] + publish = true + publicDownloadNumbers = true + version { + desc = LIBRARY_DESCRIPTION + gpg { + sign = true // Determines whether to GPG sign the files. The default is false + passphrase = properties.getProperty("bintray.gpg.password") // Optional. The passphrase for GPG signing' + } + } + } +} \ No newline at end of file