Skip to content

Conversation

hansd
Copy link
Member

@hansd hansd commented Feb 10, 2018

…ins. Added Config plugin to avoid extra values in Kotlin plugins.

Context

Contributor Checklist

  • Review Contribution Guidelines
  • Make sure that all commmits are signed off to indicate that you agree to the terms of Developer Certificate of Origin.
  • Check "Allow edit from maintainers" option in pull request so that additional changes can be pushed by Gradle team
  • Provide integration tests (under <subproject>/src/integTest) to verify changes from a user perspective
  • Provide unit tests (under <subproject>/src/test) to verify logic
  • Update User Guide, DSL Reference, and Javadoc for public-facing changes
  • Ensure that tests pass locally: ./gradlew <changed-subproject>:check

Gradle Core Team Checklist

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation
  • Recognize contributor in release notes

…ins. Added Config plugin to avoid extra values in Kotlin plugins.
@hansd hansd requested review from bamboo and eskatos February 10, 2018 21:41
@eskatos eskatos added from:member a:chore Minor issue without significant impact labels Feb 12, 2018
@eskatos eskatos added this to the 4.6 RC1 milestone Feb 12, 2018
@oehme oehme modified the milestones: 4.6 RC1, 4.7 RC1 Feb 13, 2018
}

// I use the tasks.create syntaxt as the crossVersionTest name is already taken by the source set
val crossVersionTestTask = tasks.create("crossVersionTest", CrossVersionTest::class.java) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bikeshed: This could be written simpler.

project.task<CrossVersionTest>("crossVersionTest") {
    // ect...
}

description = "Runs the cross-version tests against a subset of selected Gradle versions with 'forking' executer for quick feedback"
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space, if you care.


if (config.isCiServer) {
allprojects {
tasks.withType(Test::class.java) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Reified version of this API exists.

tasks.withType<Test> {
    // ect...
}

@@ -1,3 +1,5 @@
import org.gradle.kotlin.dsl.extra
Copy link
Contributor

Choose a reason for hiding this comment

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

Import is above the copyright.


listOf("embedded", "forking").forEach { mode ->
val taskName = "${mode}CrossVersionTest"
tasks.create(taskName, CrossVersionTest::class.java) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same bikeshed as above.

@@ -0,0 +1,131 @@
package org.gradle.plugins
Copy link
Member

Choose a reason for hiding this comment

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

❓ Is this file meant to be part of this PR? Because I don't see the corresponding Groovy file.

Copy link
Member

@eskatos eskatos left a comment

Choose a reason for hiding this comment

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

I'm not found of the plugin id config.

I also think that it mixes up two things:

  • build environment values, that are build scoped and don't need to reside on a plugin extension, they could be a simple type in buildSrc (isCiServer and releasedVerisions)
  • on the other hand, useAllDistributions is to be set by each project so it would make sense to have it on the extension of a plugin applied to all appropriate projects

implementationClass = "org.gradle.plugins.CustomM2CheckPlugin"
}
"intTestImage" {
id = "intTestImage"
Copy link
Member

Choose a reason for hiding this comment

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

❌ Let's use kebab-case for all plugin ids


// This is terrible. We should have defined states.
if (configurations.findByName("partialDistribution") == null) {
configurations.create("partialDistribution")
Copy link
Member

Choose a reason for hiding this comment

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

⭕ Could use configurations.maybeCreate("name") instead.
or configurations { "name"() }

doLast {
val m2RepositoryFolder = File("${SystemProperties.getInstance().userHome}/.m2/repository")
if (m2RepositoryFolder.exists()) {
project.delete(m2RepositoryFolder)
Copy link
Member

Choose a reason for hiding this comment

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

delete(m2repositoryFolder) is enough, no need to spell project. here as we already are in a project.run {} block


if (config.useAllDistribution) {
val unpackAllDistribution by tasks.creating(Sync::class) {
val allZip by project.project("distributions").tasks.getting(AbstractArchiveTask::class)
Copy link
Member

Choose a reason for hiding this comment

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

project("distributions")... should be enough

val selfRunTime by configurations.creating

afterEvaluate {
if (project.tasks.findByName("jar") != null) {
Copy link
Member

Choose a reason for hiding this comment

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

if(tasks...) should be enough

}

ext {
isCiServer = config.isCiServer()
Copy link
Member

Choose a reason for hiding this comment

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

❓ Why keep this extra property now that the value is available from a typed construct?

@eskatos
Copy link
Member

eskatos commented Feb 21, 2018

My advice would be to take smaller steps. For example:

  1. introduce some BuildEnvironment type in buildSrc with isCiServer and releasedVersions properties, use that across the build and remove the corresponding extra properties
  2. model integration testing as (a) plugin(s), this will encompass useAllDistribution, other integration testing properties and the related logic

@hansd
Copy link
Member Author

hansd commented Feb 24, 2018

This was one of my initial attempts at migrating to Kotlin. I think the structure is not right and there are other issues as mentioned in the review. Therefore I will close this pull request.

@hansd hansd closed this Feb 24, 2018
@ov7a ov7a removed this from the 4.7 RC1 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:chore Minor issue without significant impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants