Skip to content

Commit

Permalink
Support developers and contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
Virtlink committed Jul 26, 2024
1 parent 61653f2 commit 9b3dde7
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ open class MavenPublishConventionExtension @Inject constructor(
/** The year the project was started. */
val inceptionYear: Property<String> = objects.property(String::class.java)
/** The developers of the project. */
val developers: ListProperty<Developer> = objects.listProperty(Developer::class.java)
val developers: ListProperty<Person> = objects.listProperty(Person::class.java)
/** The (main) contributors of the project. */
val contributors: ListProperty<Person> = objects.listProperty(Person::class.java)
/** The source control management system. */
val scm: Property<SCM> = objects.property(SCM::class.java)
.convention(SCM.GitHub)
Expand All @@ -57,14 +59,14 @@ open class MavenPublishConventionExtension @Inject constructor(
}


/** Specifies a developer. */
data class Developer(
/** The developer's ID or username. */
val id: String,
/** The developer's full name. */
/** Specifies a person. */
data class Person(
/** The person's full name. */
val name: String,
/** The developer's email address. */
val email: String,
/** The person's ID or username. */
val id: String? = null,
/** The person's email address. */
val email: String? = null,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,27 @@ class MavenPublishConventionPlugin: Plugin<Project> {
distribution.set("repo")
}
}
organization {
name.set("Programming Languages Group, Delft University of Technology")
url.set("https://pl.ewi.tudelft.nl/")
}
developers {
metadata.developers.map {
for (dev in it) {
for (person in it) {
developer {
id.set(dev.id)
name.set(dev.name)
email.set(dev.email)
id.set(person.id)
name.set(person.name)
email.set(person.email)
}
}
}
}
contributors {
metadata.contributors.map {
for (person in it) {
contributor {
name.set(person.name)
email.set(person.email)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ plugins:
developers:
- id: "Virtlink"
name: "Daniel A. A. Pelsmaeker"
email: "[email protected]"

files:
githubWorkflows:
Expand Down
4 changes: 2 additions & 2 deletions repoman/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import org.metaborg.convention.Developer
import org.metaborg.convention.Person

// Workaround for issue: https://youtrack.jetbrains.com/issue/KTIJ-19369
@Suppress("DSL_SCOPE_VIOLATION")
Expand Down Expand Up @@ -53,7 +53,7 @@ mavenPublishConvention {
metadata {
inceptionYear.set("2024")
developers.set(listOf(
Developer("Virtlink", "Daniel A. A. Pelsmaeker", "[email protected]"),
Person("Virtlink", "Daniel A. A. Pelsmaeker", "[email protected]"),
))
}
}
2 changes: 0 additions & 2 deletions repoman/examplemeta.yaml

This file was deleted.

20 changes: 11 additions & 9 deletions repoman/src/main/kotlin/org/metaborg/repoman/meta/RepoMetadata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ data class RepoMetadata(
/** A list of Gradle plugins published by the repo. */
val plugins: List<GradlePlugin> = emptyList(),

/** An ordered list of (main) developers that worked on the repo. */
val developers: List<Developer> = emptyList(),
/** An ordered list of developers that may be contacted about the repo. */
val developers: List<Person> = emptyList(),
/** An ordered list of (main) contributors that also worked on the repo. */
val contributors: List<Person> = emptyList(),

/** The configurations for the generated files. */
val files: Files = Files(),
Expand Down Expand Up @@ -204,15 +206,15 @@ data class GradlePlugin(
val description: Markdown? = null,
)

/** A developer. */
/** A person. */
@Serializable
data class Developer(
/** The ID of the developer, usually their GitHub nickname. */
val id: String,
/** The (full) name of the developer. */
data class Person(
/** The ID of the person, usually their GitHub nickname. */
val id: String? = null,
/** The (full) name of the person. */
val name: String,
/** The e-mail address of the developer. */
val email: String,
/** The e-mail address of the person. */
val email: String? = null,
)

/** An included build. */
Expand Down
11 changes: 9 additions & 2 deletions repoman/src/main/resources/templates/build.gradle.kts.kte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import org.metaborg.repoman.meta.Defaults
@import org.metaborg.repoman.meta.RepoMetadata
@param meta: RepoMetadata
import org.metaborg.convention.Developer
import org.metaborg.convention.Person
import org.metaborg.convention.MavenPublishConventionExtension

// Workaround for issue: https://youtrack.jetbrains.com/issue/KTIJ-19369
Expand Down Expand Up @@ -46,7 +46,14 @@ allprojects {
@if(meta.developers.isNotEmpty())
developers.set(listOf(
@for(entry in meta.developers)
Developer("${entry.id}", "${entry.name}", "${entry.email}"),
Person("${entry.name}", email = ${if (entry.email != null) "\"${entry.email}\"" else "null"}, id = ${if (entry.id != null) "\"${entry.id}\"" else "null"}),
@endfor
))
@endif
@if(meta.contributors.isNotEmpty())
contributors.set(listOf(
@for(entry in meta.contributors)
Person("${entry.name}", email = ${if (entry.email != null) "\"${entry.email}\"" else "null"}, id = ${if (entry.id != null) "\"${entry.id}\"" else "null"}),
@endfor
))
@endif
Expand Down

0 comments on commit 9b3dde7

Please sign in to comment.