-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild.gradle
More file actions
116 lines (102 loc) · 3.08 KB
/
build.gradle
File metadata and controls
116 lines (102 loc) · 3.08 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
buildscript {
dependencies {
classpath files('gradle/gradle-witness.jar')
}
}
apply plugin: 'java'
apply plugin: 'witness'
apply plugin: 'maven-publish'
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
version = "37"
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://mvn.freenetproject.org' }
}
configurations {
extraLibs
}
dependencies {
compile group: 'org.freenetproject', name: 'fred', version: 'build+'
}
dependencyVerification {
verify = [
'org.bouncycastle:bcprov-jdk15on:1c31e44e331d25e46d293b3e8ee2d07028a67db011e74cb2443285aed1d59c85',
'net.java.dev.jna:jna-platform:f1d00c167d8921c6e23c626ef9f1c3ae0be473c95c68ffa012bc7ae55a87e2d6',
'net.java.dev.jna:jna:0c8eb7acf67261656d79005191debaba3b6bf5dd60a43735a245429381dbecff',
'org.freenetproject:freenet-ext:32f2b3d6beedf54137ea2f9a3ebef67666d769f0966b08cd17fd7db59ba4d79f',
]
}
def gitrev
task buildInfo {
try {
def cmd = "git describe --always --abbrev=4 --dirty"
def proc = cmd.execute()
gitrev = proc.text.trim()
} catch (java.io.IOException e) {
gitrev = "@unknown@"
}
}
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
jar {
manifest {
attributes 'Plugin-Main-Class': 'plugins.flophelper.FlogHelper',
'Required-Node-Version': '1239',
'Implementation-Version': version
}
from (configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
preserveFileTimestamps = false
reproducibleFileOrder = true
duplicatesStrategy = "exclude"
archiveName = 'freenet-FlogHelper.jar'
}
def jars = []
gradle.addListener(new TaskExecutionListener() {
void afterExecute(Task task, TaskState state) {
if(task in AbstractArchiveTask) {
jars << task.outputs.files.singleFile
}
}
void beforeExecute(Task task) { }
})
gradle.addBuildListener(new BuildAdapter() {
void buildFinished(BuildResult result) {
if(jars) {
def hash = {
File file -> def sha256 = java.security.MessageDigest.getInstance('SHA-256')
file.eachByte(1024 * 4) { buffer, len -> sha256.update(buffer, 0, len) }
println "SHA-256 of ${file.name}: ${sha256.digest().encodeHex().toString()}"
}
jars.each { hash(it) }
}
}
})
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'org.freenetproject.plugins'
artifactId "FlogHelper"
version version
from components.java
}
}
repositories {
maven {
url "s3://mvn.freenetproject.org/"
credentials(AwsCredentials) {
accessKey System.getenv('AWS_ACCESS_KEY_ID')
secretKey System.getenv('AWS_SECRET_ACCESS_KEY')
}
}
}
}