Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-maynard committed Dec 2, 2024
2 parents a7a4e67 + c7ec45f commit f922055
Show file tree
Hide file tree
Showing 116 changed files with 1,667 additions and 1,286 deletions.
4 changes: 3 additions & 1 deletion .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ github:

required_linear_history: true

del_branch_on_merge: true

required_status_checks:
# strict means "Require branches to be up to date before merging".
strict: true
strict: false
# Contexts are the names of checks that must pass. This is the value
# of the job's `name` property if it's present.
contexts:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
validate-wrappers: false

- name: Code style checks and tests
run: ./gradlew check
run: ./gradlew --continue check

- name: Check Maven publication
run: ./gradlew publishToMavenLocal sourceTarball
Expand Down
24 changes: 16 additions & 8 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ Copyright 2024 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes software licensed under the terms
of the following licenses, see LICENSE file:
* Apache Software License, Version 2.0
* Creative Commons 1.0 Universal
* Eclipse Distribution License, Version 1.0
* Eclipse Public License, Version 1.0
* Eclipse Public License, Version 2.0
* GNU General Public License, Version 2 with the GNU Classpath Exception
The initial code for the Polaris project was donated
to the ASF by Snowflake Inc. (https://www.snowflake.com/) copyright 2024.

Apache Iceberg
Copyright 2017-2022 The Apache Software Foundation

Apache Spark
Copyright 2014 and onwards The Apache Software Foundation.

Apache Hadoop
Copyright 2006 and onwards The Apache Software Foundation.

Dropwizard
Copyright 2010-2013 Coda Hale and Yammer, Inc., 2014-2020 Dropwizard Team

This product includes software developed by Coda Hale and Yammer, Inc.
15 changes: 0 additions & 15 deletions build-logic/src/main/kotlin/polaris-root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,5 @@ if (System.getProperty("idea.sync.active").toBoolean()) {
}

extensions.getByType<PublishingHelperExtension>().apply {
asfProjectName = "polaris"

mailingLists.addAll("dev", "issues", "commits")

podlingPpmcAsfIds.addAll(
"anoop",
"ashvin",
"jackye",
"jbonofre",
"russellspitzer",
"snazy",
"takidau",
"vvcephei"
)
podlingMentorsAsfIds.addAll("bdelacretaz", "blue", "holden", "jbonofre", "yao")
podlingCommitterAsfIds.addAll("adutra", "annafil", "emaynard", "collado", "yufei", "ebyhr")
}
19 changes: 10 additions & 9 deletions build-logic/src/main/kotlin/publishing/MemoizedGitInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package publishing

import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.java.archives.Attributes
Expand All @@ -34,13 +32,16 @@ import org.gradle.kotlin.dsl.extra
internal class MemoizedGitInfo {
companion object {
private fun execProc(rootProject: Project, cmd: String, vararg args: Any): String {
val buf = ByteArrayOutputStream()
rootProject.exec {
executable = cmd
args(args.toList())
standardOutput = buf
}
return buf.toString(StandardCharsets.UTF_8).trim()
var out =
rootProject.providers
.exec {
executable = cmd
args(args.toList())
}
.standardOutput
.asText
.get()
return out.trim()
}

fun gitInfo(rootProject: Project, attribs: Attributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import java.io.File
import javax.inject.Inject
import org.gradle.api.Project
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.listProperty
import org.gradle.kotlin.dsl.property

/**
Expand All @@ -36,14 +35,8 @@ import org.gradle.kotlin.dsl.property
abstract class PublishingHelperExtension
@Inject
constructor(objectFactory: ObjectFactory, project: Project) {
// optional customization of the pom.xml <name> element
val mavenName = objectFactory.property<String>().convention(project.provider { project.name })

val licenseUrl =
objectFactory.property<String>().convention("https://www.apache.org/licenses/LICENSE-2.0.txt")

// the following are only relevant on the root project
val asfProjectName = objectFactory.property<String>()
val asfProjectName = objectFactory.property<String>().convention(project.name)
val baseName =
objectFactory
.property<String>()
Expand All @@ -57,15 +50,12 @@ constructor(objectFactory: ObjectFactory, project: Project) {
val sourceTarballDigest =
objectFactory
.fileProperty()
.convention(project.provider { distributionDir.get().file("${baseName.get()}.sha512") })
.convention(
project.provider { distributionDir.get().file("${baseName.get()}.tar.gz.sha512") }
)

val mailingLists = objectFactory.listProperty(String::class.java).convention(emptyList())

// override the list of developers (P)PMC members + committers, necessary for podlings
val podlingPpmcAsfIds = objectFactory.setProperty(String::class.java).convention(emptySet())
val podlingMentorsAsfIds = objectFactory.setProperty(String::class.java).convention(emptySet())
val podlingCommitterAsfIds = objectFactory.setProperty(String::class.java).convention(emptySet())

fun distributionFile(ext: String): File =
distributionDir.get().file("${baseName.get()}.$ext").asFile
}
192 changes: 56 additions & 136 deletions build-logic/src/main/kotlin/publishing/configurePom.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package publishing

import groovy.util.Node
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.component.ModuleComponentSelector
Expand Down Expand Up @@ -50,15 +49,11 @@ internal fun configurePom(project: Project, mavenPublication: MavenPublication,

pom {
if (project != project.rootProject) {
name.set(e.mavenName.get())
description.set(project.description)

// Add the license to every pom to make it easier for downstream project to retrieve the
// license.
licenses {
license {
name.set("Apache-2.0") // SPDX identifier
url.set(e.licenseUrl.get())
}
}

Expand All @@ -77,63 +72,60 @@ internal fun configurePom(project: Project, mavenPublication: MavenPublication,
val mavenPom = this

task.doFirst {
val asfName = e.asfProjectName.get()
val (asfPrj, fromPodlings) = fetchAsfProject(asfName)

val asfProjectName = asfPrj["name"] as String
mavenPom.run {
val asfName = e.asfProjectName.get()
val projectPeople = fetchProjectPeople(asfName)

mavenPom.name.set(asfProjectName)
mavenPom.description.set(asfPrj["description"] as String)

inceptionYear.set(
(asfPrj["created"] ?: asfPrj["started"]!!).toString().replace("(\\d+)-.*", "\\1")
)
url.set(asfPrj["homepage"] as String)
organization {
name.set("The Apache Software Foundation")
url.set("https://www.apache.org/")
}
licenses {
license {
name.set("Apache-2.0") // SPDX identifier
url.set(e.licenseUrl.get())
organization {
name.set("The Apache Software Foundation")
url.set("https://www.apache.org/")
}
}
mailingLists {
e.mailingLists.get().forEach { ml ->
mailingList {
name.set("${ml.capitalized()} Mailing List")
subscribe.set("$ml-subscribe@$asfName.apache.org")
unsubscribe.set("$ml-ubsubscribe@$asfName.apache.org")
post.set("$ml@$asfName.apache.org")
archive.set("https://lists.apache.org/list.html?$ml@$asfName.apache.org")
licenses {
license {
name.set("Apache-2.0") // SPDX identifier
url.set(projectPeople.licenseUrl)
}
}
}
scm {
val codeRepo: String =
if (asfPrj.contains("repository")) {
val repos: List<String> = unsafeCast(asfPrj["repository"]) as List<String>
repos[0]
} else {
"https://github.com/apache/$asfName.git"
mailingLists {
e.mailingLists.get().forEach { ml ->
mailingList {
name.set("${ml.capitalized()} Mailing List")
subscribe.set("$ml-subscribe@$asfName.apache.org")
unsubscribe.set("$ml-ubsubscribe@$asfName.apache.org")
post.set("$ml@$asfName.apache.org")
archive.set("https://lists.apache.org/list.html?$ml@$asfName.apache.org")
}
}
connection.set("scm:git:$codeRepo")
developerConnection.set("scm:git:$codeRepo")
url.set("$codeRepo/tree/main")
tag.set("main")
}
issueManagement {
url.set(
if (asfPrj.contains("repository")) {
asfPrj["bug-database"] as String
} else {
"https://github.com/apache/$asfName/issues"
}

scm {
val codeRepo: String = projectPeople.repository
connection.set("scm:git:$codeRepo")
developerConnection.set("scm:git:$codeRepo")
url.set("$codeRepo/tree/main")
tag.set("main")
}
issueManagement { url.set(projectPeople.bugDatabase) }

name.set(projectPeople.name)
description.set(projectPeople.description)
url.set(projectPeople.website)
inceptionYear.set(projectPeople.inceptionYear.toString())

developers {
projectPeople.people.forEach { person ->
developer {
this.id.set(person.apacheId)
this.name.set(person.name)
this.organization.set("Apache Software Foundation")
this.email.set("${person.apacheId}@apache.org")
this.roles.addAll(person.roles)
}
}
)
}

addContributorsToPom(mavenPom, asfName, "Apache ${projectPeople.name}")
}
addDevelopersToPom(mavenPom, asfName, e, fromPodlings)
addContributorsToPom(mavenPom, asfName, asfProjectName)
}
}
}
Expand All @@ -143,90 +135,18 @@ internal fun configurePom(project: Project, mavenPublication: MavenPublication,
fun addContributorsToPom(mavenPom: MavenPom, asfName: String, asfProjectName: String) =
mavenPom.run {
contributors {
val contributors: List<Map<String, Any>>? =
val contributors: List<Map<String, Any>> =
parseJson("https://api.github.com/repos/apache/$asfName/contributors?per_page=1000")
if (contributors != null) {
contributors
.filter { contributor -> contributor["type"] == "User" }
.forEach { contributor ->
contributor {
name.set(contributor["login"] as String)
url.set(contributor["url"] as String)
organization.set("$asfProjectName, GitHub contributors")
organizationUrl.set("https://github.com/apache/$asfName")
}
}
}
}
}

/** Adds Apache (P)PMC members + committers, in `name` order. */
fun addDevelopersToPom(
mavenPom: MavenPom,
asfName: String,
e: PublishingHelperExtension,
fromPodlings: Boolean
) =
mavenPom.run {
developers {
// Cannot use check the 'groups' for podlings, because the (only) podling's group
// references the mentors, not the PPMC members/committers. There seems to be no
// way to automatically fetch the committers + PPMC members for a podling, except
// maybe
val people: Map<String, Map<String, Any>> =
parseJson("https://projects.apache.org/json/foundation/people.json")!!
val filteredPeople: List<Pair<String, Map<String, Any>>>
val pmc: (Pair<String, Map<String, Any>>) -> Boolean
val mentor: (Pair<String, Map<String, Any>>) -> Boolean
val pmcRole: String
if (!fromPodlings) {
val asfNamePmc = "$asfName-pmc"
filteredPeople =
people
.filter { entry ->
val groups: List<String> = unsafeCast(entry.value["groups"])
groups.any { it == asfName || it == asfNamePmc }
}
.toList()
pmc = { (_, info) ->
val groups: List<String> = unsafeCast(info["groups"])
groups.contains(asfNamePmc)
}
pmcRole = "PMC Member"
mentor = { (_, _) -> false }
} else {
val podlingPpmc = e.podlingPpmcAsfIds.get()
val podlingMentors = e.podlingMentorsAsfIds.get()
filteredPeople =
(e.podlingCommitterAsfIds.get() + podlingPpmc + podlingMentors).map { id ->
val info = people[id]
if (info == null) {
throw GradleException("Person with ASF id '%s' not found in people.json".format(id))
}
Pair(id, info)
}
pmc = { (id, _) -> podlingPpmc.contains(id) || podlingMentors.contains(id) }
pmcRole = "PPMC Member"
mentor = { (id, _) -> podlingMentors.contains(id) }
}

val sortedPeople = filteredPeople.sortedBy { (id, info) -> "${info["name"] as String}_$id" }

sortedPeople.forEach { (id, info) ->
developer {
this.id.set(id)
this.name.set(info["name"] as String)
this.organization.set("Apache Software Foundation")
this.email.set("$id@apache.org")
this.roles.add("Committer")
if (pmc.invoke(Pair(id, info))) {
this.roles.add(pmcRole)
}
if (mentor.invoke(Pair(id, info))) {
this.roles.add("Mentor")
contributors
.filter { contributor -> contributor["type"] == "User" }
.forEach { contributor ->
contributor {
name.set(contributor["login"] as String)
url.set(contributor["url"] as String)
organization.set("$asfProjectName, GitHub contributors")
organizationUrl.set("https://github.com/apache/$asfName")
}
}
}
}
}

Expand Down
Loading

0 comments on commit f922055

Please sign in to comment.