-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use system properties in Jacoco agent configuration #262
Use system properties in Jacoco agent configuration #262
Conversation
jacoco-agent.properties or "jacoco-agent." prefixed properties from commandline (offline and online instrumentation)
Why should JaCoCo implement its own variable substitution? Ant, Maven, Shell, CMD Scripts all support this already. |
For an offline instrumented build you cannot specify a dest file that is in a writable platform independent location. Adding the variable replacement allows to perform instrumented integration tests on different platforms and always outputting to the home directory. |
Java Code Coverage Tools » jacoco #321 SUCCESS |
Valid point. What configuration mechanism do you have in mind? |
I want to deploy a jacoco-agent.properties file as described in my initial comment. |
I did not update the documentation in offline instrumentation as it should also work for online instrumentation. Except if I did overlook something. |
Java Code Coverage Tools » jacoco #322 SUCCESS |
You implementation only works for offline parameters (properties files and system properties) which I think is ok. So documentation only applies to offline.html. As this is limited to offline instrumentation I don't think you need replaceproperties. Replacement could be allways active. |
Oh, I did not realize this only works in Offline-instrumentation. I wasn't aware of the class AgentOptions in org.jacoco.core. I fear overtime a use case for Online-instrumentation with such a mechanism might come up. I don't mind removing "replaceproperties". Anything else you want me to change? |
For offline agent configuration properties can now contain variables in ${name} format which will be replaced with system properties at runtime. Based on original PR by user 'debugger'.
Finally I found some time to bring this feature into master. I created a new single commit 0092055 with the following modifications:
|
New Feature enables Jacoco agent to output "exec" results to a platform dependent directory. Examples
java.io.tempdir
oruser.home
.Example setting the agent's
destfile
injacoco-agent.properties
:The replacement feature is disabled by default. It can be enabled by
adding
replaceproperties=true
in agent'sjacoco-agent.properties
. Alternatively the file'sconfiguration can be overridden by the system property
-Djacoco-agent.replaceproperties=true
on java commandline.
The initial escaping mechanism was removed due to conflicts with Windows paths and anonymous classes (for more details see documentation). Documentation has been updated and explains the effects of enabling
replaceproperties
.