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.

178 lines
4.6 KiB

buildscript {
def a_user = hasProperty('artifactory_user') ? artifactory_user : System.getenv('artifactory_user')
def a_password = hasProperty('artifactory_password') ? artifactory_password : System.getenv('artifactory_password')
repositories {
mavenCentral()
jcenter()
maven {
url 'http://dl.bintray.com/cbeust/maven'
}
maven {
url 'http://oss.jfrog.org/artifactory/plugins-release'
credentials {
username = "${a_user}"
password = "${a_password}"
}
}
}
dependencies {
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
classpath "com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3"
}
}
plugins {
id "com.jfrog.bintray" version "1.2"
id "com.jfrog.artifactory" version "3.1.1"
id "org.sonarqube" version "1.0"
}
version = '6.9.10-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'nebula.optional-base'
apply plugin: 'nebula.provided-base'
targetCompatibility = "1.7"
sourceCompatibility = "1.7"
apply plugin: 'osgi'
repositories {
mavenCentral()
jcenter()
maven {
url 'http://dl.bintray.com/cbeust/maven'
}
}
dependencies {
compile 'org.beanshell:bsh:2.0b4'
compile 'com.beust:jcommander:1.48'
compile 'org.apache.ant:ant:1.7.0', optional
compile 'junit:junit:4.10', optional
compile 'org.yaml:snakeyaml:1.15', optional
provided 'com.google.inject:guice:4.0:no_aop'
testCompile 'org.assertj:assertj-core:2.0.0'
testCompile 'org.testng:testng:6.9.4'
}
task sourceJar(type: Jar) {
group 'Build'
description 'An archive of the source code'
classifier 'sources'
from sourceSets.main.allSource
}
artifacts {
sourceJar
}
import org.apache.tools.ant.filters.ReplaceTokens
def generatedSourcesFolder = projectDir.toString() + '/src/generated/java'
def dirFrom = projectDir.toString() + '/src/main/resources/org/testng/internal'
def dirTo = generatedSourcesFolder + "/org/testng/internal"
def fileFrom = 'VersionTemplateJava'
def fileTo = 'Version.java'
task removeVersion {
delete dirTo + fileTo
}
sourceSets {
generated {
java {
srcDir 'src/generated/java'
}
resources {
srcDir 'src/generated/resources'
}
}
}
sourceSets {
main {
compileClasspath += generated.output
runtimeClasspath += generated.output
}
}
gradle.projectsEvaluated {
compileJava.dependsOn(myDir)
}
task myDir {
delete dirTo + "/" + fileTo
mkdir(dirTo)
}
// Include the generated Version.class in the jar
jar {
manifest {
instruction 'Bundle-License', 'http://apache.org/licenses/LICENSE-2.0'
instruction 'Bundle-Description', 'TestNG is a testing framework.'
instruction 'Import-Package',
'bsh.*;version="[2.0.0,3.0.0)";resolution:=optional',
'com.beust.jcommander.*;version="[1.7.0,3.0.0)";resolution:=optional',
'com.google.inject.*;version="[1.2,1.3)";resolution:=optional',
'junit.framework;version="[3.8.1, 5.0.0)";resolution:=optional',
'org.junit.*;resolution:=optional',
'org.apache.tools.ant.*;version="[1.7.0, 2.0.0)";resolution:=optional',
'org.yaml.*;version="[1.6,2.0)";resolution:=optional',
'!com.beust.testng',
'!org.testng.*',
'!com.sun.*',
'*'
}
from "$buildDir/classes/generated"
}
task createVersion(type: Copy, dependsOn: myDir) {
println("Creating Version file: ${version} in ${dirTo}")
from dirFrom
include fileFrom
into(dirTo)
rename(fileFrom, fileTo)
filter(ReplaceTokens, tokens: [version: version])
}
compileJava.dependsOn(createVersion)
test {
useTestNG() {
suites 'src/test/resources/testng.xml'
}
// testLogging.showStandardStreams = true
systemProperties = System.getProperties()
systemProperties['test.resources.dir'] = 'build/resources/test/'
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
sonarqube {
properties {
property "sonar.host.url", "http://nemo.sonarqube.org"
property "sonar.analysis.mode", "preview"
property "sonar.github.repository", "cbeust/testng"
property "sonar.github.login", "testng-bot"
}
}
apply from: 'gradle/publishing.gradle'