mirror of https://github.com/hyperledger/besu
An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.3 KiB
79 lines
2.3 KiB
5 years ago
|
/*
|
||
|
* Copyright 2019 ConsenSys AG.
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||
|
* the License. You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||
|
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||
|
* specific language governing permissions and limitations under the License.
|
||
|
*/
|
||
|
|
||
|
import net.ltgt.gradle.errorprone.CheckSeverity
|
||
|
import java.security.MessageDigest
|
||
|
|
||
|
apply plugin: 'java-library'
|
||
|
jar {
|
||
|
baseName 'plugin-api'
|
||
|
manifest {
|
||
|
attributes(
|
||
|
'Specification-Title': baseName,
|
||
|
'Specification-Version': project.version,
|
||
|
'Implementation-Title': baseName,
|
||
|
'Implementation-Version': calculateVersion()
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
dependencies {
|
||
|
}
|
||
|
|
||
|
configurations { testArtifacts }
|
||
|
artifacts { testSupportArtifacts testSupportJar }
|
||
|
|
||
|
class FileStateChecker extends DefaultTask {
|
||
|
Set<File> files
|
||
|
String knownHash
|
||
|
|
||
|
@TaskAction
|
||
|
def CheckState() {
|
||
|
def digestor = MessageDigest.getInstance("SHA-256")
|
||
|
|
||
|
this.files.sort().each {
|
||
|
digestor.update(it.readBytes())
|
||
|
}
|
||
|
def currentHash = digestor.digest()encodeBase64().toString()
|
||
|
if (this.knownHash != currentHash) {
|
||
|
throw new GradleException("""For the Plugin APIs the checksum of the project did not match what was expected.
|
||
|
|
||
|
If this is a deliberate change where you have thought through backwards compatibility,
|
||
|
then update "Expected" for "Calculated" in the appropriate build.gradle as the knownHash for this task.
|
||
|
Expected : ${this.knownHash}
|
||
|
Calculated : ${currentHash}
|
||
|
""")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
tasks.register('checkAPIChanges', FileStateChecker) {
|
||
|
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
|
||
|
files = sourceSets.main.allJava.files
|
||
|
knownHash = 'PBo0D4R6/1EYXEn+k0nmWHW4TkklUWQbQGNqgWzslfw='
|
||
|
}
|
||
|
check.dependsOn('checkAPIChanges')
|
||
|
|
||
|
publishing {
|
||
|
publications {
|
||
|
mavenJava(MavenPublication) {
|
||
5 years ago
|
groupId 'tech.pegasys.pantheon'
|
||
5 years ago
|
pom {
|
||
|
name = 'Pantheon Plugins Library'
|
||
|
description = 'Core Plugins Libraries for Pantheon'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|