-
Couldn't load subscription status.
- Fork 727
Add lpkg as java package format #694
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
Conversation
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.
Thanks for doing this! One question for you to chat about re: testing
| "**/*.lpkg", // Zip-compressed package used to deploy applications | ||
| // (aka plugins) to Liferay users that can be installed on their | ||
| // websites, contains .JAR files and a .PROPERTIES file, the latter | ||
| // has information about the application and installation requirements. |
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.
What do you think it would look like to add a test for this?
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 added a file test. Their docs and tools are pretty outdated and I can't find sample projects, even on GitHub.
EDIT: found projects but building them into lpkg's is done via Liferay proprietary tools that don't have a place in our CI
linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]>
Signed-off-by: Jonas Galvão Xavier <[email protected]>
Signed-off-by: Jonas Galvão Xavier <[email protected]>
Signed-off-by: Jonas Galvão Xavier <[email protected]>
Signed-off-by: Jonas Galvão Xavier <[email protected]>
Signed-off-by: Jonas Galvão Xavier <[email protected]>
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 looks like all of these changes are gofmt or goimports except for archive_filename.go, archive_filename_test.go, and archive_parser.go, unless they are causing failures with the PR, maybe just include the relevant changes to make a review a bit more concise? I don't see any .lpkg files included, though, which makes me think there is limited testing for this - is it sufficient?
| "github.com/anchore/syft/syft/artifact" | ||
| "github.com/jinzhu/copier" |
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.
nit: prefer not to include import-only changes, I think?
Signed-off-by: Jonas Galvão Xavier <[email protected]>
|
@kzantow while exploring the project my editor found places that were not properly formatted, I will try not to pollute PR too much going forward. On testing: we don't add jar/war/hpi files within the repo, that is why there are automated building steps for most formats but war. War files are a super set of jar plus Servlet, JSP, HTML, JavaScript, but we only care about their jar content. Lpkg files are jars plus a property file. I wrote lpkg tests based off war validation that seems sufficient. |
| if _, ok := metadata.Manifest.Main[field]; ok { | ||
| delete(metadata.Manifest.Main, field) | ||
| } | ||
| delete(metadata.Manifest.Main, field) |
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 like that this simplifies the test! Just for my own sake, why do we no longer need this check for ok?
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.
Go is smart:
The delete built-in function deletes the element with the specified key (m[key]) from the map. If m is nil or there is no such element, delete is a no-op.
| var i interface{} | ||
| i = test.metadata | ||
| actual := i.(FileOwner).OwnedFiles() | ||
| actual := test.metadata.OwnedFiles() |
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.
Nice!
What change went in that made so that metadata no longer hast to be cast to FileOwner I don't see it in this code diff so did we update something in another repo?
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.
Maybe this jonasagx@93d00dc
However, if test.metadata implements FileOwner there is no need to cast it. Deep equal accepts interface{} so any type can be compared.
PS: <3 hast
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.
This looks okay; I would definitely like to have some sort of tests beyond the one included but I understand the difficulty adding these tests due to Liferay's paid development model. The only other issue I have is that there are really only 3 files with changes but a lot of what appear to be unrelated things in the PR -- in particular goimports formatting and:
- var i interface{}
- i = test.metadata
- actual := i.(FileOwner).OwnedFiles()
+ actual := test.metadata.OwnedFiles()
and
- if _, ok := metadata.Manifest.Main[field]; ok {
- delete(metadata.Manifest.Main, field)
- }
+ delete(metadata.Manifest.Main, field)
I would probably just remove those changes and have the pertinent stuff in here, but they all look like improvements so I wouldn't hold up merging this on account of them!
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]>
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]> Signed-off-by: Christopher Angelo Phillips <[email protected]>
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]> Signed-off-by: Christopher Angelo Phillips <[email protected]>
…hub.com/hectorj2f/syft into hectorj2f/add_dependencies_to_cyclonedx * 'hectorj2f/add_dependencies_to_cyclonedx' of https://github.com/hectorj2f/syft: (29 commits) Improve CycloneDX format output (#710) Add additional PHP metadata (#753) Update Syft formats for SyftJson (#752) Add support for "file" source type in syftjson unmarshaling (#750) remove contains file from spdx dependency generation support .sar for java ecosystem (#748) Start developer documentation (#746) Align SPDX export more with SPDX 2.2 specification (#743) Replace distro type (#742) update goreleaser with windows checksums (#740) bump stereoscope version to remove old containerd (#741) Add support for multiple output files in different formats (#732) Add support for searching for jars within archives (#734) 683 windows filepath (#735) Fix CPE encode/decode when it contains special chars (#714) support .par for java ecosystems (#727) Add arm64 support to install script (#729) Revert "bump goreleaser to v1.2 (#720)" (#731) Add a version flag (#722) Add lpkg as java package format (#694) ...
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]> Signed-off-by: fsl <[email protected]>
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]> Signed-off-by: Christopher Phillips <[email protected]>
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]>
* add lpkg support to java cataloger linter clean up Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment formatting Signed-off-by: Jonas Galvão Xavier <[email protected]> * add filename test for lpkg Signed-off-by: Jonas Galvão Xavier <[email protected]> * commment on lpkg file extension tests Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix comment typo Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix import format Signed-off-by: Jonas Galvão Xavier <[email protected]> * simpler test validation Signed-off-by: Jonas Galvão Xavier <[email protected]>
also cleaned up linter warning
Closes: #682
Signed-off-by: Jonas Galvão Xavier [email protected]