Skip to content

Commit

Permalink
Version 2.2.8
Browse files Browse the repository at this point in the history
Fix #20
:ast change #typeClass to #getPlainNodeReference
memoize the result of changelog call
  • Loading branch information
BreadMoirai committed Apr 11, 2019
1 parent 007b02a commit 16329aa
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 118 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file added .idea/caches/gradle_models.ser
Binary file not shown.
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# github-release
[![Gradle Plugin Portal](https://img.shields.io/badge/version-2.2.7-blue.svg)](https://plugins.gradle.org/plugin/com.github.breadmoirai.github-release/2.2.7)
[![Gradle Plugin Portal](https://img.shields.io/badge/version-2.2.8-blue.svg)](https://plugins.gradle.org/plugin/com.github.breadmoirai.github-release/2.2.8)

[i20]: https://github.com/BreadMoirai/github-release-gradle-plugin/issues/20
[i19]: https://github.com/BreadMoirai/github-release-gradle-plugin/issues/19
[i17]: https://github.com/BreadMoirai/github-release-gradle-plugin/issues/17
[i16]: https://github.com/BreadMoirai/github-release-gradle-plugin/issues/16
Expand All @@ -15,6 +16,9 @@ This plugin is not endorsed by Github.
This plugin uses [OkHttp](http://square.github.io/okhttp/) to send a POST requests to the github api that creates a release and uploads specified assets.

## Changelog
2.2.8
- Address [#20][i20]. Change minimum supported version for Gradle to 4.10+ down from 5.x

2.2.7
- Address [#19][i19]. Replaced mime type detector with Apache Tika.

Expand Down
2 changes: 2 additions & 0 deletions ast/ast.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4" />
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ExtensionClassASTTransformation extends AbstractASTTransformation {
def transformation = new ExtensionPropertyASTTransformation()
ClassNode node = astNodes[1] as ClassNode
node.fields.each {
if (it.type.typeClass.name == Property.name) {
if (it.type.getPlainNodeReference().name == Property.name) {
transformation.visit([null, it] as ASTNode[], null)
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
}

group = 'com.github.breadmoirai'
version = '2.2.7'
version = '2.2.8'

repositories {
jcenter()
Expand Down
2 changes: 2 additions & 0 deletions github-release.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4" />
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package com.github.breadmoirai.githubreleaseplugin

import com.github.breadmoirai.githubreleaseplugin.ast.ExtensionClass
import com.github.breadmoirai.githubreleaseplugin.exceptions.PropertyNotSetException
import groovy.json.JsonSlurper
import groovy.transform.Memoized
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
Expand All @@ -28,6 +30,7 @@ import org.zeroturnaround.exec.ProcessExecutor

import java.util.concurrent.Callable

@ExtensionClass
class ChangeLogSupplier implements Callable<String> {

private final Project project
Expand All @@ -37,10 +40,10 @@ class ChangeLogSupplier implements Callable<String> {
private final Provider<CharSequence> authorization
private final Provider<CharSequence> tag

private final Property<CharSequence> executable
private final Property<CharSequence> currentCommit
private final Property<CharSequence> lastCommit
private final Property<List> options
final Property<CharSequence> executable
final Property<CharSequence> currentCommit
final Property<CharSequence> lastCommit
final Property<List> options
private final OkHttpClient client = GithubApi.client

ChangeLogSupplier(GithubReleaseExtension extension, Project project) {
Expand Down Expand Up @@ -130,6 +133,7 @@ class ChangeLogSupplier implements Callable<String> {
}

@Override
@Memoized
String call() {
println ':githubRelease Generating Release Body with Commit History'
CharSequence current = currentCommit.get()
Expand All @@ -156,104 +160,6 @@ class ChangeLogSupplier implements Callable<String> {
}
}



public void setCurrentCommit(Provider<? extends CharSequence> currentCommit) {
this.currentCommit.set(currentCommit)
}

public void currentCommit(Provider<? extends CharSequence> currentCommit) {
this.currentCommit.set(currentCommit)
}

public void setLastCommit(Provider<? extends CharSequence> lastCommit) {
this.lastCommit.set(lastCommit)
}

public void lastCommit(Provider<? extends CharSequence> lastCommit) {
this.lastCommit.set(lastCommit)
}

public void setOptions(Provider<List> options) {
this.options.set(options)
}

public void options(Provider<List> options) {
this.options.set(options)
}

public void setExecutable(Provider<CharSequence> gitExecutable) {
this.executable.set(gitExecutable)
}

public void executable(Provider<CharSequence> gitExecutable) {
this.executable.set(gitExecutable)
}

public void setCurrentCommit(Callable<? extends CharSequence> currentCommit) {
setCurrentCommit project.provider(currentCommit)
}

public void currentCommit(Callable<? extends CharSequence> currentCommit) {
setCurrentCommit project.provider(currentCommit)
}

public void setLastCommit(Callable<? extends CharSequence> lastCommit) {
setLastCommit project.provider(lastCommit)
}

public void lastCommit(Callable<? extends CharSequence> lastCommit) {
setLastCommit project.provider(lastCommit)
}

public void setOptions(Callable<List> options) {
setOptions project.provider(options)
}

public void options(Callable<List> options) {
setOptions project.provider(options)
}

public void setExecutable(Callable<CharSequence> gitExecutable) {
setExecutable project.provider(gitExecutable)
}

public void executable(Callable<CharSequence> gitExecutable) {
setExecutable project.provider(gitExecutable)
}

public void setCurrentCommit(CharSequence currentCommit) {
setCurrentCommit { currentCommit }
}

public void currentCommit(CharSequence currentCommit) {
setCurrentCommit { currentCommit }
}

public void setLastCommit(CharSequence lastCommit) {
setLastCommit { lastCommit }
}

public void lastCommit(CharSequence lastCommit) {
setLastCommit { lastCommit }
}

public void setOptions(List options) {
setOptions { options }
}

public void options(List options) {
setOptions { options }
}

public void setExecutable(CharSequence gitExecutable) {
setExecutable { gitExecutable }
}

public void executable(CharSequence gitExecutable) {
setExecutable { gitExecutable }
}

static Request.Builder createRequestWithHeaders(CharSequence authorization) {
return new Request.Builder()
.addHeader('Authorization', authorization.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ class GithubApi {
* @return The response containing the status code, status message, response headers, and the body as an object
*/
Response connect(String url, @DelegatesTo(Request.Builder) Closure closure) {
client.newCall(new Request.Builder().tap {
delegate.url url
defaultHeaders.each { name, value ->
header name, value
}
closure.setDelegate delegate
closure()
}.build()).execute().withCloseable { response ->
new Response(response.code(), response.message(), response.body().string(), response.headers().toMultimap())
def builder = new Request.Builder()
builder.url(url)
defaultHeaders.forEach { name, value ->
builder.header name, value
}
closure.setDelegate(builder)
closure()
def response = client.newCall(builder.build()).execute()
def r = new Response(response.code(), response.message(), response.body().string(), response.headers().toMultimap())
response.close()
return r
}

Response findReleaseByTag(CharSequence owner, CharSequence repo, CharSequence tagName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class GithubReleaseExtension {
final ConfigurableFileCollection releaseAssets

final Project project
private final ChangeLogSupplier changeLogSupplier

@SuppressWarnings("GroovyAssignabilityCheck")
GithubReleaseExtension(Project project) {
Expand Down Expand Up @@ -139,16 +140,16 @@ class GithubReleaseExtension {
overwrite { false }
allowUploadToExisting { false }
apiEndpoint { GithubApi.endpoint }
changeLogSupplier = new ChangeLogSupplier(this, project)
}

Callable<String> changelog(@DelegatesTo(ChangeLogSupplier) final Closure closure) {
def c = new ChangeLogSupplier(this, project)
c.with closure
return c
changeLogSupplier.with closure
return changeLogSupplier
}

Callable<String> changelog() {
return new ChangeLogSupplier(this, project)
return changeLogSupplier
}

ConfigurableFileCollection getReleaseAssets() {
Expand Down

0 comments on commit 16329aa

Please sign in to comment.