Skip to content

Commit

Permalink
Add new publish system for maven
Browse files Browse the repository at this point in the history
- clean up versioning.
  • Loading branch information
adibfara committed Aug 28, 2018
1 parent 9ed81a6 commit 28e23d2
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ buildscript {
google()
jcenter()
}
ext.kotlin_version = '1.2.31'
ext.kotlin_version = '1.2.61'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.1.0'

classpath 'com.android.tools.build:gradle:3.3.0-alpha06'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -24,6 +25,7 @@ allprojects {
}
}

subprojects { project -> apply from: rootProject.file('versions.gradle') }
task clean(type: Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Apr 01 19:13:46 IRDT 2018
#Tue Aug 28 07:38:07 IRDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
80 changes: 12 additions & 68 deletions livedataextensions/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

apply from: rootProject.file('publish.gradle')
android {
compileSdkVersion 27



defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
minSdkVersion versionNumbers.minSdk
targetSdkVersion versionNumbers.targetSdk
versionCode versionNumbers.versionCode
versionName versionNumbers.versionName

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testApplicationId "com.test.foo"
// Specifies the fully-qualified class name of the test instrumentation runner.
testInstrumentationRunner "android.test.InstrumentationTestRunner"


}

sourceSets {
Expand All @@ -39,73 +34,22 @@ android {

afterEvaluate {
android.sourceSets.all { sourceSet ->
if (!sourceSet.name.startsWith("test"))
{
if (!sourceSet.name.startsWith("test")) {
sourceSet.kotlin.setSrcDirs([])
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
implementation 'android.arch.lifecycle:extensions:1.1.1'
testImplementation 'org.mockito:mockito-core:2.8.9'
testImplementation("android.arch.core:core-testing:1.1.1", {
testImplementation libraries.junit
implementation libraries.kotlinSTDLib
testImplementation libraries.kotlinTestJunit
implementation libraries.archLifeCycle
testImplementation libraries.mockito
testImplementation(libraries.archCoreTesting, {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-core-utils'
})
}


apply plugin: 'maven'

group = 'com.snakydesign.livedataextensions'
version = '1.0'

ext {
//Specify your maven repository url here
repositoryUrl = 'ftp://your.maven.repository.com/maven2'
//Or you can use 'file:\\\\C:\\Temp' or 'maven-temp' for a local maven repository
}
configurations {
deployerJars
}
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
}

//Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

//Put the androidSources and javadoc to the artifacts
artifacts {
archives androidSourcesJar
archives javadocJar
}

uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: repositoryUrl) {
//if your repository needs authentication
authentication(userName: "username", password: "password")
}
}
}
}
31 changes: 31 additions & 0 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
def artifactoryUrl = "https://api.bintray.com/maven/adibfara/lives/"
apply from: rootProject.file('versions.gradle')

publishing.publications {
aar(MavenPublication) {
groupId "com.snakydesign.livedataextensions"
version = versionNumbers.versionName
artifactId = 'lives'
artifact("$buildDir/outputs/aar/$archivesBaseName-release.aar")
}
}

artifactory {
contextUrl = artifactoryUrl
publish {
repository {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
repoKey = 'lives/'
username = properties.getProperty('bintray.user')
password = properties.getProperty('bintray.apiKey')
}

defaults {
publishArtifacts = true
publications('aar')
}
}
}
27 changes: 27 additions & 0 deletions versions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ext.versionNumbers = [
gradle : '3.3.0-alpha06',
jfrog : '4.7.5',

kotlin : '1.2.60',
mockito : '2.8.9',
arch : '1.1.1',
junit : '4.12',

minSdk : 16,
targetSdk : 26,
versionCode: 2,
versionName: '1.1',
]

ext.libraries = [
gradle : "com.android.tools.build:gradle:$versionNumbers.gradle",
jfrog : "org.jfrog.buildinfo:build-info-extractor-gradle:$versionNumbers.jfrog",
kotlinGradle : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versionNumbers.kotlin",

kotlinSTDLib : "org.jetbrains.kotlin:kotlin-stdlib:$versionNumbers.kotlin",
kotlinTestJunit : "org.jetbrains.kotlin:kotlin-test-junit:$versionNumbers.kotlin",
mockito : "org.mockito:mockito-core:$versionNumbers.mockito",
archLifeCycle : "android.arch.lifecycle:extensions:$versionNumbers.arch",
archCoreTesting : "android.arch.core:core-testing:$versionNumbers.arch",
junit : "junit:junit:$versionNumbers.junit",
]

0 comments on commit 28e23d2

Please sign in to comment.