-
Notifications
You must be signed in to change notification settings - Fork 12
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
#5 Allow printing report to a JSON file #14
Open
paleloser
wants to merge
47
commits into
khmarbaise:master
Choose a base branch
from
paleloser:output-to-json
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
9db5583
feat: add .idea folder to .gitignore
ad5e24d
feat: add org.json dependency to pom.xml
d8cb153
feat: add toJSON function in DiscoveryTimer
8d5fed8
feat: add toJSON function in MojoTimer
acb3946
fix: move opening braces to next line
8eef35f
fix: move opening braces to next line in MojoTimer
7d90ac4
fix: change discoveryTime type from String to long
3c5c509
feat: add toJSON function in GoalTimer
8bd0f7b
feat: add toJSON function in InstallTimer
5369904
fix: refactor JSON output in InstallTimer
52493af
feat: add toJSON function in DownloadTimer
7daeaed
feat: add toJSON function in DeployTimer
8f0b3a3
feat: add toJSON function in MetadataInstallTimer
f71fb70
refactor: move all toJSON in AbstractMetadataTimer classes to parent …
d95e096
fix: remove toJSON function from MetadataInstallTimer
d5ddc8b
feat: add toJSON function in AbstractMetadataTimer
7637707
feat: add toJSON function in ProjectTimer
cda6914
refactor: move stdout report to report function
39b61b7
feat: use getters when the report is not a JSONObject
b71d479
feat: use getters when the report is not a JSONObject
f27c9ed
feat: add toJSON function in BuildTimeProfiler
7cedd23
fix: handle infinite values in AbstractArtifactTimer
541855f
feat: temporary feature to print JSON result
57b6adf
feat: define plugins and phases sections in JSON output
2a1bbb3
fix: error in plugins section JSON structure
33dd5a7
feat: make output report selectable via maven-buildtime-profiler-outp…
8cfae64
feat: make output file selectable via maven-buildtime-profiler-direct…
61f14a4
fix: read maven-buildtime-profiler-output instead of maven-buildtime-…
3c64d04
fix: missing return after printing report to file
9d43be8
fix: time in phase subgroup incrementing badly
37fa1ab
feat: improve IOException catch when writing to file
3ed233b
feat: update README
34a2dc7
fix: use target/ as the default output directory
f2f940b
fix: JSON metadata field structure and use hyphen separated names
0fbd446
feat: add none output mode
a63a74c
feat: update README
f0ef617
feat: add total build time metric to the JSON output
eb7086b
feat: use .name properties instead of -name
0af801c
feat: update README
9db829d
fix: remove unused imports
192b5fc
fix: remove more unused imports and leave untouched files equal
54eb3f7
feat: bump target jvm version to 1.8
8c46177
feat: add maven execution info to final report
d2592cb
fix: bump jvm to 1.8
9e296c9
fix: switch off json command property
68fff94
Merge branch 'master' of https://github.com/khmarbaise/maven-buildtim…
7e586f1
feat(config): enable setting config via system properties
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.soebes.maven.extensions; | ||
|
||
import org.apache.maven.execution.MavenExecutionRequest; | ||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
|
||
public class Execution | ||
{ | ||
|
||
private MavenExecutionRequest execution; | ||
|
||
private String command; | ||
|
||
public Execution() | ||
{ | ||
|
||
} | ||
|
||
public Execution(MavenExecutionRequest executionRequest) | ||
{ | ||
setExecutionRequest(executionRequest); | ||
} | ||
|
||
public void setExecutionRequest(MavenExecutionRequest executionRequest) | ||
{ | ||
this.execution = executionRequest; | ||
// initCommand(); | ||
} | ||
|
||
private void initCommand() { | ||
StringBuilder cmd = new StringBuilder("mvn"); | ||
|
||
if (this.execution.isUpdateSnapshots()) | ||
{ | ||
cmd.append(" ").append("-U"); | ||
} | ||
|
||
if (!this.execution.isRecursive()) | ||
{ | ||
cmd.append(" ").append("-N"); | ||
} | ||
|
||
this.execution.getActiveProfiles() | ||
.forEach(profile -> cmd.append(" -P").append(profile)); | ||
|
||
this.execution.getUserProperties() | ||
.keySet() | ||
.forEach(prop -> cmd.append(" -D").append(prop.toString())); | ||
|
||
this.execution.getGoals().forEach(goal -> cmd.append(" ").append(goal)); | ||
|
||
this.command = cmd.toString(); | ||
} | ||
|
||
public JSONObject toJSON() | ||
{ | ||
JSONObject execution = new JSONObject(); | ||
|
||
JSONArray goals = new JSONArray(); | ||
goals.put(this.execution.getGoals()); | ||
|
||
JSONObject userProperties = new JSONObject(); | ||
this.execution.getUserProperties() | ||
.keySet() | ||
.forEach(key -> userProperties.put((String) key, this.execution.getUserProperties().get(key))); | ||
|
||
JSONArray selectedProjects = new JSONArray(); | ||
selectedProjects.put(this.execution.getSelectedProjects()); | ||
|
||
JSONArray profiles = new JSONArray(); | ||
this.execution.getActiveProfiles().forEach(profiles::put); | ||
|
||
execution.put("goals", goals); | ||
execution.put("user-properties", userProperties); | ||
execution.put("selected-projects", selectedProjects); | ||
execution.put("active-profiles", profiles); | ||
// execution.put("command", this.command); | ||
|
||
return execution; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@paleloser Could we move these properties to extension parameters? Is that possible?
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 believe maven extensions don't allow parameters, as they don't work with Mojos: http://maven.apache.org/examples/maven-3-lifecycle-extensions.html
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.
Technically you could use a system property ....?
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.
Resolved at 7e586f1.