-
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.
Inject default settings automatically
- Loading branch information
Showing
8 changed files
with
59 additions
and
85 deletions.
There are no files selected for viewing
17 changes: 8 additions & 9 deletions
17
convention-plugin/src/main/kotlin/org/metaborg/convention/JavaConventionExtension.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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
package org.metaborg.convention | ||
|
||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.Property | ||
import org.gradle.jvm.toolchain.JavaLanguageVersion | ||
import javax.inject.Inject | ||
|
||
/** Configuration for the Java convention. */ | ||
interface JavaConventionExtension { | ||
open class JavaConventionExtension @Inject constructor( | ||
/** The Gradle object factory. */ | ||
objects: ObjectFactory, | ||
) { | ||
/** The Java version to compile to. */ | ||
val javaVersion: Property<JavaLanguageVersion> | ||
|
||
/** | ||
* Sets the convention (default values) for the configuration extension. | ||
*/ | ||
fun setConvention() { | ||
javaVersion.convention(JavaLanguageVersion.of(11)) | ||
} | ||
val javaVersion: Property<JavaLanguageVersion> = objects.property(JavaLanguageVersion::class.java) | ||
.convention(JavaLanguageVersion.of(11)) | ||
} |
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
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
50 changes: 24 additions & 26 deletions
50
convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionExtension.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 |
---|---|---|
@@ -1,42 +1,40 @@ | ||
package org.metaborg.convention | ||
|
||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.Property | ||
import javax.inject.Inject | ||
|
||
/** Configuration for the root project convention. */ | ||
interface RootProjectConventionExtension { | ||
|
||
open class RootProjectConventionExtension @Inject constructor( | ||
/** The Gradle object factory. */ | ||
objects: ObjectFactory, | ||
) { | ||
/** Suffix for all task names. */ | ||
val taskNameSuffix: Property<String> | ||
val taskNameSuffix: Property<String> = objects.property(String::class.java) | ||
.convention("") | ||
|
||
/** The name of the `assemble` task. */ | ||
val assembleTaskName: Property<String> | ||
val assembleTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "assemble$it"} ) | ||
/** The name of the `build` task. */ | ||
val buildTaskName: Property<String> | ||
val buildTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "build$it"} ) | ||
/** The name of the `clean` task. */ | ||
val cleanTaskName: Property<String> | ||
val cleanTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "clean$it"} ) | ||
/** The name of the `publish` task. */ | ||
val publishTaskName: Property<String> | ||
val publishTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "publish$it"} ) | ||
/** The name of the `publishToMavenLocal` task. */ | ||
val publishToMavenLocalTaskName: Property<String> | ||
val publishToMavenLocalTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "publish${it}ToMavenLocal"} ) | ||
/** The name of the `check` task. */ | ||
val checkTaskName: Property<String> | ||
val checkTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "check$it"} ) | ||
/** The name of the `test` task. */ | ||
val testTaskName: Property<String> | ||
val testTaskName: Property<String> = objects.property(String::class.java) | ||
.convention(taskNameSuffix.map { "test$it"} ) | ||
/** The name of the `tasks` task. */ | ||
val tasksTaskName: Property<String> | ||
|
||
/** | ||
* Sets the convention (default values) for the configuration extension. | ||
*/ | ||
fun setConvention() { | ||
taskNameSuffix.convention("") | ||
assembleTaskName.convention(taskNameSuffix.map { "assemble$it"} ) | ||
buildTaskName.convention(taskNameSuffix.map { "build$it"} ) | ||
cleanTaskName.convention(taskNameSuffix.map { "clean$it"} ) | ||
publishTaskName.convention(taskNameSuffix.map { "publish$it"} ) | ||
publishToMavenLocalTaskName.convention(taskNameSuffix.map { "publish${it}ToMavenLocal"} ) | ||
checkTaskName.convention(taskNameSuffix.map { "check$it"} ) | ||
testTaskName.convention(taskNameSuffix.map { "test$it"} ) | ||
tasksTaskName.convention("allTasks") | ||
} | ||
val tasksTaskName: Property<String> = objects.property(String::class.java) | ||
.convention("allTasks") | ||
} |
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: 6 additions & 6 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package org.metaborg.convention | ||
|
||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.Property | ||
import javax.inject.Inject | ||
|
||
/** Configuration for the settings build convention. */ | ||
interface SettingsConventionExtension { | ||
open class SettingsConventionExtension @Inject constructor( | ||
/** The Gradle object factory. */ | ||
objects: ObjectFactory, | ||
) { | ||
|
||
/** | ||
* Sets the convention (default values) for the configuration extension. | ||
*/ | ||
fun setConvention() { | ||
} | ||
} |
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