-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add org.metaborg.convention.settings plugin
- Loading branch information
Showing
5 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
12 changes: 12 additions & 0 deletions
12
convention-plugin/src/main/kotlin/org/metaborg/convention/SettingsConventionExtension.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.metaborg.convention | ||
|
||
/** Configuration for the settings build convention. */ | ||
interface SettingsConventionExtension { | ||
|
||
/** | ||
* Sets the convention (default values) for the configuration extension. | ||
*/ | ||
fun setConvention() { | ||
|
||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
convention-plugin/src/main/kotlin/org/metaborg/convention/SettingsConventionPlugin.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.metaborg.convention | ||
|
||
import com.gradle.develocity.agent.gradle.DevelocityConfiguration | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.initialization.Settings | ||
import org.gradle.kotlin.dsl.create | ||
import org.gradle.kotlin.dsl.maven | ||
|
||
/** | ||
* Configures a Gradle build. | ||
*/ | ||
@Suppress("unused") | ||
class SettingsConventionPlugin: Plugin<Settings> { | ||
|
||
private val catalogVersion = "0.3.6" | ||
|
||
@Suppress("UnstableApiUsage") | ||
override fun apply(settings: Settings): Unit = with(settings) { | ||
// Add the configuration extension | ||
val extension = extensions.create<SettingsConventionExtension>("settingsConvention") | ||
extension.setConvention() | ||
|
||
// This allows us to use plugins from Metaborg Artifacts | ||
pluginManagement { | ||
repositories { | ||
maven(url = "https://artifacts.metaborg.org/content/groups/public/") | ||
} | ||
} | ||
|
||
// This allows us to use the catalog in dependencies | ||
dependencyResolutionManagement { | ||
repositories { | ||
maven(url = "https://artifacts.metaborg.org/content/groups/public/") | ||
} | ||
versionCatalogs { | ||
create("libs") { | ||
from("org.metaborg.spoofax3:catalog:$catalogVersion") | ||
} | ||
} | ||
} | ||
|
||
// Apply and configure the Develocity plugin | ||
plugins.apply("com.gradle.develocity") | ||
extensions.configure(DevelocityConfiguration::class.java) { | ||
val isCI = System.getenv("CI").isNullOrEmpty() | ||
buildScan { | ||
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use") | ||
termsOfUseAgree.set("yes") | ||
publishing.onlyIf { isCI } | ||
if (isCI) tag("CI") | ||
capture { | ||
fileFingerprints.set(true) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ pluginManagement { | |
includeBuild("../convention-plugin") | ||
} | ||
|
||
plugins { | ||
id("org.metaborg.convention.settings") | ||
} |