Skip to content

Commit

Permalink
Readme updates
Browse files Browse the repository at this point in the history
Remove okhttp logger to reduce dependency list. Left code in place commented to enable ease of use in the future.

Remove unused rx dependencies

finish maven config for jitpack
  • Loading branch information
trevjonez committed Aug 17, 2016
1 parent b15bcee commit e5e656a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 25 deletions.
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ AndroidGithubRelease {
androidConfigs {
debug {
preRelease true
tagModifier { it + "-DEBUG" }
tagModifier { it + "-DEBUG" } // "1.0.0-DEBUG"
}
release {
draft true
Expand All @@ -46,55 +46,58 @@ AndroidGithubRelease {

The `defaultConfig` block as well as the named blocks have the following api options

- apiUrl(String) default: `https://api.github.com`
- owner(String) **required**
- repo(String) **required**
- apiUrl(String) default: `https://api.github.com`, base url for github api
- owner(String) **required**, username or organization name
- repo(String) **required**, name of the repository
- accessToken(String) **required**, key requires `repo` permission
- tagName(String) **required**
- tagName(String) **required**, name of new or existing tag
- targetCommitish(String) default: `master`, see [github api docs](https://developer.github.com/v3/repos/releases/#create-a-release) for details
- releaseName(String) _optional_
- releasebody(String) _optional_
- releaseName(String) _optional_, release title
- releasebody(String) _optional_, body content of release
- draft(boolean) default: `false`, flags the github release as a draft
- preRelease(boolean) default: `false`, flags the github release as a pre-release
- overwrite(boolean) default: `false`, allows release meta data to be updated, existing binaries must be manually deleted prior to re-upload
- tagModifier(Transformer<String, String>) _optional_
- assets(String vararg) _optional_, file or dir names relative to module dir
- tagModifier(Transformer<String, String>) _optional_, transformer for dynamic tag naming based on combined configuration
- assets(String vararg) _optional_, file or directory names relative to module directory, Any `asset` that is a directory will be zipped before being uploaded

### Advanced Config
For builds with flavors the named blocks are applied in a cascading override manner:
```groovy
AndroidGithubRelease {
defaultConfig {
...
tagName "A"
}
androidConfigs {
debug {
...
tagName "B"
}
release {
...
}
red {
...
tagName "C"
}
blue {
...
}
redDebug {
...
tagName "D"
}
}
}
```

The cascade order is `flavor(s)`->`type`->`fullVariantName`
The cascade order is `flavor(s)`->`type`->`fullVariantName`.
Following this ordering the above configs associated `createRedDebugGithubRelease` task would create a tag named "D", `createRedReleaseGithubRelease` would be "C", `createBlueDebugGithubRelease` would be "B", `createBlueReleaseGithubRelease` would be "A"

In a multi dimensional build the flavors are cascaded in the same order as listed in the variant name.

There are two exceptions to the cascading override:
1. `tagModifier` transformers which are applied in the cascade order
2. `assets` which are combined into a set

Any `asset` that is a directory will be zipped before being uploaded
1. `tagModifier` string transformers which are applied in the cascade order
2. `assets` do not override but are combined into a set

Tasks
-----
Expand Down
7 changes: 3 additions & 4 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ dependencies {
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version

compile group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3_version
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: okhttp3_version
// compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: okhttp3_version

compile group: 'com.squareup.retrofit2', name: 'retrofit', version: retrofit2_version
compile group: 'com.squareup.retrofit2', name: 'converter-moshi', version: retrofit2_version

compile group: 'io.reactivex', name: 'rxjava', version: '1.1.8'
compile group: 'io.reactivex', name: 'rxkotlin', version: '0.60.0'

compile group: 'com.android.tools.build', name: 'gradle', version: '2.1.2'

testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.5.2'
}

apply from: 'maven.gradle'
44 changes: 44 additions & 0 deletions plugin/maven.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2016. Trevor Jones
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'maven'

group = 'com.github.trevjonez'

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
}

install {
repositories.mavenInstaller {
pom.artifactId = 'AndroidGithubReleasePlugin'
pom.project {
inceptionYear '2016'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
5 changes: 2 additions & 3 deletions plugin/src/main/kotlin/com/trevjonez/agrp/AgrpTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.trevjonez.agrp.github.PendingRelease
import com.trevjonez.agrp.github.ReleaseService
import com.trevjonez.agrp.okhttp.HeaderInterceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import retrofit2.Retrofit
Expand All @@ -43,11 +42,11 @@ abstract class AgrpTask : DefaultTask() {

if (releaseService == null) {

val loggingInterceptor = HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.NONE)
// val loggingInterceptor = HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.NONE)
// .addInterceptor(loggingInterceptor)

val okhttp3 = OkHttpClient.Builder()
.addInterceptor(HeaderInterceptor("Accept", "application/vnd.github.v3+json"))
.addInterceptor(loggingInterceptor)
.build()

val retrofit = Retrofit.Builder()
Expand Down

0 comments on commit e5e656a

Please sign in to comment.