Skip to content
This repository has been archived by the owner on Dec 20, 2019. It is now read-only.

Add gradle build for the plugin #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kandoeniko
Copy link

  • configure the appveyor and travis
    jobs

@kandoeniko kandoeniko force-pushed the master branch 3 times, most recently from e443eba to 89600d4 Compare April 17, 2019 12:03
build.gradle Outdated
}

group = 'com.ullink.gradle'
description 'Uses sonar-scanner-msbuild to do static analysis with Sonarqube.'
Copy link

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, fixed it. Thanks!

Copy link

@tephe tephe left a 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
@kandoeniko
Copy link
Author

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)

@kandoeniko kandoeniko force-pushed the master branch 2 times, most recently from 3a78ca1 to c437425 Compare April 18, 2019 14:22
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'
Copy link
Collaborator

@ngyukman ngyukman Apr 23, 2019

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?

Copy link
Author

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'
Copy link
Collaborator

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

Copy link
Author

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 :)

Copy link
Collaborator

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

Copy link
Author

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()}")
Copy link

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() {
Copy link

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}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's Itiviti now :)

Suggested change
projectUrl "https://github.com/Ullink/${project.name}"
projectUrl "https://github.com/Itiviti/${project.name}"

}

plugindev {
pluginName 'com.ullink.gradle:gradle-extentreports-dotnet-plugin'
Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Author

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 ?

Copy link
Collaborator

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'
Copy link
Collaborator

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
Copy link
Collaborator

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)
Copy link
Collaborator

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'
Copy link
Collaborator

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

Suggested change
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'
Copy link
Collaborator

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)
Copy link
Collaborator

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()
Copy link
Collaborator

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

Suggested change
@Rule TemporaryFolder testProjectDir = new TemporaryFolder()
@Rule TemporaryFolder testProjectDir

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants