microsoft / build-server-for-gradle

An implementation of the Build Server Protocol for Gradle
MIT License
51 stars 8 forks source link

refactor: Support multiple languages. #125

Closed jdneo closed 6 months ago

jdneo commented 9 months ago

@Arthurm1 A draft for multi-language support refactor. It's not finished yet, I've roughly done the plugin part. Would like to hear your thoughts before I am going on.

Basically, different language contributors can contribute.

Arthurm1 commented 9 months ago

Looks fine to me.

I'd wonder about eventually moving JavaHome/Version/GradleVersion from...

    extension.setJavaHome(DefaultInstalledJdk.current().getJavaHome());
    extension.setJavaVersion(DefaultInstalledJdk.current().getJavaVersion().getMajorVersion());
    extension.setGradleVersion(project.getGradle().getGradleVersion());

into SourceSetsModelBuilder.

If BSP 3.0 has a map of DataKind -> Data for build targets then maybe you could introduce a GradleDataKind instead of extending the JvmBuildTarget. I think it would be handy for clients to know something about the BSP Server even if it's only just info that they can report to users. Definitely handy for the user to know what version of Gradle they're attached to as they may need a certain version for certain parts of BSP to work. But maybe that's for later with BSP 3.0.

I assume SourceSetModelBuilder is to be deleted - it doesn't seem to be used anymore?

I don't think it matters too much if the refactor is not perfect - as it's all internal API it can be changed if necessary.

jdneo commented 7 months ago

@Arthurm1 I think I'm close to finish the refactoring stuff. If you have time to review, it would be greatly appreciated!

Arthurm1 commented 7 months ago

@jdneo Looks good - I've added some minor comments

Arthurm1 commented 6 months ago

@jdneo Are there more changes needed for this or are you planning on merging soon?

jdneo commented 6 months ago

image

@testforstephen, sorry to introduce such large change. This refactoring is to make the multi-language support easier. Each language should implement a LanguageModelBuilder which is used to provide specific language information to the SourceSetModelBuilder.

One thing to mention that, the return value of getExtensionFor() depends on the BSP defined extension for different languages.

jdneo commented 6 months ago

Are there more changes needed for this or are you planning on merging soon?

@Arthurm1 I'll try to make sure it be merged recently.