blob: bb315b9b08878c84a2101ff281499b950994713b [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
plugins {
id 'accord.java-conventions'
id 'maven-publish'
}
java {
withJavadocJar()
withSourcesJar()
}
dependencies {
implementation group: "com.google.guava", name: "guava", version: "27.0-jre"
implementation group: "net.ju-n.compile-command-annotations", name: "compile-command-annotations", version: "1.2.0"
// Dependencies we depend on that are not part of our API.
// These act as runtimeOnly dependencies to users
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.agrona:agrona:1.17.1'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.24.2'
}
task burn(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath, sourceSets.test.output
mainClass = 'accord.burn.BurnTest'
jvmArgs '-Dlogback.configurationFile=burn-logback.xml'
args = ['-c', '1']
}
// the team is used to 'install' so make sure that still publishes locally
task install(dependsOn: publishToMavenLocal)
task testJar(type: Jar, dependsOn: testClasses) {
archiveClassifier = 'tests'
from sourceSets.test.output
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = accord_artifactId
pom {
name = 'Apache Cassandra Accord'
description = 'General purpose transactions library using a leaderless consensus protocol to have highly available transactions'
url = 'https://cwiki.apache.org/confluence/display/CASSANDRA/CEP-15%3A+General+Purpose+Transactions'
inceptionYear = '2021'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:https://gitbox.apache.org/repos/asf/cassandra-accord.git'
developerConnection = 'scm:https://gitbox.apache.org/repos/asf/cassandra-accord.git'
url = 'https://gitbox.apache.org/repos/asf?p=cassandra-accord.git;a=tree'
}
}
// This is a hack to remove accord from the dependency list as this breaks Apache Cassandra
// This is a bug with Gradle that was supposed to be fixed in 8.0 but does not seem to work
// see https://github.com/gradle/gradle/commit/6e596c638dff59dfa06032a7e7a3974275ddb3e1
pom.withXml {
asNode().dependencies.'*'.findAll() { it.artifactId.text() == accord_artifactId }.each() { it.parent().remove(it) }
}
from components.java
// don't need to add javadoc or sources as they were added already in the java block
artifact testJar
}
}
}
task burnforkloop {
doLast {
(project.hasProperty('burnTimes') ? Integer.parseInt(project.getProperty('burnTimes')) : Integer.MAX_VALUE)
.times {
javaexec {
classpath sourceSets.main.runtimeClasspath, sourceSets.test.output
mainClass = 'accord.burn.BurnTest'
jvmArgs '-Dlogback.configurationFile=burn-logback.xml'
args = ['-c', '1']
}
}
}
}
task burnloop {
doLast {
javaexec {
classpath sourceSets.main.runtimeClasspath, sourceSets.test.output
mainClass = 'accord.burn.BurnTest'
jvmArgs '-Dlogback.configurationFile=burn-logback.xml'
args = ['-c', project.hasProperty('burnTimes') ? project.getProperty('burnTimes') : '1000000']
}
}
}
tasks {
javadoc {
options { addStringOption("Xdoclint:none", "-quiet") }
}
}