Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom arguments and environment variables. #33

Merged
merged 20 commits into from
Jul 7, 2017
Merged

Conversation

panekzogen
Copy link
Contributor

Added possibility to set custom arguments and environment variables.

One bug fixed: michel-kraemer/gradle-download-task#47

@panekzogen panekzogen closed this Sep 6, 2016
@qliklars
Copy link

Is there a reason for closing but nor merging this PR?
We are very interested in the environment variable support that is added in this PR.
Is there any easy workaround with the current plugin?

@@ -31,6 +31,9 @@ class NUnit extends ConventionTask {
def test
def testList

Map<String, Object> custom = [:]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename this to extraCommandLineArgs

@timotei
Copy link
Contributor

timotei commented Oct 22, 2016

Sorry for the delay on reviewing this :(

First of all, thanks for the contribution!

For the custom extra arguments, are there any specific ones? Maybe we should add them as properties in the plugin itself instead.

@timotei timotei reopened this Oct 22, 2016
@@ -31,6 +31,9 @@ class NUnit extends ConventionTask {
def test
def testList

Map<String, Object> custom = [:]
Map<String, Object> env = [:]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please update the README.md sample, so everybody will know about these two properties?

@panekzogen
Copy link
Contributor Author

Reasons for closing this PR:

@panekzogen
Copy link
Contributor Author

I'm interesting in /labels /noshadow /nologo /timeout /output and /xml without prefix. But in my opinion adding extra arguments field is more flexible solution.

@timotei
Copy link
Contributor

timotei commented Oct 24, 2016

👍 from me

@gluck
Copy link
Contributor

gluck commented Oct 26, 2016

I'm not fond of generic pass-through variables, as it defeats the purpose of having a plugin in the first place (if all you want is write the nunit command-line yourself, nothing will do a better job as using an Exec task directly).
For the options you mention, labels/noshadow/timeout/xml are already available, I'd say that nologo should be set by default, so only /output remains. An option could be added, though the common practice (to my knowledge) is to have UT text report in your build log rather than a separate file.

I assume these options come from migrating from a script build approach ?

@gluck
Copy link
Contributor

gluck commented Oct 26, 2016

(note that I upgraded gradle/download/httpclient on master and released 1.9 with it, should fix gradle-related issues)

@qliklars
Copy link

@gluck : What about the env var support? We are passing environment variables that control the placement of test artifacts in prebuilt C# test assemblies.
Do you have a suggestion for them?

@gluck
Copy link
Contributor

gluck commented Oct 26, 2016

Totally okay with that one, I missed the fact it was your pain point or I would have included it in the earlier release sorry.
Feel free to PR just that

@panekzogen
Copy link
Contributor Author

Yes these options from migration.
Finally i added output option and env variables. From my point of view output option will not be superfluous.

@OutputFile
File getTestReportPath() {
// for the non-default nunit tasks, ensure we write the report in a separate file
// TODO: Do we need to supply prefix when user has specified its own report file name?
def reportFileNamePrefix = name == 'nunit' ? '' : name
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason to remove this prefix ? in case you have mutliple nunit tasks in your build, they'll have the same report file if you remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no possibility to specify name without prefix. But user still can set the same report file in own tasks.

Copy link
Contributor

Choose a reason for hiding this comment

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

@taomWTP Well, in the new change we won't have this prefix anymore by default. How about if the user does not specify the report file, we keep the previous behaviour? But even so, I don't see why this change is needed for this PR 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, this change isn't needed for this PR, but it solves the problem that i mentioned above. I can open another PR for it if you want.
When making this change I was taking into account the fact that if user didn't specify report file, he doesn't really need it and we can follow the nunit default behavior that store all results in TestResult.xml.

There is another solution that keeps the previous behavior. It was written in your TODO comment. Namely, prefix won't be used when user specified his own report file name. I think this is more tolerant solution if you want to keep previous behavior. I will do this if you agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

When making this change I was taking into account the fact that if user didn't specify report file, he doesn't really need it

I hear you, but we can't be sure we don't break lots of usages out there, that rely on the xml being named by the plugin automatically, based on the task name. That's why I'd say we should aim at keeping a backwards compat behavior if possible and if it doesn't prevent us from evolving.

@gluck @bcorne Feedback on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose, that you will agree with new changes.

README.md Outdated
@@ -41,16 +41,24 @@ It creates a task 'nunit' that may be configured as follows:
// optional - defaults to FALSE and termines the behavior of the task if the nunit-console.exe program exits
// abnormally
ignoreFailures = false

// optional - specify whether to write test case names to the output
Copy link
Contributor

Choose a reason for hiding this comment

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

kind'o weird to see this change as it's already on master

README.md Outdated
shadowCopy = true
// redirect output to file
// additionally you can specify logFolder
logFileName = 'TestOutput.log'
Copy link
Contributor

Choose a reason for hiding this comment

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

did you consider putting a single argument (outputFile or something) for both ? reportFolder was split because it's used in other places, not sure we need the same here and it'll be simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, single argument will be simpler. I'll change this in the next commit.

@@ -215,6 +228,7 @@ class NUnit extends ConventionTask {
prepareExecute()

def mbr = project.exec {
environment env
Copy link
Contributor

Choose a reason for hiding this comment

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

any idea (I didn't check) if when env is empty this will change the behavior from the previous plugin version (still inherits process env variables right ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clarify please

Copy link
Contributor

Choose a reason for hiding this comment

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

What @gluck Is saying is: if env returns empty/null, will that change the way the project.exec works? i.e.,: will it work the same as if no environment has been specific

@timotei
Copy link
Contributor

timotei commented Dec 17, 2016

Btw, you should rebase against latest changes, seems there are some conflicts on README.md

@panekzogen
Copy link
Contributor Author

Environment method is based on Map.putAll(). That's why empty env does not change execution, but null causes NullPointerException. I fixed it.
Integration crashes on nunit 3.5 test. What will we do about it?
Sorry for a delay.

@panekzogen
Copy link
Contributor Author

Why don't you merge the request?

@kuniss
Copy link

kuniss commented Jul 7, 2017

When do you plan to merge this pull request?
I'm also interested in having the possibility to define environment variables...

BTW, great work! Thank you for the Ullink Gradle plugins!

@gluck gluck merged commit 8ddec4a into Itiviti:master Jul 7, 2017
@gluck
Copy link
Contributor

gluck commented Jul 7, 2017

Long overdue, sorry !

@kuniss
Copy link

kuniss commented Jul 7, 2017

Great! Thanks!

I guess some one needs to push a release?
Version 1.11 is not released yet on plugins.gradle.org ...

Or is on the way? Did not see it on AppVeyor nor Travis.

@ngyukman
Copy link
Contributor

ngyukman commented Jul 8, 2017

will do a release once the fix for #42 is ready, thanks for patient

@kuniss
Copy link

kuniss commented Jul 11, 2017

@ngyukman I saw the release 1.11 is done on GitHub. Thank you!
When do you plan to publish it to https://plugins.gradle.org/plugin/com.ullink.nunit?

@ngyukman
Copy link
Contributor

@kuniss sorry that we are having some problem with the release in https://plugins.gradle.org/
but you can reference to the maven repo https://bintray.com/ullink/gradle-plugins/com.ullink.gradle:gradle-nunit-plugin for now, we will fix it once we have resolved the release issue

@kuniss
Copy link

kuniss commented Jul 13, 2017 via email

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

Successfully merging this pull request may close these issues.

NoClassDefFoundError while downloading on Gradle-3.0-milestone-1
6 participants