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

Fix some more IP problems in Gradle build #29267

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

asodja
Copy link
Member

@asodja asodja commented May 23, 2024

This fixes IP issues for:

  • gradlebuild.unittest-and-compile
  • gradlebuild.publish-public-libraries
  • gradlebuild.binary-compatibility plugin
  • documentation/docs/build.gradle
  • gradlebuild.cross-version-tests
  • gradlebuild.distribution-testing
  • gradlebuild.integration-tests
  • PerformanceTestPlugin

The only remaining issues for sync are coming from IntelliJ init script and dependency-analysis plugin.

Note that sync fails with this exception:

java.lang.IllegalStateException: Cannot add listener of type ProjectComponentObservationListener after events have been broadcast.
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.checkListenersCanBeAdded(DefaultListenerManager.java:334)
	at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.maybeAdd(DefaultListenerManager.java:259)
	at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.useAsListener(DefaultListenerManager.java:504)
	at org.gradle.internal.event.DefaultListenerManager.addListener(DefaultListenerManager.java:118)
	at org.gradle.configurationcache.fingerprint.ConfigurationCacheFingerprintController.addListener(ConfigurationCacheFingerprintController.kt:297)
	at org.gradle.configurationcache.fingerprint.ConfigurationCacheFingerprintController.access$addListener(ConfigurationCacheFingerprintController.kt:73)
	at org.gradle.configurationcache.fingerprint.ConfigurationCacheFingerprintController$Paused.maybeStart(ConfigurationCacheFingerprintController.kt:195)
	at org.gradle.configurationcache.fingerprint.ConfigurationCacheFingerprintController.maybeStartCollectingFingerprint(ConfigurationCacheFingerprintController.kt:251)
	at org.gradle.configurationcache.DefaultConfigurationCache.startCollectingCacheFingerprint(DefaultConfigurationCache.kt:467)
	at org.gradle.configurationcache.DefaultConfigurationCache.prepareForWork(DefaultConfigurationCache.kt:353)
	at org.gradle.configurationcache.DefaultConfigurationCache.runWorkThatContributesToCacheEntry(DefaultConfigurationCache.kt:342)
	at org.gradle.configurationcache.DefaultConfigurationCache.loadOrScheduleRequestedTasks(DefaultConfigurationCache.kt:152)
	at org.gradle.configurationcache.ConfigurationCacheAwareBuildTreeWorkController$scheduleAndRunRequestedTasks$executionResult$1.apply(ConfigurationCacheAwareBuildTreeWorkController.kt:45)
	at org.gradle.configurationcache.ConfigurationCacheAwareBuildTreeWorkController$scheduleAndRunRequestedTasks$executionResult$1.apply(ConfigurationCacheAwareBuildTreeWorkController.kt:44)
	at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph.withNewWorkGraph(DefaultIncludedBuildTaskGraph.java:112)
... some more lines

@asodja asodja self-assigned this May 23, 2024
@asodja asodja added the a:investigation Issues requiring decision or investigation label May 23, 2024
@gradle gradle deleted a comment from asodja May 23, 2024
@gradle gradle deleted a comment from asodja May 23, 2024
@gradle gradle deleted a comment from asodja May 23, 2024
@gradle gradle deleted a comment from asodja May 23, 2024
@asodja asodja requested a review from alllex May 23, 2024 08:40
@asodja asodja marked this pull request as ready for review May 23, 2024 08:40
@asodja asodja requested review from a team as code owners May 23, 2024 08:40
@@ -24,4 +24,12 @@ interface BuildEnvironmentExtension {
val gitCommitId: Property<String>
val gitBranch: Property<String>
val repoRoot: DirectoryProperty
val rootProjectBuildDir: DirectoryProperty
val artifactoryUserName: Property<String>
val artifactoryPassword: Property<String>
Copy link
Member

Choose a reason for hiding this comment

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

❓ Can we avoid storing passwords in Properties here?

Copy link
Member Author

@asodja asodja May 23, 2024

Choose a reason for hiding this comment

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

I guess we cound store them in env variables and read env variables here:

val artifactoryUserName
get() = getBuildEnvironmentExtension().artifactoryUserName.orNull
val artifactoryUserPassword
get() = getBuildEnvironmentExtension().artifactoryPassword.orNull

Would that be a better solution?

We publish only from CI right? So then we also need to pass these variables differently in teamcity builds.

Copy link
Member

Choose a reason for hiding this comment

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

The password is already available in an environment variable

password("env.ORG_GRADLE_PROJECT_artifactoryUserPassword", "%gradle.internal.repository.build-tool.publish.password%")

AFAICT we could reference that as we only need the password if we actually publish, correct me if I'm wrong @blindpirate

Copy link
Collaborator

Choose a reason for hiding this comment

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

Note that ORG_GRADLE_PROJECT_artifactoryUserPassword actually injects a gradle property, i.e. it equals -PartifactoryUserPassword=X. See https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties

So we can get the property via gradle property, not env variable.

@@ -29,6 +30,14 @@ abstract class BuildEnvironmentService : BuildService<BuildEnvironmentService.Pa

interface Parameters : BuildServiceParameters {
val rootProjectDir: DirectoryProperty
val rootProjectBuildDir: DirectoryProperty
val artifactoryUserName: Property<String>
val artifactoryPassword: Property<String>
Copy link
Member

Choose a reason for hiding this comment

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

❓ Can we avoid storing passwords in Properties here?

@asodja asodja added a:chore Minor issue without significant impact and removed a:investigation Issues requiring decision or investigation labels May 24, 2024
@alllex alllex requested review from bamboo and 6hundreds May 31, 2024 09:49
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 in:isolated-projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants