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

Migrate to latest commons-logging (currently 1.3.3) #3137

Merged

Conversation

HannesWell
Copy link
Contributor

Adapt to the new Bundle-SymbolicName in target-files, the additional.bundles required for development and defined in build.properties and adjust the templates to generate the new name.

Should fix #3127 for Xtext.

@cdietrich
Copy link
Contributor

cdietrich commented Aug 10, 2024

there is still the copy-dependencies the wizard does in some configs that mentions the old name in excludeArtifactIds (IdeProjectDescriptor.xtend) + AbstractPluginProjectCreator also mentions it.
we also need to check into the failing build.

as my team at work in decimated over the next weeks and after that i am on vacation myself i am not sure when we should bring it in. either immediately or right after the release

override setEnabled(boolean enabled) {
if (!enabled)
throw new IllegalArgumentException("The runtime project is always enabled")
super.enabled = enabled
}

Copy link
Contributor

Choose a reason for hiding this comment

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

can you undo the ws changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

(you can run cliwizardintegrationtest as java main to update test expectations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot reproduce the test failure locally. And if I read the error message correct it looks like there is just an additional space between square brackets but I don't understand how this change influences that.
But I pushed an update where I removed the whitepace as requested.

... While typing this and thinking again. These whitespace changes probably caused the test-failures so they are hopefully fixed now.

@HannesWell
Copy link
Contributor Author

there is still the copy-dependencies the wizard does in some configs that mentions the old name in excludeArtifactIds (IdeProjectDescriptor.xtend)

Yes I saw these (templates for) pom.xml files, but since it is a configuration for the maven-dependency-plugin and the element is named excludeArtifactIds I'm not sure if the current name is even correct?
To me it looks like that should be the Maven artifactId which would be commons-logging:
https://mvnrepository.com/artifact/commons-logging/commons-logging

Or does this mojo also consider the PDE dependencies injected by Tycho?
In general I have to admit that I have not yet understood why the dependencies are copied at all.

AbstractPluginProjectCreator also mentions it

That's an import-package header value (at least the method name implies it:
https://github.com/eclipse/xtext/blob/2bce8b6c62b1da7c57d81cff6e699eedb19d90a9/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/wizard/AbstractPluginProjectCreator.java#L58-L62

we also need to check into the failing build.

I'm looking into this.

as my team at work in decimated over the next weeks and after that i am on vacation myself i am not sure when we should bring it in. either immediately or right after the release

I think it also depends on how fast MWE2 is adjusted, but the commit on your branch looks good, I just have a one or two things that are missing. Do you want to create a PR in MWE2 for that? Then I can add my remarks.

Or if we have something like suggested in eclipse-mwe/mwe#296 (comment), we can maybe completely remove the additional.bundles entries in the build.properties.

@cdietrich
Copy link
Contributor

	«ENDIF»
						«IF config.languageServer!=LanguageServer.NONE»
							«IF isEclipsePluginProject»

so this seems to be if you select tycho and language server

@cdietrich
Copy link
Contributor

about

additional.bundles

this wont work if you just create a project without any tycho.

unfortunately there is no
additional.imports ....

@HannesWell HannesWell force-pushed the migrate-to-commons-logging-1.3 branch from c5be99b to 00ba972 Compare August 10, 2024 09:24
@HannesWell
Copy link
Contributor Author

as my team at work in decimated over the next weeks and after that i am on vacation myself i am not sure when we should bring it in. either immediately or right after the release

Thinking about this again. Since I assume that mwe workflows will work with the old an new version of commons-logging (since it is just a plain old flat-classpath java app) I think this change is quite save. We don't even have to await the corresponding change for mwe2 since one could already now change existing the 'devlopment-bundles' of an xtext project and the workflow should still run.

So once the execludedArtifacts in pom(templates) are correct, I'm for submitting this now.

@HannesWell
Copy link
Contributor Author

@cdietrich regarding the corresponding change in MWE2 are you fine if I take your commit to a separate branch add my changes and create a PR from it?

@cdietrich
Copy link
Contributor

Yes. What are the additions?

@cdietrich
Copy link
Contributor

The idea would be

merge mwe
Mwe milestone m2
Merge this
Create mwe bump to m2
Merge it
Check if running workflow in Xtext dev env works
Update reference projects
Merge them
Wait for fallout and fix

@HannesWell
Copy link
Contributor Author

Yes. What are the additions?

See eclipse-mwe/mwe#298.

The idea would be

As you prefer. When is the mwe m2 planned? Couldn't we test it with a nightly build? This would make the cycle shorter.

@cdietrich
Copy link
Contributor

I can do mwe m2 it later today when home from hiking (there is no planned date as so far no changes )

@cdietrich
Copy link
Contributor

Maybe you can build a branch of Xtext/xtext-reference-projeczs with your mwe and Xtext build results but I fear doing all the adjustments will be a lot

@cdietrich
Copy link
Contributor

Do you have some capacity to investigate fallout if there is any contra to my expectations

@HannesWell
Copy link
Contributor Author

Maybe you can build a branch of Xtext/xtext-reference-projeczs with your mwe and Xtext build results but I fear doing all the adjustments will be a lot

Which project's are you exactly referring to when you say Xtext/xtext-reference-projeczs ? The examples in this repository like org.eclipse.xtext.example.arithmetics or org.eclipse.xtext.example.domainmodel?

Do you have some capacity to investigate fallout if there is any contra to my expectations

It depends on when the fallout will happen and what the time-frame is to fix it.
This weekend I would have some more time, next week a bit less, but there should still be spots in the evening.

I can do mwe m2 it later today when home from hiking (there is no planned date as so far no changes )

Enjoy your hike :)

@cdietrich
Copy link
Contributor

Github.com/xtext/xtext-reference-projects

there is launch to regenerate wizard projecte
Domain model needs manual copy paste
Integratintests/ (swt) might need target adoption

@cdietrich
Copy link
Contributor

@HannesWell i am back home.
if you are d'accord i'd propose to merge the MWE and then build a MWE milestone

@HannesWell
Copy link
Contributor Author

Yes I'm fine with that.
I have limited availability in the next 2-3 hours but will be fully available in the afternoon/evening.

@cdietrich
Copy link
Contributor

cdietrich commented Aug 10, 2024

@cdietrich
Copy link
Contributor

Mwe bump build is still running. Will merge once it is through

@cdietrich
Copy link
Contributor

@HannesWell mwe bump is in. Can you please rebase

@HannesWell HannesWell force-pushed the migrate-to-commons-logging-1.3 branch from 00ba972 to 454df49 Compare August 10, 2024 14:21
@HannesWell
Copy link
Contributor Author

@HannesWell mwe bump is in. Can you please rebase

Done.

Thanks for the milestone and adjustments!

@cdietrich
Copy link
Contributor

ok. will create a branch for reference projects

@cdietrich
Copy link
Contributor

Regarding the IdeProjectDescriptor.
maybe "viel hilft viel" and adding both might be an option.
i also see this in domainmodel.ide

@cdietrich
Copy link
Contributor

@cdietrich
Copy link
Contributor

cdietrich commented Aug 10, 2024

hmmmm https://github.com/xtext/xtext-reference-projects/actions/runs/10332344902/job/28603464575

any idea?

do we have to add it to extra requirements?
shouldnt tycho resolve it anyway?

https://github.com/xtext/xtext-reference-projects/blob/5718762516bc29e1af3374f4de322bc806cd9407/domainmodel/2.36.0/org.eclipse.xtext.example.domainmodel.releng/pom.xml#L110
does not help neither

why does the

    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <!--
        Just mention the p2 repo so that additional requirements with ranges specified in
        features and bundles are taken from Orbit (e.g., objectweb.asm)
      -->
      <repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
    </location>
``` no longer work ...

@HannesWell
Copy link
Contributor Author

Sorry installing my 'Balcony power plant' took longer than expected, but I'm back now.

do we have to add it to extra requirements? shouldnt tycho resolve it anyway?

https://github.com/xtext/xtext-reference-projects/blob/5718762516bc29e1af3374f4de322bc806cd9407/domainmodel/2.36.0/org.eclipse.xtext.example.domainmodel.releng/pom.xml#L110 does not help neither

That should not be necessary at all. Tycho should resolve the additional.bundles as dependencies too.

Are you sure the target-platform in use contains the new commons-logging artifact?

@cdietrich
Copy link
Contributor

cdietrich commented Aug 10, 2024

it does but not explicitely. we removed it (explicit listings from domain model) with
eclipse/xtext-eclipse#1686
eclipse/xtext-eclipse#1994
eclipse/xtext-eclipse#1687

now using planner instead of slicer

tycho bug?

@HannesWell
Copy link
Contributor Author

Ok the domainmodel.target contains the new org.apache.commons.commons-logging at the repos

The problem is, no IU listed in the TP seems to require the new version, but something pulls in the old org.apache.commons.logging. Probably some older feature or a bundle using require-bundle or a tight import-package version range? I have not yet investigated in detail.

So to solve this you can just add the corresponding IU to one of the locations. E.g.

      <unit id="org.apache.commons.commons-logging"/>
      <repository location="https://download.eclipse.org/releases/2024-09"/>

A separate location is not necessary.

tycho bug?

With the explanation above, I don't think so. Problem is that in general, Tycho, like PDE only resolves requirements of IUs listed in the target, but not extra requirements of the projects being built. Oomph targlets are different in that sense. You only have to specify a list of repos and get the full transitive dependency closure in your TP of the Plug-in projects in your workspace.

@HannesWell
Copy link
Contributor Author

In general you can also use multiple repositories in one location. Under the hood PDE/Tycho uses the repos of all locations when resolving IUs using the planner. It can be useful if you view the content of your TP and sort it by location, but for the overall TP content there is no difference if you have one location with all your IUs and repo-URLs listed or one location per repo.

@cdietrich
Copy link
Contributor

ok can you adapt your pr?
with org.apache.commons.logging have no idea what could pull this.
dont see it in plugin dependencies view

@HannesWell
Copy link
Contributor Author

with org.apache.commons.logging have no idea what could pull this.
dont see it in plugin dependencies view

Looks like its apache-httpclient

grafik

ok can you adapt your pr?

Sorry I don't understand what has to be adapted in this PR?
I assumed we are talking about yours xtext/xtext-reference-projects#435?

@LorenzoBettini
Copy link
Contributor

why does the

    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <!--
        Just mention the p2 repo so that additional requirements with ranges specified in
        features and bundles are taken from Orbit (e.g., objectweb.asm)
      -->
      <repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
    </location>
``` no longer work ...

That breaks if Orbit provides different bundles like commons logging with different names and transitive dependencies kick in, like in this case.

I added that part some time ago; I see you already added the explicit dependency on the new commons-logging; maybe the comment has to be tweaked accordingly.

@cdietrich
Copy link
Contributor

@HannesWell
org.eclipse.xtext.xtext.ui.examples/projects/domainmodel/org.eclipse.xtext.example.domainmodel.releng/tp/domainmodel.target

@cdietrich
Copy link
Contributor

and what depends on jgit?

Adapt to the new Bundle-SymbolicName

Fixes eclipse-xtext#3127 for Xtext
@HannesWell HannesWell force-pushed the migrate-to-commons-logging-1.3 branch from 454df49 to 5eef4f7 Compare August 10, 2024 15:55
@cdietrich
Copy link
Contributor

so what is left is IdeProjectDescriptor

@HannesWell
Copy link
Contributor Author

@HannesWell org.eclipse.xtext.xtext.ui.examples/projects/domainmodel/org.eclipse.xtext.example.domainmodel.releng/tp/domainmodel.target

Indeed, thanks.

and what depends on jgit?

In Xtext I believe nothing. My other guess is ECF on which P2 depends. I could invesitgate further, but in the end I think it is sufficient to assume that something requires the old commons.logging but nothing in the TP requires the new one.

so what is left is IdeProjectDescriptor

Yes. The maven-dependency-plugin config.
I'll have a look at this.

Btw. the build of the previous state succeeded.

why does the

    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <!--
        Just mention the p2 repo so that additional requirements with ranges specified in
        features and bundles are taken from Orbit (e.g., objectweb.asm)
      -->
      <repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
    </location>
``` no longer work ...

That breaks if Orbit provides different bundles like commons logging with different names and transitive dependencies kick in, like in this case.

I added that part some time ago; I see you already added the explicit dependency on the new commons-logging; maybe the comment has to be tweaked accordingly.

I think this is still correct. P2/PDE/Tycho resolves the latest possible version of all requirements. And as long as something requires the 'old' commons-logging, either because of using the old-name and Require-Bundle or Import-Package with a version below 1.3 that old version is resolved (too). It can also be that both versions are resolved. If one cannot satisfies all requirements.

It could of course also happen that the old one can serve all requirements and thus the new one is not resolved/used.

@cdietrich
Copy link
Contributor

cdietrich commented Aug 10, 2024

jar tf org.xtext.example.mydsl.ide-1.0.0-SNAPSHOT-ls.jar | grep logging
shows common logging is included in the uber jar

no idea how this works

=> propose to add the new bundle name and or commons-logging
and also
<exclude>*:org.xtext.example.mydsl.ide-commons-logging*</exclude>
or something similar (seems not to be enhough)

@LorenzoBettini
Copy link
Contributor

jar tf org.xtext.example.mydsl.ide-1.0.0-SNAPSHOT-ls.jar | grep logging shows common logging is included in the uber jar

no idea how this works

=> propose to add the new bundle name and or commons-logging and also <exclude>*:org.xtext.example.mydsl.ide-commons-logging*</exclude> or something similar (seems not to be enhough)

I seem to understand that the exclusion has not been updated so the jar is in the uber jar for the moment.

@cdietrich
Copy link
Contributor

guess we need

<exclude>*:org.xtext.example.mydsl.ide-commons-logging*</exclude>
							<exclude>*:*commons-logging*</exclude>

and

<excludeArtifactIds>
								com.ibm.icu,
								org.apache.ant,
								org.apache.commons.lang,
								org.apache.commons.logging,
								org.apache.commons.commons-logging,
								commons-logging,

did not check the non shade variant yet

@HannesWell
Copy link
Contributor Author

The configuration already seems to be broken, to fix it I created a separate PR:

You can notice the problem when looking into the <dsl-project>.ide/target/libs folder into which the dependencies are copied.
It still happens that e.g. commons.logging ends up in the uber-jar, even if it is not in the libs folder. This is probably because the shade plugin finds it as a 'Maven'-Depenendency and it includes all of them in the uber-jar.
I assume the exclusion is only to avoid duplicates.

@cdietrich cdietrich merged commit 7e5bfc8 into eclipse-xtext:main Aug 11, 2024
7 checks passed
@cdietrich
Copy link
Contributor

thx @HannesWell

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.

Investigate if we can move xtext and mwe to apache.commons.commons-logging 1.3.3
3 participants