-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
112 lines (99 loc) · 3.95 KB
/
build.gradle
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
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
maven { url 'http://dl.bintray.com/content/aalmiray/kordamp' }
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4',
'gradle.plugin.com.github.jk1:gradle-license-report:1.3',
'org.kordamp:markdown-gradle-plugin:1.1.0'
}
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.github.jk1.dependency-license-report'
apply plugin: 'org.kordamp.markdown.convert'
project.version = version
ext.os = project.properties['os'] ?: null
ext.manifestVersion = '1.0'
ext.mainClass = 'com.github.theque5t.Detect4j.Loader'
ext.specificationName = 'com/github/theque5t/Detect4j/'
ext.specificationTitle = 'Detect4j'
ext.specificationVendor = 'theque5t'
ext.specificationVersion = '1.0.0'
ext.implementationVendor = 'theque5t'
ext.implementationVendorId = 'com.github.theque5t.Detect4j'
ext.implementationURL = 'https://github.com/theque5t/Detect4j'
ext.licenseTitle = 'MIT License'
ext.dependencyIndex = 'index.md'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.2'
implementation files(org.gradle.internal.jvm.Jvm.current().toolsJar)
}
task addHtmlToConversionWorkspace(type: Copy){
into "$buildDir/output/META-INF"
from "$buildDir/reports/dependency-license/index.html"
}
htmlToMarkdown {
sourceDir = file("$buildDir/output/META-INF")
outputDir = file("$buildDir/output/META-INF")
}
task addDependencyLicenseToOutput(type: Copy) {
into "$buildDir/output/META-INF"
from "$buildDir/reports/dependency-license"
}
task addLicenseToOutput(type: Copy) {
into "$buildDir/output/META-INF"
from "LICENSE"
rename { String fileName ->
fileName.replace("LICENSE", "${project.name}_LICENSE")
}
}
task createReports(type: Copy) {
into "$buildDir/reports/"
from "$buildDir/output/META-INF"
}
task cleanUpOutput(type: Delete){
delete "$buildDir/output/META-INF/index.html"
}
task cleanUpReports(type: Delete){
delete "$buildDir/reports/index.html"
delete "$buildDir/reports/dependency-license"
delete "$buildDir/reports/${project.name}_LICENSE"
}
shadowJar {
archiveClassifier.set(os)
from "$buildDir/output"
manifest {
attributes 'Manifest-Version': manifestVersion
attributes 'Main-Class': mainClass
attributes 'Name': specificationName
attributes 'Specification-Title': specificationTitle
attributes 'Specification-Vendor': specificationVendor
attributes 'Specification-Version': specificationVersion
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': project.version
attributes 'Implementation-Vendor': implementationVendor
attributes 'Implementation-Vendor-Id': implementationVendorId
attributes 'Implementation-URL': implementationURL
attributes 'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date())
attributes 'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})"
attributes 'Created-By': "Gradle ${gradle.gradleVersion}"
attributes 'License-Title': licenseTitle
attributes 'License-File': "${project.name}_LICENSE"
attributes 'Dependency-Index': dependencyIndex
}
}
addHtmlToConversionWorkspace.dependsOn(generateLicenseReport)
htmlToMarkdown.dependsOn(addHtmlToConversionWorkspace)
addDependencyLicenseToOutput.dependsOn(htmlToMarkdown)
addLicenseToOutput.dependsOn(addDependencyLicenseToOutput)
createReports.dependsOn(addLicenseToOutput)
cleanUpOutput.dependsOn(createReports)
cleanUpReports.dependsOn(cleanUpOutput)
shadowJar.dependsOn(cleanUpReports)