Bug 550285 - tycho pomless should support target-definition builds
Summary: tycho pomless should support target-definition builds
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2019-08-21 01:32 EDT by Christoph Laeubrich CLA
Modified: 2021-04-28 16:51 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2019-08-21 01:32:41 EDT
Target definition files can be build with tycho also and it should be possible to use them pomless.
As the definition for this task is rather restrictive [1] it should be possible to derive all required information with the following chain:

- if there is exactly one target file use that
- if there is more than one target use that one that matches <foldername>.target
- else fail with a appropriate message

[1] https://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-target-definition
Comment 1 Eclipse Genie CLA 2019-08-21 05:31:03 EDT
New Gerrit change created: https://git.eclipse.org/r/148033
Comment 2 Christoph Laeubrich CLA 2019-08-21 05:49:30 EDT
I have provided an implementation, I also like to use this Review to discuss a more powerful approach of parsing and generation of metadata.

Currently we have two classes that handle all the stuff, manifest parsing, xml parsing, deciding what kind of metadata to use.

The problem is, that this getting more and more complex the more metadata we are able to parse. Second issue is, we have already detected the type in locatePom, and in the ModelParse we again try to find out what it is.

So I have investigated a litte bit more about how the Mapping class works and came up with the new structure:

- A baseclass that implements the MappingClass-Stuff and Modelparsing implementation (AbstractTychoMapping)
- A baseclass that extends this for xml parsing (AbstractXMLTychoMapping)
- the actual class to generate pom from target metadata (TychoTargetMapping) that implements a component only for this type of data

Using this approach we can have:
- One for manifest parsing
- One for feature parsing
- .. and so on ..

Just let me know what you think and if I should do the refactoring in a new change or in this change
Comment 3 Mickael Istria CLA 2019-08-21 05:59:30 EDT
I'm fine with the suggested refactoring as it's cleaner code and non API.
I'm just unsure we need so many different level of inheritance. At some point, parsing XML could be better in a utils class instead of super-class; composition is usually better than inheritance.
Comment 4 Christoph Laeubrich CLA 2019-08-21 06:03:35 EDT
in fact most artifacts are XML so I decided to add a class for that because it can inherit also the text-file encoding as UTF-8 (otherwise each implementation has to take care that it uses UTF-8 and calls the parser on the input).
Do you think I should start the refactoring right now in this ticket or open a new one?
Comment 5 Mickael Istria CLA 2019-08-21 06:11:14 EDT
(In reply to Christoph Laeubrich from comment #4)
> in fact most artifacts are XML so I decided to add a class for that because
> it can inherit also the text-file encoding as UTF-8 (otherwise each
> implementation has to take care that it uses UTF-8 and calls the parser on
> the input).
> Do you think I should start the refactoring right now in this ticket or open
> a new one?

I don't have a preference, as long as the tests still work, so feel free to do this in the way that feels the most productive to you.
Comment 7 Mickael Istria CLA 2019-08-26 04:15:55 EDT
Thanks Christoph!
Please add a note about it in https://wiki.eclipse.org/Tycho/Release_Notes/1.5#New_and_Noteworthy
Comment 8 Christoph Laeubrich CLA 2019-08-26 04:29:01 EDT
Done
Comment 9 Gunnar Wagenknecht CLA 2020-01-15 09:35:56 EST
I'm trying to get this to work but my build fails to resolve the target platform specification artifact.

I can see that it creates a .polyglot.....target file. Is there a way to debug the generated poms?