Created
May 27, 2021 04:09
-
-
Save kubode/d1e7da197f3381b9569336b215c48a9a to your computer and use it in GitHub Desktop.
Kotlin DSL extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repository { | |
google() | |
github("kubode/some-repo") | |
mavenCentral() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.URI | |
import org.gradle.api.Project | |
import org.gradle.api.artifacts.dsl.RepositoryHandler | |
import org.gradle.api.artifacts.repositories.MavenArtifactRepository | |
import org.gradle.kotlin.dsl.provideDelegate | |
val RepositoryHandler.github: Project.(repo: String) -> MavenArtifactRepository get() = { repo -> | |
maven { | |
url = URI("https://maven.pkg.github.com/$repo") | |
credentials { | |
val githubToken: String by project | |
username = "unused" | |
password = githubToken | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment