Skip to content

Commit cb2597f

Browse files
author
Igor Polevoy
committed
Merge pull request #441 from jasoma/gradle-daemon-fix
Fix the ubuntu build for the gradle plugin
2 parents 7eb4825 + 39be448 commit cb2597f

File tree

2 files changed

+83
-4
lines changed

2 files changed

+83
-4
lines changed

activejdbc-gradle-plugin/build.gradle

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import org.apache.tools.ant.taskdefs.condition.Os
2+
13
group 'org.javalite'
24
version '1.4.12-SNAPSHOT'
35

46
apply plugin: 'groovy'
7+
apply plugin: 'maven'
58

69
sourceCompatibility = 1.7
710

811
repositories {
912
mavenCentral()
13+
maven { url 'http://repo.javalite.io' }
1014
}
1115

1216
configurations {
@@ -16,8 +20,8 @@ configurations {
1620
dependencies {
1721
compile gradleApi()
1822
compile localGroovy()
19-
compile group: 'org.javalite', name: 'activejdbc', version: '1.4.11'
20-
compile group: 'org.javalite', name: 'activejdbc-instrumentation', version: '1.4.11'
23+
compile group: 'org.javalite', name: 'activejdbc', version: "${project.version}"
24+
compile group: 'org.javalite', name: 'activejdbc-instrumentation', version: "${project.version}"
2125

2226
deployerJars group: 'org.apache.maven.wagon', name: 'wagon-http', version: '2.2'
2327
}
@@ -46,8 +50,6 @@ task moveJars(type: Copy, dependsOn: ['docJar', 'sourceJar']) {
4650
exclude jar.archivePath.name
4751
}
4852

49-
build.dependsOn << [moveJars, moveClasses]
50-
5153
clean {
5254
delete 'target'
5355
}
@@ -57,3 +59,35 @@ artifacts {
5759
archives docJar
5860
archives sourceJar
5961
}
62+
63+
build.dependsOn << ['testPluginSubproject', 'moveJars', 'moveClasses']
64+
65+
task testDaemonBuild1(type: TestProjectBuild) { useDaemon = true }
66+
task testDaemonBuild2(type: TestProjectBuild) { useDaemon = true }
67+
task testNormalBuild1(type: TestProjectBuild) {}
68+
task testNormalBuild2(type: TestProjectBuild) {}
69+
70+
task testPluginSubproject(dependsOn: ['test', 'install', 'testDaemonBuild1', 'testDaemonBuild2', 'testNormalBuild1', 'testNormalBuild2'])
71+
72+
class TestProjectBuild extends Exec {
73+
74+
boolean useDaemon = false
75+
76+
@Override
77+
protected void exec() {
78+
workingDir('test-project')
79+
def buildArgs = []
80+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
81+
executable('cmd')
82+
buildArgs += ['/c', '..\\gradlew.bat']
83+
} else {
84+
executable('../gradlew')
85+
}
86+
87+
def daemonArg = (useDaemon) ? '--daemon' : '--no-daemon'
88+
buildArgs += [daemonArg, '--stacktrace', "-Pactivejdbc.version=${project.version}", 'test']
89+
args(buildArgs)
90+
91+
super.exec()
92+
}
93+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
mavenLocal()
5+
maven { url 'http://repo.javalite.io' }
6+
}
7+
dependencies {
8+
classpath "org.javalite:activejdbc-gradle-plugin:${property('activejdbc.version')}"
9+
classpath 'org.flywaydb:flyway-gradle-plugin:3.2.1'
10+
classpath "com.h2database:h2:1.4.187"
11+
}
12+
}
13+
14+
apply plugin: 'java'
15+
apply plugin: 'org.javalite.activejdbc'
16+
apply plugin: 'org.flywaydb.flyway'
17+
18+
repositories {
19+
mavenCentral()
20+
maven { url 'http://repo.javalite.io/' }
21+
}
22+
23+
dependencies {
24+
compile "org.javalite:activejdbc:${property('activejdbc.version')}"
25+
compile "com.h2database:h2:1.4.187"
26+
testCompile 'junit:junit:4.12'
27+
}
28+
29+
sourceCompatibility = 1.7
30+
31+
task cleanDb(type: Delete) {
32+
delete 'build/testdb'
33+
}
34+
35+
flyway {
36+
url = 'jdbc:h2:file:./build/testdb/db'
37+
}
38+
39+
test {
40+
dependsOn << 'cleanDb'
41+
dependsOn << 'flywayMigrate'
42+
testLogging.events 'passed', 'skipped', 'failed'
43+
testLogging.exceptionFormat = 'full'
44+
testLogging.showStandardStreams = true
45+
}

0 commit comments

Comments
 (0)