• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1buildscript {
2
3    def a_user = hasProperty('artifactory_user') ? artifactory_user : System.getenv('artifactory_user')
4    def a_password = hasProperty('artifactory_password') ? artifactory_password : System.getenv('artifactory_password')
5
6    repositories {
7        mavenCentral()
8        jcenter()
9        maven {
10            url 'http://dl.bintray.com/cbeust/maven'
11        }
12        maven {
13            url 'http://oss.jfrog.org/artifactory/plugins-release'
14            credentials {
15                username = "${a_user}"
16                password = "${a_password}"
17            }
18        }
19    }
20
21    dependencies {
22        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
23        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
24        classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
25        classpath "com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3"
26    }
27}
28
29plugins {
30    id "com.jfrog.bintray" version "1.2"
31    id "com.jfrog.artifactory" version "3.1.1"
32    id "org.sonarqube" version "1.0"
33}
34
35version = '6.9.10-SNAPSHOT'
36
37apply plugin: 'java'
38apply plugin: 'nebula.optional-base'
39apply plugin: 'nebula.provided-base'
40
41targetCompatibility = "1.7"
42sourceCompatibility = "1.7"
43
44apply plugin: 'osgi'
45
46repositories {
47    mavenCentral()
48    jcenter()
49    maven {
50        url 'http://dl.bintray.com/cbeust/maven'
51    }
52}
53
54dependencies {
55    compile 'org.beanshell:bsh:2.0b4'
56    compile 'com.beust:jcommander:1.48'
57
58    compile 'org.apache.ant:ant:1.7.0', optional
59    compile 'junit:junit:4.10', optional
60    compile 'org.yaml:snakeyaml:1.15', optional
61
62    provided 'com.google.inject:guice:4.0:no_aop'
63
64    testCompile 'org.assertj:assertj-core:2.0.0'
65    testCompile 'org.testng:testng:6.9.4'
66}
67
68task sourceJar(type: Jar) {
69    group 'Build'
70    description 'An archive of the source code'
71    classifier 'sources'
72    from sourceSets.main.allSource
73}
74
75artifacts {
76    sourceJar
77}
78
79import org.apache.tools.ant.filters.ReplaceTokens
80
81def generatedSourcesFolder = projectDir.toString() + '/src/generated/java'
82
83def dirFrom = projectDir.toString() + '/src/main/resources/org/testng/internal'
84def dirTo = generatedSourcesFolder + "/org/testng/internal"
85def fileFrom = 'VersionTemplateJava'
86def fileTo = 'Version.java'
87
88task removeVersion {
89    delete dirTo + fileTo
90}
91
92sourceSets {
93    generated {
94        java {
95            srcDir 'src/generated/java'
96        }
97        resources {
98            srcDir 'src/generated/resources'
99        }
100    }
101}
102
103sourceSets {
104    main {
105        compileClasspath += generated.output
106        runtimeClasspath += generated.output
107    }
108}
109
110gradle.projectsEvaluated {
111    compileJava.dependsOn(myDir)
112}
113
114task myDir {
115    delete dirTo + "/" + fileTo
116    mkdir(dirTo)
117}
118
119// Include the generated Version.class in the jar
120jar {
121    manifest {
122        instruction 'Bundle-License', 'http://apache.org/licenses/LICENSE-2.0'
123        instruction 'Bundle-Description', 'TestNG is a testing framework.'
124        instruction 'Import-Package',
125            'bsh.*;version="[2.0.0,3.0.0)";resolution:=optional',
126            'com.beust.jcommander.*;version="[1.7.0,3.0.0)";resolution:=optional',
127            'com.google.inject.*;version="[1.2,1.3)";resolution:=optional',
128            'junit.framework;version="[3.8.1, 5.0.0)";resolution:=optional',
129            'org.junit.*;resolution:=optional',
130            'org.apache.tools.ant.*;version="[1.7.0, 2.0.0)";resolution:=optional',
131            'org.yaml.*;version="[1.6,2.0)";resolution:=optional',
132            '!com.beust.testng',
133            '!org.testng.*',
134            '!com.sun.*',
135            '*'
136    }
137    from "$buildDir/classes/generated"
138}
139
140task createVersion(type: Copy, dependsOn: myDir) {
141    println("Creating Version file: ${version} in ${dirTo}")
142    from dirFrom
143    include fileFrom
144    into(dirTo)
145    rename(fileFrom, fileTo)
146    filter(ReplaceTokens, tokens: [version: version])
147}
148
149compileJava.dependsOn(createVersion)
150
151test {
152    useTestNG() {
153        suites 'src/test/resources/testng.xml'
154    }
155//    testLogging.showStandardStreams = true
156    systemProperties = System.getProperties()
157    systemProperties['test.resources.dir'] = 'build/resources/test/'
158}
159
160if (JavaVersion.current().isJava8Compatible()) {
161    allprojects {
162        tasks.withType(Javadoc) {
163            options.addStringOption('Xdoclint:none', '-quiet')
164        }
165    }
166}
167
168sonarqube {
169    properties {
170        property "sonar.host.url", "http://nemo.sonarqube.org"
171        property "sonar.analysis.mode", "preview"
172        property "sonar.github.repository", "cbeust/testng"
173        property "sonar.github.login", "testng-bot"
174    }
175}
176
177apply from: 'gradle/publishing.gradle'
178