Skip to content

Conversation

@lauzadis
Copy link
Member

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@lauzadis lauzadis requested a review from a team as a code owner August 21, 2025 16:59
Comment on lines 384 to 403

// Only publish publications with the configured group from JReleaser or everything if JReleaser group is not configured
// Only publish publications with the configured group from JReleaser, or everything if JReleaser group is not configured
val publishGroupName = System.getenv(EnvironmentVariables.GROUP_ID)
shouldPublish = shouldPublish && (publishGroupName == null || publication.groupId.startsWith(publishGroupName))
shouldPublish = shouldPublish && (publishGroupName == null || publication.groupId.equals(publishGroupName, ignoreCase = true))

val overrideGroupNameValidation = project.extra.getOrNull<String>(OVERRIDE_KOTLIN_NATIVE_GROUP_NAME_VALIDATION) == "true"
if (overrideGroupNameValidation) println("Overriding group name validation for Kotlin/Native publications")

// Validate publication name is allowed to be published
shouldPublish = shouldPublish &&
(
ALLOWED_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) } ||
// standard publication
(KOTLIN_NATIVE_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) } && KOTLIN_NATIVE_PROJECT_NAMES.any { project.name.equals(it, ignoreCase = true) }) // Kotlin/Native publication
(ALLOWED_KOTLIN_NATIVE_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) } && (overrideGroupNameValidation || ALLOWED_KOTLIN_NATIVE_GROUP_NAMES.any { publication.groupId.equals(it, ignoreCase = true) })) // Kotlin/Native publication
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: I'm a little confused at how this works. If you're trying to override and publish smithy-kotlin, won't shouldPublish get set to false on L392 because publication.groupId won't equal publishGroupName? And if so, won't the shouldPublish = shouldPublish && ... logic on L398 short-circuit and skip evaluating overrideGroupNameValidation?

Copy link
Member Author

Choose a reason for hiding this comment

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

That logic on L392 is only used by our Catapult release (dependent on JReleaser environment variable). That needs to be cleaned up separately. In local development the publishGroupName == null part is true and short-circuits

Copy link
Member Author

Choose a reason for hiding this comment

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

Cleaned up this logic, should be ready for another review now

@lauzadis lauzadis requested a review from ianbotsf August 22, 2025 17:38
Comment on lines 322 to 325
if (!requiredVariables.all { System.getenv(it).isNotBlank() }) {
println("Skipping JReleaser configuration, missing one or more required environment variables: ${requiredVariables.joinToString()}")
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why did this switch from logger.info to println?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I noticed this too. logger is only available within the context of a Gradle task

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry logger was available there, but not in isAvailableForPublication

jar = false
verifyPom = false // jreleaser doesn't understand toml packaging
jar = false // Version catalogs don't produce a JAR
verifyPom = false // JReleaser fails when processing <packaging>toml</packaging> tags: `Unknown packaging: toml`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to set verifyPom to false in the artifactOverride as well as in the artifacts block?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can leave verifyPom enabled for most artifacts. If it causes issues, then we can look at disabling it

)

if (!requiredVariables.all { System.getenv(it).isNotBlank() }) {
logger.info("Skipping JReleaser configuration, missing one or more required environment variables: ${requiredVariables.joinToString()}")
Copy link
Contributor

@0marperez 0marperez Aug 22, 2025

Choose a reason for hiding this comment

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

Just a preference, I liked how we were able to see exactly which env vars were missing before

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it may have been useful for debugging while adding JReleaser, but it's very noisy for everyday builds. We would have five lines printed saying there are missing environment variables for every build

deploy {
maven {
mavenCentral {

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this block for? Will it be filled out later?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry that was included prematurely, I just pushed a commit to fix configuration for klib artifacts

@lauzadis lauzadis merged commit 7fff8cc into main Aug 25, 2025
7 checks passed
@lauzadis lauzadis deleted the fix-iosSimulator branch August 25, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants