-
Notifications
You must be signed in to change notification settings - Fork 1
Add gradle build for the plugin #1
base: master
Are you sure you want to change the base?
Conversation
e443eba
to
89600d4
Compare
build.gradle
Outdated
} | ||
|
||
group = 'com.ullink.gradle' | ||
description 'Uses sonar-scanner-msbuild to do static analysis with Sonarqube.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the description we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, fixed it. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this project should be named gradle-extentreports-csharp-plugin, not dotnet, because it uses the extentreports-csharp project. Then it would be easier to find by others :)
- configure the appveyor and travis jobs - add empty plugin in order to have the setup done correctly for the plugin
Actually the reporting framework is called extentreports-dotnet-cli, so I think it is ok with the current naming (to avoid having the csharp part in the name) |
3a78ca1
to
c437425
Compare
class ReportGenerator extends Exec { | ||
|
||
def EXTENT_REPORT_TYPE = 'v3html' | ||
def EXTENT_REPORT_DOWNLOAD_URL = 'https://www.nuget.org/api/v2/package/extent/0.0.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can extract the version as separated property so project can upgrade to newer version easily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it. But it actually defines just the style of the generated html. I don't think we will actually configure this or have a lot of changes, so I let it be as it is for now.
|
||
class ReportGenerator extends Exec { | ||
|
||
def EXTENT_REPORT_TYPE = 'v3html' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
property that can be configured should use camel case not upper cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that this was the convention for consts in groovy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for constant yes, but it is now defined as a property of the task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ensureExtentReportIsAvailable() | ||
generateReports() | ||
} else { | ||
project.logger.info("There is no available Test Result file based on which the report should be generated located at ${project.tasks.nunit.getTestReporthPath()}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put a wrapper method around project.tasks.nunit.getTestReportPath() as it is used in multiple places
return new File(extentReportFolder, EXTENT_REPORT_EXECUTABLE_PATH) | ||
} | ||
|
||
void downloadExtentReport() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we separate the download of extent in a separate plugin and have this plugin depend on that?
Just to keep things cleaner
- use the extent-report framework - generate report once NUnit or OpenCover finished generating the report - added unit tests for report generation
authorId 'ekando' | ||
authorName 'Kando Eniko' | ||
authorEmail '[email protected]' | ||
projectUrl "https://github.com/Ullink/${project.name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's Itiviti now :)
projectUrl "https://github.com/Ullink/${project.name}" | |
projectUrl "https://github.com/Itiviti/${project.name}" |
} | ||
|
||
plugindev { | ||
pluginName 'com.ullink.gradle:gradle-extentreports-dotnet-plugin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a new plugin we should use the new group name com.itiviti
|
||
bintray { | ||
user project.properties.bintrayUser | ||
key project.properties.bintrayApiKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the plugindev documentation, bintray closure can be put after plugindev and it will assign user and key correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so if I understood correctly, I just need to move it after the plugindev and there is no need to specifically set the user & key ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it should be the case
[group: 'com.ullink.gradle', name: 'gradle-nunit-plugin', version: '1.14'], | ||
[group: 'com.ullink.gradle', name: 'gradle-opencover-plugin', version: '1.13'] | ||
) | ||
testCompile 'junit:junit:4.11' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think junit is needed to add explicitly when spock is used
@@ -0,0 +1 @@ | |||
version=1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
following semver is better, so it would be 1.0.0
void apply(Project project) { | ||
|
||
Task extentReportDownloaderTask = project.task('reportDownload', type: ReportGeneratorDownloader) | ||
Task reportingTask = project.task('nunitReport', type: ReportGenerator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add task group and description to show the task from ./gradlew tasks see here
|
||
class ReportGenerator extends Exec { | ||
|
||
def ExtentReportType = 'v3html' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming should be camel case
def ExtentReportType = 'v3html' | |
def extentReportType = 'v3html' |
|
||
class ReportGeneratorDownloader extends Download { | ||
|
||
def EXTENT_REPORT_DOWNLOAD_URL = 'https://www.nuget.org/api/v2/package/extent/0.0.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be camel case as well
furthermore, usually we try to extract the version out so we can upgrade easily, like opencover or nunit
} | ||
|
||
void downloadExtentReport() { | ||
def downloadedFile = new File(getTemporaryDir(), EXTENT_REPORT_DOWNLOADED_FILE_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do getTemporaryDir().createNewFile() instead, as the name is not really necessary to be a constant / variable
import spock.lang.Specification | ||
|
||
class ExtentReportDotnetPluginTest extends Specification{ | ||
@Rule TemporaryFolder testProjectDir = new TemporaryFolder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in spock, good thing is you don't need to new for the Rule
@Rule TemporaryFolder testProjectDir = new TemporaryFolder() | |
@Rule TemporaryFolder testProjectDir |
jobs