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

Add non-IU artifact repositories to the planner resolution #874 #962

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

ptziegler
Copy link
Contributor

Given that units from non-IU locations are considered when resolving IUs, it may happen that units are contained in the resolution path, which are not contained by any repository. This may break previously functional target definitions.

To resolve this problem, an in-memory artifact and metadata repository is created, based on the metadata of the non-IU locations. Those repositories are then added to the provisioning context for further processing.

Amends dd321b5

@ptziegler ptziegler changed the title Add non-IU artifact repositories to the planner resolution #792 Add non-IU artifact repositories to the planner resolution #874 Dec 1, 2023
@ptziegler
Copy link
Contributor Author

The initial draft is looking good and the target definition is finally able to resolve again~
image

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

I really like this approach, just a few comments and Jenkins reports some compiler warnings (even though they are not displayed correctly here).

@laeubi
Copy link
Contributor

laeubi commented Dec 2, 2023

@jukzi as you are recently concerned about warnings, this is an example where one can see new warnings reported by Jenkins:
grafik
it is also shown in the code review (even though for some reason missing the message)
grafik
and the overview
grafik

@ptziegler sorry for the offtopic :-)

@vogella
Copy link
Contributor

vogella commented Dec 2, 2023

@laeubi could we fail the verification if new warnings are introduced?

@laeubi
Copy link
Contributor

laeubi commented Dec 2, 2023

@laeubi could we fail the verification if new warnings are introduced?

Yes we can

Copy link

github-actions bot commented Dec 2, 2023

Test Results

     270 files  ±0       270 suites  ±0   52m 42s ⏱️ + 7m 21s
  3 329 tests +2    3 299 ✔️ +2  30 💤 ±0  0 ±0 
10 284 runs  +6  10 194 ✔️ +6  90 💤 ±0  0 ±0 

Results for commit bef392a. ± Comparison against base commit eb34cab.

♻️ This comment has been updated with latest results.

@ptziegler
Copy link
Contributor Author

I've cleaned up the FileArtifactRepository and so far, everything should work. In case of artifical features, I create an in-memory jar only containing the feature.xml. Otherwise the location URL/path is used.

Note that I've renamed the repositories from FileRepository to VirtualRepository, given that they don't work on files anymore, so their name makes little sense anymore.

What I still need to figure out is how to properly inject the repositories into the provisioning context.
Reflection works, but it's not the correct solution...

I probably need proper setter methods... given that the indented extension points are not an option.

@laeubi
Copy link
Contributor

laeubi commented Dec 2, 2023

What I still need to figure out is how to properly inject the repositories into the provisioning context.
Reflection works, but it's not the correct solution...

Extending the Provisiong context like you did seems a proper soloution to me...

@ptziegler
Copy link
Contributor Author

What I still need to figure out is how to properly inject the repositories into the provisioning context.
Reflection works, but it's not the correct solution...

Extending the Provisiong context like you did seems a proper soloution to me...

Overwriting the method probably works, then, but certainly not the way it's currently done: :P

Field f = oldQueryable.getClass().getDeclaredField("repositories");
f.setAccessible(true);
artifactRepositories.addAll((List<IArtifactRepository>) f.get(oldQueryable));

@ptziegler
Copy link
Contributor Author

What I still need to figure out is how to properly inject the repositories into the provisioning context.
Reflection works, but it's not the correct solution...

Extending the Provisiong context like you did seems a proper soloution to me...

Overwriting the method probably works, then, but certainly not the way it's currently done: :P

Field f = oldQueryable.getClass().getDeclaredField("repositories");
f.setAccessible(true);
artifactRepositories.addAll((List<IArtifactRepository>) f.get(oldQueryable));

Found the solution already: I can simply use a CompoundQueryable

@laeubi
Copy link
Contributor

laeubi commented Dec 2, 2023

ProvisioningContext context = new ProvisioningContext(agent) {
	@Override
	public IQueryable<IArtifactRepository> getArtifactRepositories(IProgressMonitor monitor) {
	 	... enhance here ...
	}

	public IQueryable<IInstallableUnit> getMetadata(IProgressMonitor monitor) {
	 	... enhance here ...
	}
};

Found the solution already: I can simply use a CompoundQueryable

👍

@laeubi
Copy link
Contributor

laeubi commented Dec 2, 2023

@ptziegler there is even org.eclipse.equinox.p2.query.QueryUtil.compoundQueryable(IQueryable<T>, IQueryable<T>)

@merks
Copy link
Contributor

merks commented Dec 2, 2023

@ptziegler

I’m impressed by your resourcefulness! 🏆

@ptziegler
Copy link
Contributor Author

The usage of reflection has also been removed. That should be it, from my side.

@ptziegler
Copy link
Contributor Author

The new warning is unrelated to this change.

[INFO] --- tycho-p2-extras:4.0.5-SNAPSHOT:compare-version-with-baselines (compare-attached-artifacts-with-release) @ org.eclipse.pde.unittest.junit ---
[WARNING] Parameter 'comparator' is read-only, must not be used in configuration

@jukzi jukzi dismissed their stale review December 2, 2023 20:51

warnings gone

@laeubi
Copy link
Contributor

laeubi commented Dec 3, 2023

The new warning is unrelated to this change.

[INFO] --- tycho-p2-extras:4.0.5-SNAPSHOT:compare-version-with-baselines (compare-attached-artifacts-with-release) @ org.eclipse.pde.unittest.junit ---
[WARNING] Parameter 'comparator' is read-only, must not be used in configuration

Yes this is sadly due to new maven version adding new warnings :-
I think I will simply mark the parameter as readable to get rid of it:

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Just one finding left, otherwise it looks good. 👍

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Looks good now, many thanks for your efforts in improving/fixing this.

@laeubi laeubi linked an issue Dec 3, 2023 that may be closed by this pull request
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

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

Thank you @ptziegler for this PR.
This is good work and the functionality looks good.
Nevertheless I have a bunch of coding-style related remarks that should make some part simpler or more readable.

Because I was a bit short in time and didn't review this in the IDE, some remarks might not be applicable but are worth checking.

@ptziegler
Copy link
Contributor Author

I hope I got all codestyle changes now...

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

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

Thank you for the updates.
I agree with all answers and just have one small suggestion to further simplify the copy.

With that being applied this is a perfectly fine change and also ready from my side.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

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

Thank you.
This looks very good now 👍🏽

@laeubi
Copy link
Contributor

laeubi commented Dec 4, 2023

I just wanted to note that the issue with two new maven warnings can be ignored if build/test is otherwise fine! I'm try to get rid of the warnings but its not that easy at least one of them should be fixed with this:

but will need probably 1 hour unless it show up.

@ptziegler
Copy link
Contributor Author

ptziegler commented Dec 4, 2023

Hm... I checked the generated feature.jar and now it's empty again...

image

There's clearly something about the BND tool that I'm doing wrong... argh

@HannesWell
Copy link
Member

HannesWell commented Dec 4, 2023

There's clearly something about the BND tool that I'm doing wrong... argh

Can't you just use the standard java Jar/ZipOutputstream or Jar/ZipFile instead of BND's Jar?

@ptziegler
Copy link
Contributor Author

There's clearly something about the BND tool that I'm doing wrong... argh

Can't you just use the standard java Jar/ZipOutputstream or Jar/ZipFile instead of BND's Jar?

That's what I'm really tempted to do at this point. Debugging suggests the output-stream is never closed, but given that the BND class is 100% undocumented, I can't say whether that's by intent or what to do about it.

@HannesWell
Copy link
Member

There's clearly something about the BND tool that I'm doing wrong... argh

Can't you just use the standard java Jar/ZipOutputstream or Jar/ZipFile instead of BND's Jar?

That's what I'm really tempted to do at this point. Debugging suggests the output-stream is never closed, but given that the BND class is 100% undocumented, I can't say whether that's by intent or what to do about it.

Please go for it. In general using standard Java instead of custom solutions should be preferred if the solutions are equivalent.

In general at the point when transfering the feature model to the destination OutputStrram what is the intended output? Should it just be the feature.xml or should it be in a jar?

@HannesWell
Copy link
Member

In general at the point when transfering the feature model to the destination OutputStrram what is the intended output? Should it just be the feature.xml or should it be in a jar?

Looking at the code again, it is probably indeed a jar necessary.

@ptziegler ptziegler force-pushed the issue874 branch 2 times, most recently from 946cbfe to 9336f7f Compare December 4, 2023 21:26
@ptziegler
Copy link
Contributor Author

Looking at the code again, it is probably indeed a jar necessary.

That was my impression as well.

Please go for it. In general using standard Java instead of custom solutions should be preferred if the solutions are equivalent.

And there we go...

image

…e#874

Given that units from non-IU locations are considered when resolving
IUs, it may happen that units are contained in the resolution path,
which are not contained by any repository. This may break previously
functional target definitions.

To resolve this problem, an in-memory artifact and metadata repository
is created, based on the metadata of the non-IU locations. Those
repositories are then added to the provisioning context for further
processing.

Amends dd321b5
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

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

Looks good now.
Thanks again.

@laeubi laeubi merged commit c77b32b into eclipse-pde:master Dec 5, 2023
16 checks passed
@ptziegler ptziegler deleted the issue874 branch December 5, 2023 17:26
merks added a commit to merks/eclipse.pde that referenced this pull request Dec 14, 2023
The implementation currently assumes all bundles are jars, but bundles
from the shared bundle pool may be unpacked as folders.

eclipse-pde#962
merks added a commit to merks/eclipse.pde that referenced this pull request Dec 14, 2023
The implementation currently assumes all bundles are jars, but bundles
from the shared bundle pool may be unpacked as folders.

eclipse-pde#962
laeubi pushed a commit that referenced this pull request Dec 15, 2023
The implementation currently assumes all bundles are jars, but bundles
from the shared bundle pool may be unpacked as folders.

#962
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.

Unable to resolve target definition when non-IU locations are used
6 participants