Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Progress eclipse cleanup#1587

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
blacelle wants to merge8 commits intodiffplug:main
base:main
Choose a base branch
Loading
fromblacelle:ProgressEclipseCleanup

Conversation

blacelle
Copy link
Contributor

@blacelleblacelle commentedFeb 25, 2023
edited
Loading

This revives the interest in Eclipse JDT CleanUp.

  1. The implementation is rooted inmain...issue_292, but I would pursue the work in a forked repository.
  2. This is concurrent to my work in CleanThat, integrating various refactoring/cleanups engines (Progress with Eclipse CleanUp as Refactorer solven-eu/cleanthat#423)
  3. Merging would probably waits the rework of Eclipse integration in SpotlessUse Equo Solstice to calculate and download eclipse dependencies #1524
  4. This is a direct answer toAdd support for Eclipse Clean Up #292
  5. Unittests in _ext/eclipse-jdt are not available to myself from Intellij (they aregrayed, like in case of classpath issue, hence not detected as source/unitTests). Is there a tips to get them working? (IntelliJ)
    image

I resynced the branch with Spotless main.

Strohgelaender reacted with thumbs up emoji
@blacelle
Copy link
ContributorAuthor

blacelle commentedFeb 25, 2023
edited
Loading

@nedtwigg I had issues making it running in Cleanthat. Given the boilterplates around Eclipse integration, I feel preferable to drop Eclipse Cleanup from CleanThat, and get Cleanthat relying on Spotless.

As it stands, this PR holds core integration, but not availability through build options (Gradle, Maven, etc).

Do you prefer I open a separate PR for build-systems integrations ? (I will start with Eclipse). Or is it OK/preferable to have the whole thing in a single PR?

@nedtwigg
Copy link
Member

Single PR is fine.

@blacelle
Copy link
ContributorAuthor

This would help#1379 (comment)

@blacelle
Copy link
ContributorAuthor

Unittests in _ext/eclipse-jdt are not available to myself from Intellij (they are grayed, like in case of classpath issue, hence not detected as source/unitTests). Is there a tips to get them working? (IntelliJ)

Any idea@nedtwigg ?

@nedtwigg
Copy link
Member

That whole project structure is about to be nuked. Everything in the_ext is becoming just a plain old sourceSet oflib-extra in#1524 which I will merge later today.

blacelle reacted with thumbs up emoji

* JDT core manipulation required for clean-up base interfaces and import sorting
* It depends on JDT core, which is required for formatting.
*/
/**compile("org.eclipse.jdt:org.eclipse.jdt.core.manipulation:${VER_ECLIPSE_JDT_CORE_MANIPULATION}") {
Copy link
ContributorAuthor

@blacelleblacelleMar 13, 2023
edited
Loading

Choose a reason for hiding this comment

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

@nedtwigg This was in the old eclipse-jdt build.gradle. I suppose it has to be converted into things like:

public static EquoBasedStepBuilder createBuilder(Provisioner provisioner) {return new EquoBasedStepBuilder(NAME, provisioner, EclipseJdtCleanUpStep::apply) {@Overrideprotected P2Model model(String version) {var model = new P2Model();addPlatformRepo(model, version);model.getInstall().add("org.eclipse.jdt.core");return model;}

Copy link
Member

Choose a reason for hiding this comment

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

That is correct.

privatefinalMap<String,String>defaultOptions;

protectedEclipseJdtCoreManipulation()throwsException {
if (SpotlessEclipseFramework.setup(
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I need to check the migration of EclipseJdtFormatterStepImpl to see how this was migrated.

Copy link
Member

Choose a reason for hiding this comment

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

ThisSpotlessEclipseFramework stuff is tricky. Depending on what version of Eclipse, and what methods you are calling, it might not matter if any of the OSGi stuff has been initialized at all. Or you might need all of it initialized.

For the current Eclipse JDT and CDT formatters, nothing is initialized at all, and that works fine. For Groovy we needed to start the full Solstice OSGi thing. If you are getting NPE or "blah not initialized" errors, I would copy this into your static initializer as a template.

publicclassGrEclipseFormatterStepImpl {
static {
NestedJars.setToWarnOnly();
NestedJars.onClassPath().confirmAllNestedJarsArePresentOnClasspath(CacheLocations.nestedJars());
try {
varsolstice =Solstice.findBundlesOnClasspath();
solstice.warnAndModifyManifestsToFix();
varprops =Map.of("osgi.nl","en_US",
Constants.FRAMEWORK_STORAGE_CLEAN,Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT,
EquinoxLocations.PROP_INSTANCE_AREA,Files.createTempDirectory("spotless-groovy").toAbsolutePath().toString());
solstice.openShim(props);
ShimIdeBootstrapServices.apply(props,solstice.getContext());
solstice.start("org.apache.felix.scr");
solstice.startAllWithLazy(false);
solstice.start("org.codehaus.groovy.eclipse.core");
}catch (IOExceptione) {
thrownewRuntimeException(e);
}
}

blacelle reacted with thumbs up emojiblacelle reacted with confused emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the insights. For now, I'm feeling a bit overwhelmed here. I'll take some time to get through it.

config.put("invalid.key","some.value");
});
cleanUpTest("","",config -> {
config.put(JavaCore.COMPILER_SOURCE,"-42");
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

JavaCore is unknown here, while it is known in thejdt.compile module. How should I manage additional dependencies in test classes in lib-extra?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nedtwigg I would need a hint here.

Copy link
Member

Choose a reason for hiding this comment

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

The build does not currently have a way to run tests against the Eclipse classpath. We would have to add something into this block

for (needsP2inNEEDS_P2_DEPS) {
sourceSets.register(needsP2) {
compileClasspath+= sourceSets.main.output
runtimeClasspath+= sourceSets.main.output
java {}
}
dependencies {
add("${needsP2}CompileOnly","dev.equo.ide:solstice:${VER_SOLSTICE}")
}
}

Along these lines

tasks.register("${needsP2}Test", Test) {  // setup classpath somehow}...into 'jdtCompileOnly', { ... }into 'jdtTestImplementation', { ... }

There would be some copy pasting going on, if this got implemented then there'd be no copy-pasting necessary

@blacelle
Copy link
ContributorAuthor

This is still quite a long way to go.

  1. Enable customization/selection of CleanUp rules
  2. Migration to updated Eclipse. (e.g. aroundIndexer.getInstance().enableAutomaticIndexing(false);)
  3. There was no unitTest in the initial work for cleanup (but there was for organizeImports). Hence, I'm not confident the minimal work was working fine.
bwRavencl reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nedtwiggnedtwiggnedtwigg left review comments

Assignees
No one assigned
Labels
pr-archivePRs which are still valid but have gotten stuck for some reason
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@blacelle@nedtwigg@jbduncan@fvgh

[8]ページ先頭

©2009-2025 Movatter.jp