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 Buildship 3.0 #876

Merged
merged 2 commits into from
Dec 4, 2018
Merged

Migrate to Buildship 3.0 #876

merged 2 commits into from
Dec 4, 2018

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Dec 1, 2018

Fixes #875

Signed-off-by: Snjezana Peco [email protected]

@snjeza snjeza requested review from gorkem and fbricon December 1, 2018 20:41
@snjeza
Copy link
Contributor Author

snjeza commented Dec 1, 2018

test this please

@fbricon
Copy link
Contributor

fbricon commented Dec 3, 2018

Tried importing https://github.com/spring-projects/spring-amqp, failed with:

[Warn  - 9:20:49 AM] 3-Dec-2018 9:20:49 AM Synchronize project spring-amqp failed due to an error while importing the root project.
java.lang.NullPointerException
org.eclipse.buildship.core.internal.ImportRootProjectException: java.lang.NullPointerException
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation.run(ImportRootProjectOperation.java:52)
	at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:216)
	at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:57)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2322)
	at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:38)
	at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:182)
	at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:95)
	at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:81)
	at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.startSynchronization(GradleProjectImporter.java:149)
	at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.importDir(GradleProjectImporter.java:94)
	at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.lambda$0(GradleProjectImporter.java:86)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080)
	at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.importToWorkspace(GradleProjectImporter.java:86)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:134)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.access$1(ProjectsManager.java:128)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager$2.run(ProjectsManager.java:122)
	at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2322)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5810)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5767)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:114)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:229)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NullPointerException
	at com.google.common.base.Joiner.join(Joiner.java:187)
	at org.eclipse.buildship.core.internal.configuration.BuildConfigurationPersistence.savePreferences(BuildConfigurationPersistence.java:163)
	at org.eclipse.buildship.core.internal.configuration.BuildConfigurationPersistence.saveBuildConfiguration(BuildConfigurationPersistence.java:71)
	at org.eclipse.buildship.core.internal.configuration.DefaultConfigurationManager.saveBuildConfiguration(DefaultConfigurationManager.java:99)
	at org.eclipse.buildship.core.internal.configuration.DefaultConfigurationManager.saveProjectConfiguration(DefaultConfigurationManager.java:136)
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation.saveProjectConfiguration(ImportRootProjectOperation.java:82)
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation.access$200(ImportRootProjectOperation.java:38)
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation$1.run(ImportRootProjectOperation.java:67)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation.runInWorkspace(ImportRootProjectOperation.java:57)
	at org.eclipse.buildship.core.internal.workspace.ImportRootProjectOperation.run(ImportRootProjectOperation.java:50)
	... 27 more

@snjeza
Copy link
Contributor Author

snjeza commented Dec 3, 2018

@fbricon re Buildship sources (eclipse-buildship/buildship#327)

You can try the following:

git clone [email protected]:eclipse/buildship.git
cd buildship
git checkout release-3.0
./gradlew build -x eclipseTest
  • import org.eclipse.builship.core (and org.eclipse.builship.ui) in Eclipse

@fbricon
Copy link
Contributor

fbricon commented Dec 3, 2018

@snjeza I just cloned the repo and made eclipse point at the repo directory when searching for sources, it's simpler. But what would be even simpler is to have those sources available directly.

@snjeza
Copy link
Contributor Author

snjeza commented Dec 3, 2018

test this please

@fbricon
Copy link
Contributor

fbricon commented Dec 4, 2018

@snjeza can you reproduce the NPE above? I still have the same issue with the latest buildship build

build.synchronize(NewProjectHandler.IMPORT_AND_MERGE);
String javaHomeStr = JavaLanguageServerPlugin.getPreferencesManager().getPreferences().getJavaHome();
File javaHome = javaHomeStr == null ? null : new File(javaHomeStr);
BuildConfiguration configuration = CorePlugin.configurationManager().createBuildConfiguration(location, overrideWorkspaceSettings, distribution, getGradleHomeFile(), javaHome, false, false, false, null, null, false, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid passing null objects to the configuration, this is the cause for the NPE. Try with empty lists.

Copy link

Choose a reason for hiding this comment

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

Would it be possible for you to switch to the new public API?

BuildConfiguration build = BuildConfiguration.forRootProjectDirectory(new File("path/to/root"))
    .javaHome(new File("path/to/jdk"))
    .arguments(Arrays.asList("--info"))
    // ...
    .build();
SynchronizationResult result = GradleCore.getWorkspace().createBuild(build).synchronize(monitor);
System.out.println(result.getStatus().isOK());

@fbricon
Copy link
Contributor

fbricon commented Dec 4, 2018

@snjeza can you do a quick assessment of the extra disk space added to the distro if we threw in the gradle/kotlin bundles?

Signed-off-by: Snjezana Peco <[email protected]>
@snjeza
Copy link
Contributor Author

snjeza commented Dec 4, 2018

@snjeza can you reproduce the NPE above? I still have the same issue with the latest buildship build

I can reproduce it when I set GRADLE_HOME

@snjeza
Copy link
Contributor Author

snjeza commented Dec 4, 2018

@snjeza can you do a quick assessment of the extra disk space added to the distro if we threw in the gradle/kotlin bundles?

@fbricon Do you mean https://github.com/JetBrains/kotlin-eclipse?

@fbricon
Copy link
Contributor

fbricon commented Dec 4, 2018

org.eclipse.buildship.kotlin and its dependencies, so yeah I imagine that includes some of jetbrains plugins

@snjeza
Copy link
Contributor Author

snjeza commented Dec 4, 2018

@fbricon
Copy link
Contributor

fbricon commented Dec 4, 2018

tssss. This is a no-go then. Can you please open a ticket in https://github.com/JetBrains/kotlin-eclipse/ so they decouple their core plugins from the ui?

Signed-off-by: Snjezana Peco <[email protected]>
@fbricon fbricon merged commit a464abe into eclipse-jdtls:master Dec 4, 2018
@snjeza
Copy link
Contributor Author

snjeza commented Dec 5, 2018

tssss. This is a no-go then. Can you please open a ticket in https://github.com/JetBrains/kotlin-eclipse/ so they decouple their core plugins from the ui?

I can't create any issues in https://github.com/JetBrains/kotlin-eclipse/

@cheuk-fung
Copy link

cheuk-fung commented Feb 7, 2019

@snjeza @fbricon kotlin-eclipse does not track issue on Github. I've created one for this issue in their issue tracker: https://youtrack.jetbrains.com/issue/KE-307?project=KE&clearDraft=true
Hopefully this will help you continue to integrate buildship.kotlin and add support for Gradle Kotlin DSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants