forked from hyperledger-web3j/web3j-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
141 lines (126 loc) · 4.05 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
plugins {
id 'java'
id 'java-gradle-plugin'
id 'idea'
id 'maven-publish'
id 'jacoco'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.gradle.plugin-publish' version '1.2.1'
id 'de.undercouch.download' version '4.1.2'
}
description = 'Gradle plugin providing tasks to generate Web3j contracts from Solidity.'
sourceCompatibility = 17
// the below is just for local use
ext {
web3jVersion = '1.0.4-custom'
web3jVersionCore = version
}
publishing {
publications {
maven(MavenPublication) {
from(components["java"])
groupId = "org.web3j"
artifactId = "web3j-gradle-plugin"
version = "1.0.4-custom"
}
}
repositories {
mavenLocal()
}
}
apply {
[
'jacoco',
'java',
'javadoc',
'repositories',
'spotless',
'junit'
].each { buildScript ->
download {
src "https://raw.githubusercontent.com/hyperledger/web3j-build-tools/main/gradle/$buildScript/build.gradle"
dest "$rootDir/gradle/$buildScript/build.gradle"
overwrite true
quiet true
onlyIfModified true
}
from("$rootDir/gradle/$buildScript/build.gradle")
}
}
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
implementation "org.web3j.solidity:solidity-gradle-plugin:$solidityPluginVersion"
implementation("org.web3j:core:$web3jVersionCore") {
exclude group: 'org.slf4j', module: 'slf4j-nop'
}
implementation("org.web3j:codegen:$web3jVersionCore") {
exclude group: 'org.slf4j', module: 'slf4j-nop'
}
configurations.all {
resolutionStrategy {
force(group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlinVersion)
force(group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlinVersion)
force(group: "org.jetbrains.kotlin", name: "kotlin-stdlib-common", version: kotlinVersion)
force(group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlinVersion)
force(group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlinVersion)
}
}
}
gradlePlugin {
website = 'https://web3j.io/'
vcsUrl = 'https://github.com/hyperledger/web3j-gradle-plugin'
plugins {
web3j {
description = 'Gradle plugin providing tasks to generate web3j contracts from Solidity.'
displayName = description
tags.set([
'solidity',
'ethereum',
'web3.js',
'web3j'
])
id = 'org.web3j'
implementationClass = 'org.web3j.gradle.plugin.Web3jPlugin'
}
}
}
def generatedResources = "$buildDir/generated-resources/main"
sourceSets {
main {
output.dir(generatedResources, builtBy: 'generateVersionProperties')
}
}
task generateVersionProperties {
doLast {
new File(generatedResources).mkdirs()
def generated = new File(generatedResources, "version.properties")
generated.text = "version=$rootProject.version"
}
}
tasks.withType(Test) {
reports.html.destination file("${reporting.baseDir}/${name}")
}
tasks.named('spotlessJava') {
dependsOn downloadJavaLicense, downloadFormatterProperties
mustRunAfter tasks.named('compileJava')
mustRunAfter tasks.named('spotlessGroovyGradle')
dependsOn tasks.named('javadoc')
dependsOn tasks.named('pluginDescriptors')
dependsOn tasks.named('processResources')
}
tasks.named('spotlessKotlin') {
dependsOn downloadJavaLicense, downloadFormatterProperties
mustRunAfter tasks.named('compileJava')
mustRunAfter tasks.named('spotlessGroovyGradle')
dependsOn tasks.named('spotlessJava')
}
tasks.named('spotlessCheck') {
dependsOn downloadJavaLicense, downloadFormatterProperties
dependsOn tasks.named('spotlessJava')
dependsOn tasks.named('spotlessKotlin')
dependsOn tasks.named('spotlessGroovyGradle')
}