Skip to content

Commit

Permalink
Gradle Publish refactor, now supports jcenter and configuration by Sy…
Browse files Browse the repository at this point in the history
…stem.env
  • Loading branch information
Hazer committed May 30, 2017
1 parent 0c167be commit 5ffc06b
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 24 deletions.
4 changes: 1 addition & 3 deletions all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ dependencies {
api project(':migration')
api project(':sqlite')
api project(':rest')
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
}
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ buildscript {

GROUP = "io.vithor.frameworks.yaf"
VERSION_NAME = "1.0.0-rc2"

DEPLOY_TO = System.getenv("DEPLOY_TO") ?: "LOCAL"
}

repositories {
Expand All @@ -27,6 +29,9 @@ buildscript {
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.14"
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4'

if (DEPLOY_TO == "BINTRAY") {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
}

Expand All @@ -52,6 +57,9 @@ subprojects {
apply plugin: 'org.jetbrains.dokka-android'

apply plugin: 'maven-publish'
if (DEPLOY_TO == "BINTRAY") {
apply plugin: 'com.jfrog.bintray'
}

android {
compileSdkVersion compile_sdk_version
Expand Down Expand Up @@ -86,6 +94,14 @@ subprojects {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

apply from: new File("${rootProject.projectDir}/publish-base.gradle")

if (DEPLOY_TO == "LOCAL") {
apply from: new File("${rootProject.projectDir}/publish-local.gradle")
} else if (DEPLOY_TO == "BINTRAY") {
apply from: new File("${rootProject.projectDir}/publish-bintray.gradle")
}
}

task clean(type: Delete) {
Expand Down
1 change: 0 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ dependencies {
javadocDeps "com.android.support:support-annotations:${libraries.supportVersion}"
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
2 changes: 2 additions & 0 deletions fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json_key_file "" # Path to the json secret file - Follow https://github.com/fastlane/supply#setup to get one
package_name "io.vithor.frameworks.yaf" # e.g. com.krausefx.app
55 changes: 55 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.35.1"

default_platform :android

platform :android do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
end

desc "Runs all the tests"
lane :test do
gradle(task: "test")
end

desc "Deploy a new version to the jCenter"
lane :deploy_jcenter do
gradle(task: "assembleRelease")
gradle(task: "bintrayUpload")
end

after_all do |lane|
# This block is called, only if the executed lane was successful

# slack(
# message: "Successfully deployed new Update."
# )
end

error do |lane, exception|
# slack(
# message: exception.message,
# success: false
# )
end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://docs.fastlane.tools/actions

# fastlane reports which actions are used. No personal data is recorded.
# Learn more at https://github.com/fastlane/fastlane#metrics
1 change: 0 additions & 1 deletion gson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ dependencies {
api "com.google.code.gson:gson:2.8.0"
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
1 change: 0 additions & 1 deletion migration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ dependencies {
api 'com.j256.ormlite:ormlite-android:5.0'
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
1 change: 0 additions & 1 deletion mvp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
1 change: 0 additions & 1 deletion permissions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ dependencies {
}
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
12 changes: 0 additions & 12 deletions publish.gradle → publish-base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ def configureDependencies(Dependency dep, Node dependenciesNode) {
}

afterEvaluate {
publishing.repositories {
mavenLocal()

// maven {
// url "s3://guizion-artfactory/"
// credentials(AwsCredentials) {
// accessKey "${guizion_aws_accessid}"
// secretKey "${guizion_aws_accesskey}"
// }
// }
}

publishing.publications {
"${POM_ARTIFACT_ID}"(MavenPublication) {
//The publication doesn't know about our dependencies, so we have to manually add them to the pom
Expand Down
22 changes: 22 additions & 0 deletions publish-bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')

if (user == null || key == null) {
throw IllegalStateException("Bintray User and API Key must be provided when BINTRAY env is defined.")
}

publications = [POM_ARTIFACT_ID]

pkg {
repo = 'maven'
name = 'yaf'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/Hazer/YAFramework.git'
version {
name = VERSION_NAME
released = new Date()
vcsTag = VERSION_NAME
}
}
}
17 changes: 17 additions & 0 deletions publish-local.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
afterEvaluate {
publishing.repositories {
mavenLocal()

// if (PUBLISH_TO == "GUIZION") {
// maven {
// url "s3://guizion-artfactory/"
// credentials(AwsCredentials) {
// accessKey "${guizion_aws_accessid}"
// secretKey "${guizion_aws_accesskey}"
// }
// }
// } else {
// mavenLocal()
// }
}
}
2 changes: 1 addition & 1 deletion rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies {
api 'com.github.mrmike:ok2curl:0.3.1'
}

apply from: new File("${rootProject.projectDir}/publish.gradle")

1 change: 0 additions & 1 deletion sqlite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ dependencies {
api 'com.nivabit.kuery:sqlite:0.3'
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
1 change: 0 additions & 1 deletion ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ dependencies {
api 'com.github.bumptech.glide:glide:3.8.0'
}

apply from: new File("${rootProject.projectDir}/publish.gradle")
1 change: 0 additions & 1 deletion validation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ dependencies {
api "com.android.support:support-annotations:${libraries.supportVersion}"
}

apply from: new File("${rootProject.projectDir}/publish.gradle")

0 comments on commit 5ffc06b

Please sign in to comment.