@@ -11,14 +11,14 @@ buildscript {
1111apply plugin : ' js'
1212
1313defaultTasks ' all'
14- buildDir = " ../ target"
14+ buildDir = ' target'
1515
16- def srcFile = " ../ stacktrace.js"
16+ def srcFile = ' stacktrace.js'
1717def destFile = " ${ buildDir} /stacktrace-min.js"
1818def testDir = ' test'
1919
2020repositories {
21- mavenRepo urls : ' http://repository.springsource.com/maven/bundles/release'
21+ mavenRepo url : ' http://repository.springsource.com/maven/bundles/release'
2222 mavenCentral()
2323}
2424
@@ -47,24 +47,24 @@ task jshintz(dependsOn: 'init', description: 'runs jshint on all non-test and li
4747}
4848
4949task jsduck (type : Exec , dependsOn : ' init' , description : ' Generates jsduck documentation' ) {
50- inputs. file file(srcFile)
51- outputs. file file(" ${ buildDir} /docs" )
50+ inputs. file file(srcFile)
51+ outputs. file file(" ${ buildDir} /docs" )
5252
53- commandLine = [' jsduck' , srcFile, ' --output' , " ${ buildDir} /docs" ]
54- ignoreExitValue = true
53+ commandLine = [' jsduck' , srcFile, ' --output' , " ${ buildDir} /docs" ]
54+ ignoreExitValue = true
5555}
5656
5757minifyJs {
5858 dependsOn << ' init'
59- input = file(srcFile)
60- output = file(destFile)
61- warningLevel = ' QUIET'
59+ ext . input = file(srcFile)
60+ ext . output = file(destFile)
61+ warningLevel = ' QUIET'
6262}
6363
6464gzipJs {
6565 dependsOn << ' minifyJs'
66- input = file(destFile)
67- output = input
66+ ext . input = file(destFile)
67+ ext . output = input
6868}
6969
7070task test (dependsOn : ' init' ) << {
@@ -76,7 +76,8 @@ task test(dependsOn: 'init') << {
7676 specs << it
7777 }
7878 }
79-
79+
80+ def phantomJsPath = " which phantomjs" . execute(). text. trim()
8081 def startTime = new Date (). time
8182 def numFailures = 0
8283 def testsFailed = false
@@ -85,11 +86,9 @@ task test(dependsOn: 'init') << {
8586
8687 def outputFile = " ${ buildDir} /TEST-${ spec.name.replace('-', '').replace('.html', '.xml')} "
8788 ant. exec(outputproperty : ' cmdOut' , errorproperty : ' cmdErr' ,
88- resultproperty : ' exitCode' , failonerror : ' false' , executable : ' /usr/bin/env' ) {
89- arg(value : ' DISPLAY=:1' )
90- arg(value : ' /usr/local/bin/phantomjs' )
91- arg(value : " ../test/lib/phantomjs-qunit-runner.js" )
92- arg(value : " ${ spec.canonicalPath} " )
89+ resultproperty : ' exitCode' , failonerror : ' false' , executable : phantomJsPath) {
90+ arg(value : ' test/lib/phantomjs-qunit-runner.js' )
91+ arg(value : spec. canonicalPath)
9392 }
9493 // Check exit code
9594 if (ant. project. properties. exitCode != ' 0' ) {
@@ -109,17 +108,17 @@ task test(dependsOn: 'init') << {
109108}
110109
111110task jstd (type : Exec , dependsOn : ' init' , description : ' runs JS tests through JsTestDriver' ) {
112- // Default to MacOS and check for other environments
113- def firefoxPath = ' /Applications/Firefox.app/Contents/MacOS/firefox'
114- if (" uname" . execute(). text. trim() != ' Darwin' ) {
115- firefoxPath = " which firefox" . execute(). text
116- }
111+ // Default to MacOS and check for other environments
112+ def firefoxPath = ' /Applications/Firefox.app/Contents/MacOS/firefox'
113+ if (" uname" . execute(). text. trim() != ' Darwin' ) {
114+ firefoxPath = " which firefox" . execute(). text. trim()
115+ }
117116
118- commandLine = [' /usr/bin/env' , ' DISPLAY=:1' , ' java' , ' -jar' , " ../ test/lib/JsTestDriver-1.3.3d.jar" , ' --config' , " ../ test/jsTestDriver.conf" , ' --port' , ' 4224' , ' --browser' , firefoxPath, ' --tests' , ' all' , ' --testOutput' , buildDir]
117+ commandLine = [' /usr/bin/env' , ' DISPLAY=:1' , ' java' , ' -jar' , " test/lib/JsTestDriver-1.3.3d.jar" , ' --config' , " test/jsTestDriver.conf" , ' --port' , ' 4224' , ' --browser' , firefoxPath, ' --tests' , ' all' , ' --testOutput' , buildDir]
119118}
120119
121120task jsCoverage (type : Exec , dependsOn : ' jstd' , description : ' JS code coverage with cobertura' ) {
122- commandLine = [' python' , " ${ projectDir} /test/lib/lcov-to-cobertura-xml.py" , ' -b ' , " ../ " , ' - e' , ' test.lib' , ' -o' , " ${ buildDir} /coverage.xml" , " ${ buildDir} /jsTestDriver.conf-coverage.dat" ]
121+ commandLine = [' python' , " ${ projectDir} /test/lib/lcov-to-cobertura-xml.py" , ' -e' , ' test.lib' , ' -o' , " ${ buildDir} /coverage.xml" , " ${ buildDir} /jsTestDriver.conf-coverage.dat" ]
123122}
124123
125124task all (dependsOn : [' clean' , ' jshintz' , ' test' , ' jsduck' , ' minifyJs' , ' gzipJs' ]) << {}
0 commit comments