Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/daemon-tool…
Browse files Browse the repository at this point in the history
…chain-auto-detection-cache

# Conflicts:
#	testing/distributions-integ-tests/src/integTest/groovy/org/gradle/DistributionIntegrationSpec.groovy
  • Loading branch information
vmadalin committed Apr 25, 2024
2 parents 4a380c9 + 7884cff commit 63635ad
Show file tree
Hide file tree
Showing 501 changed files with 8,176 additions and 2,749 deletions.
6 changes: 5 additions & 1 deletion .idea/inspectionProfiles/Gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions .teamcity/src/main/kotlin/common/extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ fun javaHome(jvm: Jvm, os: Os, arch: Arch = Arch.AMD64) = "%${os.name.lowercase(
fun BuildType.paramsForBuildToolBuild(buildJvm: Jvm = BuildToolBuildJvm, os: Os, arch: Arch = Arch.AMD64) {
params {
param("env.BOT_TEAMCITY_GITHUB_TOKEN", "%github.bot-teamcity.token%")
param("env.GRADLE_CACHE_REMOTE_PASSWORD", "%gradle.cache.remote.password%")
param("env.GRADLE_CACHE_REMOTE_URL", "%gradle.cache.remote.url%")
param("env.GRADLE_CACHE_REMOTE_USERNAME", "%gradle.cache.remote.username%")
param("env.GRADLE_CACHE_REMOTE_SERVER", "%gradle.cache.remote.server%")

param("env.JAVA_HOME", javaHome(buildJvm, os, arch))
param("env.GRADLE_OPTS", "-Xmx1536m")
Expand All @@ -179,15 +177,21 @@ fun BuildSteps.checkCleanM2AndAndroidUserHome(os: Os = Os.LINUX, buildType: Buil
name = "CHECK_CLEAN_M2_ANDROID_USER_HOME"
executionMode = BuildStep.ExecutionMode.ALWAYS
scriptContent = if (os == Os.WINDOWS) {
checkCleanDirWindows("%teamcity.agent.jvm.user.home%\\.m2\\repository") + checkCleanDirWindows("%teamcity.agent.jvm.user.home%\\.m2\\.gradle-enterprise") + checkCleanDirWindows(
"%teamcity.agent.jvm.user.home%\\.android",
false
)
checkCleanDirWindows("%teamcity.agent.jvm.user.home%\\.m2\\repository") +
checkCleanDirWindows("%teamcity.agent.jvm.user.home%\\.m2\\.gradle-enterprise") +
checkCleanDirWindows("%teamcity.agent.jvm.user.home%\\.m2\\.develocity") +
checkCleanDirWindows(
"%teamcity.agent.jvm.user.home%\\.android",
false
)
} else {
checkCleanDirUnixLike("%teamcity.agent.jvm.user.home%/.m2/repository") + checkCleanDirUnixLike("%teamcity.agent.jvm.user.home%/.m2/.gradle-enterprise") + checkCleanDirUnixLike(
"%teamcity.agent.jvm.user.home%/.android",
false
)
checkCleanDirUnixLike("%teamcity.agent.jvm.user.home%/.m2/repository") +
checkCleanDirUnixLike("%teamcity.agent.jvm.user.home%/.m2/.gradle-enterprise") +
checkCleanDirUnixLike("%teamcity.agent.jvm.user.home%/.m2/.develocity") +
checkCleanDirUnixLike(
"%teamcity.agent.jvm.user.home%/.android",
false
)
}
skipConditionally(buildType)
}
Expand Down
8 changes: 4 additions & 4 deletions .teamcity/src/main/kotlin/configurations/SmokeIdeTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class SmokeIdeTests(model: CIBuildModel, stage: Stage) : BaseGradleBuildType(sta
}

applyTestDefaults(
model,
this,
":smoke-ide-test:smokeIdeTest",
extraParameters = buildScanTag("SmokeIdeTests") + " -PautoDownloadAndroidStudio=true -PrunAndroidStudioInHeadlessMode=true",
model = model,
buildType = this,
gradleTasks = ":smoke-ide-test:smokeIdeTest",
extraParameters = buildScanTag("SmokeIdeTests"),
)
}) {
companion object {
Expand Down
32 changes: 30 additions & 2 deletions .teamcity/subprojects.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"crossVersionTests": false
},
{
"name": "base-annotations",
"path": "platforms/core-runtime/base-annotations",
"name": "base-asm",
"path": "platforms/core-runtime/base-asm",
"unitTests": false,
"functionalTests": false,
"crossVersionTests": false
Expand Down Expand Up @@ -160,6 +160,13 @@
"functionalTests": true,
"crossVersionTests": false
},
{
"name": "concurrent",
"path": "platforms/core-runtime/concurrent",
"unitTests": true,
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "configuration-cache",
"path": "platforms/core-configuration/configuration-cache",
Expand Down Expand Up @@ -503,6 +510,13 @@
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "io",
"path": "platforms/core-runtime/io",
"unitTests": true,
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "ivy",
"path": "platforms/software/ivy",
Expand All @@ -524,6 +538,13 @@
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "java-language-extensions",
"path": "platforms/core-runtime/java-language-extensions",
"unitTests": true,
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "java-platform",
"path": "platforms/jvm/java-platform",
Expand Down Expand Up @@ -979,6 +1000,13 @@
"functionalTests": true,
"crossVersionTests": false
},
{
"name": "time",
"path": "platforms/core-runtime/time",
"unitTests": true,
"functionalTests": false,
"crossVersionTests": false
},
{
"name": "toolchains-jvm",
"path": "platforms/jvm/toolchains-jvm",
Expand Down
2 changes: 1 addition & 1 deletion build-logic-commons/build-platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
api(kotlin("compiler-embeddable")) { version { strictly(kotlinVersion) } }
api("org.jlleitschuh.gradle:ktlint-gradle:10.3.0")
api("org.gradle.kotlin:gradle-kotlin-dsl-conventions:0.9.0")
api("com.autonomousapps:dependency-analysis-gradle-plugin:1.28.0")
api("com.autonomousapps:dependency-analysis-gradle-plugin:1.31.0")
api("com.squareup.okio:okio:3.4.0") {
because("Bump version brought in by dependency-analysis-gradle-plugin, to resolve CVE-2022-3635")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<suppressions>
<!-- These packages are duplicated in core-api, don't require a package-info.java in each place -->
<suppress checks="JavadocPackage"
files=".*[/\\]base-annotations[/\\]src[/\\]main[/\\]java[/\\]org[/\\]gradle[/\\]api[/\\][^/\\]+"/>
files=".*[/\\]java-language-extensions[/\\]src[/\\]main[/\\]java[/\\]org[/\\]gradle[/\\]api[/\\][^/\\]+"/>
<suppress checks="JavadocPackage"
files=".*[/\\]model-core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]gradle[/\\]api[/\\][^/\\]+"/>
<suppress checks="JavadocPackage"
Expand Down
4 changes: 2 additions & 2 deletions build-logic-commons/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ dependencies {
implementation(project(":module-identity"))
implementation("net.ltgt.gradle:gradle-errorprone-plugin:3.1.0")

implementation("org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.3.1")
implementation("org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.4.0")
// This Kotlin version should only be updated when updating the above kotlin-dsl version
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
implementation("org.gradle.kotlin:gradle-kotlin-dsl-conventions")
implementation("org.gradle:test-retry-gradle-plugin:1.5.2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ repositories {
includeModule("flot", "flot")
includeModule("org.gradle", "gradle-tooling-api")
includeModule("org.gradle.buildtool.internal", "configuration-cache-report")
includeModule("org.gradle.buildtool.internal", "gradle-ide-starter")
}
}
google {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ dependencies {
dependencies.registerTransform(FindGradleJars) {
from.attribute(ARTIFACT_TYPE, 'gradle-libs-dir')
to.attribute(ARTIFACT_TYPE, 'gradle-baseline-jars')
parameters {
currentJars.from(currentDistroJars)
currentVersion.set(baseVersion)
}
}
}

Expand Down Expand Up @@ -155,7 +151,7 @@ def checkBinaryCompatibility = tasks.register("checkBinaryCompatibility", gradle
it.destinationDir = file("$buildDir/reports/binary-compatibility")
it.reportName = "report.html"
it.description = """
<p>See the <a href="https://docs.google.com/document/d/1KA5yI4HL18qOeXjXLTMMD_upkDbNUzTDGNfBGYdQlYw/edit#heading=h.9yqcmqviz47z">documentation</a> for more details.</p>
<p>See the <a href="https://bt-internal-docs.grdev.net/gbt/how-to/release/release-troubleshooting/#binary-compatibility-check-failed-">documentation</a> for more details.</p>
<p>
We check the binary compatibility by comparing the current code’s binary interfaces
against THE LATEST VERSION WHICH IS RELEASED FROM RELEASE BRANCH (from `released-version.json` on this branch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import org.gradle.api.Incubating

import javax.inject.Inject

import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.SEEN_OLD_METHODS_OF_UPGRADED_PROPERTIES
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperty.UpgradedMethodKey
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.SEEN_OLD_ACCESSORS_OF_UPGRADED_PROPERTIES
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperty.UpgradedAccessorKey

@CompileStatic
abstract class AbstractGradleViolationRule extends AbstractContextAwareViolationRule {
Expand Down Expand Up @@ -136,8 +136,8 @@ abstract class AbstractGradleViolationRule extends AbstractContextAwareViolation

Violation acceptOrReject(JApiCompatibility member, List<String> changes, Violation rejection) {
Set<ApiChange> seenApiChanges = (Set<ApiChange>) context.userData["seenApiChanges"]
Set<UpgradedMethodKey> seenOldMethodsOfUpgradedProperties = (Set<UpgradedMethodKey>) context.userData[SEEN_OLD_METHODS_OF_UPGRADED_PROPERTIES]
UpgradedProperties.maybeGetKeyOfOldMethodOfUpgradedProperty(member, context).ifPresent { seenOldMethodsOfUpgradedProperties.add(it) }
Set<UpgradedAccessorKey> seenOldAccessorsOfUpgradedProperties = (Set<UpgradedAccessorKey>) context.userData[SEEN_OLD_ACCESSORS_OF_UPGRADED_PROPERTIES]
UpgradedProperties.maybeGetKeyOfOldAccessorOfUpgradedProperty(member, context).ifPresent { seenOldAccessorsOfUpgradedProperties.add(it) }

def change = new ApiChange(
context.className,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

package gradlebuild.binarycompatibility.rules;

import gradlebuild.binarycompatibility.upgrades.UpgradedProperty;
import gradlebuild.binarycompatibility.upgrades.UpgradedProperty.UpgradedMethodKey;
import gradlebuild.binarycompatibility.upgrades.UpgradedProperty.BinaryCompatibility;
import gradlebuild.binarycompatibility.upgrades.UpgradedProperty.UpgradedAccessor;
import gradlebuild.binarycompatibility.upgrades.UpgradedProperty.UpgradedAccessorKey;
import me.champeau.gradle.japicmp.report.PostProcessViolationsRule;
import me.champeau.gradle.japicmp.report.ViolationCheckContextWithViolations;
import org.gradle.util.internal.CollectionUtils;
Expand All @@ -26,21 +27,43 @@
import java.util.Map;
import java.util.Set;

import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.OLD_METHODS_OF_UPGRADED_PROPERTIES;
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.SEEN_OLD_METHODS_OF_UPGRADED_PROPERTIES;
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.OLD_ACCESSORS_OF_UPGRADED_PROPERTIES;
import static gradlebuild.binarycompatibility.upgrades.UpgradedProperties.SEEN_OLD_ACCESSORS_OF_UPGRADED_PROPERTIES;

public class UpgradePropertiesRulePostProcess implements PostProcessViolationsRule {

@Override
@SuppressWarnings("unchecked")
public void execute(ViolationCheckContextWithViolations context) {
Set<UpgradedMethodKey> seenUpgradedMethodChanges = (Set<UpgradedMethodKey>) context.getUserData().get(SEEN_OLD_METHODS_OF_UPGRADED_PROPERTIES);
Map<UpgradedMethodKey, UpgradedProperty> oldMethodsOfUpgradedProperties = (Map<UpgradedMethodKey, UpgradedProperty>) context.getUserData().get(OLD_METHODS_OF_UPGRADED_PROPERTIES);
Map<UpgradedMethodKey, UpgradedProperty> left = new HashMap<>(oldMethodsOfUpgradedProperties);
left.keySet().removeIf(seenUpgradedMethodChanges::contains);
if (!left.isEmpty()) {
String formattedLeft = CollectionUtils.join("\n", left.keySet());
throw new RuntimeException("The following methods were upgraded, but didn't match any changed method:\n\n" + formattedLeft);
Set<UpgradedAccessorKey> seenUpgradedAccessorsChanges = (Set<UpgradedAccessorKey>) context.getUserData().get(SEEN_OLD_ACCESSORS_OF_UPGRADED_PROPERTIES);
Map<UpgradedAccessorKey, UpgradedAccessor> oldAccessorsOfUpgradedProperties = (Map<UpgradedAccessorKey, UpgradedAccessor>) context.getUserData().get(OLD_ACCESSORS_OF_UPGRADED_PROPERTIES);

// Find accessors that were not removed but should be
Map<UpgradedAccessorKey, UpgradedAccessor> keptAccessors = new HashMap<>(oldAccessorsOfUpgradedProperties);
keptAccessors.entrySet().removeIf(e -> {
if (seenUpgradedAccessorsChanges.contains(e.getKey())) {
return true;
}
UpgradedAccessor accessor = e.getValue();
return accessor.getBinaryCompatibility() == BinaryCompatibility.ACCESSORS_KEPT;
});
if (!keptAccessors.isEmpty()) {
String formattedLeft = CollectionUtils.join("\n", keptAccessors.keySet());
throw new RuntimeException("The following accessors were upgraded, but didn't match any removed/changed method:\n\n" + formattedLeft);
}

// Find accessors that were removed but shouldn't be
Map<UpgradedAccessorKey, UpgradedAccessor> removedAccessors = new HashMap<>(oldAccessorsOfUpgradedProperties);
removedAccessors.entrySet().removeIf(e -> {
if (!seenUpgradedAccessorsChanges.contains(e.getKey())) {
return true;
}
UpgradedAccessor accessor = e.getValue();
return accessor.getBinaryCompatibility() == BinaryCompatibility.ACCESSORS_REMOVED;
});
if (!removedAccessors.isEmpty()) {
String formattedKept = CollectionUtils.join("\n", keptAccessors.keySet());
throw new RuntimeException("The following accessors were upgraded, but methods were removed although they shouldn't be:\n\n" + formattedKept);
}
}
}

0 comments on commit 63635ad

Please sign in to comment.