-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
121 lines (100 loc) · 3.25 KB
/
build.gradle
File metadata and controls
121 lines (100 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Gradle plugin project to get you started.
* For more details take a look at the Writing Custom Plugins chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.5.1/userguide/custom_plugins.html
*/
plugins {
// Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
id 'java-gradle-plugin'
// Apply the Groovy plugin to add support for Groovy
id 'groovy'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '1.3.1'
id 'application'
}
// Project versions
ext.major = '0'
ext.minor = '18'
java {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
// Use the awesome Spock testing and specification framework
testImplementation 'org.spockframework:spock-core:2.1-groovy-3.0'
}
gradlePlugin {
website = 'https://github.com/mbeddr/mps-cli'
vcsUrl = 'https://github.com/mbeddr/mps-cli'
// Define the plugin
plugins {
mps_cli {
id = 'com.mbeddr.mps_cli'
displayName = 'MPS-CLI'
description = 'This plugin parses JetBrains Meta-Programming System (MPS) files (.mpsr, .mps) and builds an object model.'
tags.set(['jetbrains mps'])
implementationClass = 'org.mps_cli.gradle.plugin.MpsCliGradlePluginPlugin'
}
}
}
// Add a source set for the functional test suite
sourceSets {
functionalTest {
}
}
configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation)
// Add a task to run the functional tests
tasks.register('functionalTest', Test) {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
useJUnitPlatform()
}
gradlePlugin.testSourceSets(sourceSets.functionalTest)
tasks.named('check') {
// Run the functional tests as part of `check`
dependsOn(tasks.functionalTest)
}
tasks.named('test') {
// Use JUnit Jupiter for unit tests.
useJUnitPlatform()
}
group = 'com.mbeddr'
if (System.env.CI != null && System.env.CI.toBoolean()) {
def buildNumber = System.env.GITHUB_RUN_NUMBER != null ? System.env.GITHUB_RUN_NUMBER.toInteger() : System.env.BUILD_NUMBER.toInteger()
def shortCommitHash = System.env.GITHUB_SHA.substring(0, 7)
version = "$major.$minor.$buildNumber.$shortCommitHash"
println "##CI computed version='${version}'"
} else {
println "Local build detected, version will be SNAPSHOT"
version = "$major.$minor"
}
application {
mainClass = 'org.mps_cli.MpsCliDemo'
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/mbeddr/mps-cli")
if (project.hasProperty("gpr.token")) {
credentials {
username = project.findProperty("gpr.user")
password = project.findProperty("gpr.token")
}
}
}
}
publications {
maven(MavenPublication) {
groupId = 'com.mbeddr.mps_cli'
artifactId = 'gradle.plugin'
from components.java
}
}
}