-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
80 lines (69 loc) · 2.31 KB
/
build.gradle
File metadata and controls
80 lines (69 loc) · 2.31 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
import java.text.SimpleDateFormat
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
id 'java-library'
}
group 'com.wowza.wms.plugin.interstitialsrestapi'
version '1.0.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir {
dirs "$wseLibDir"
}
}
configurations {
plugin
compileClasspath.extendsFrom(plugin)
runtimeClasspath.extendsFrom(plugin)
}
dependencies {
implementation fileTree(dir: "$wseLibDir", include: '**/*.jar')
implementation 'org.apache.logging.log4j:log4j-core:2.17.2'
implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0'
}
tasks.withType(Jar).configureEach {
manifest {
attributes(
'Gradle-Version' : "Gradle ${gradle.gradleVersion}",
'Created-By' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Name' : "${project.name}",
'Build-Version' : "${project.version}",
)
}
exclude('git.properties')
metaInf {
from files('LICENSE.txt')
}
archiveBaseName = 'wse-plugin-' + projectName
}
tasks.register('generateReleaseInfo') {
group = "build"
Provider<Directory> outputDir = layout.buildDirectory.dir('generated/java') as Provider<Directory>
outputs.dir outputDir.get().asFile.absolutePath
doLast {
def now = System.currentTimeMillis()
def packageDotPath = "${project.group}"
def packagePath = packageDotPath.replaceAll('\\.', '/')
Directory dir = outputDir.get().dir(packagePath)
dir.asFile.mkdirs()
dir.file("ReleaseInfo.java").asFile.text =
"""|package $packageDotPath;
|public class ReleaseInfo {
| public static String getProject() { return "${projectName}"; }
| public static String getVersion() { return "${project.version}"; }
|}""".stripMargin()
}
}
sourceSets.main.java.srcDir generateReleaseInfo
clean.finalizedBy generateReleaseInfo
compileJava.dependsOn generateReleaseInfo
test {
useJUnitPlatform()
}