buildr-examples 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/LICENSE +176 -0
  2. data/README.rdoc +35 -0
  3. data/examples/artifacts/install_upload/app.zip +0 -0
  4. data/examples/artifacts/install_upload/buildfile +29 -0
  5. data/examples/artifacts/install_upload/src/main/java/HelloWorld.java +5 -0
  6. data/examples/artifacts/shared/artifacts.rb +5 -0
  7. data/examples/artifacts/simple/buildfile +75 -0
  8. data/examples/artifacts/simple/src/main/java/HelloWorld.java +5 -0
  9. data/examples/building/apt/buildfile +8 -0
  10. data/examples/building/apt/run.sh +3 -0
  11. data/examples/building/apt/src/main/java/Example.java +9 -0
  12. data/examples/building/chaining/buildfile +13 -0
  13. data/examples/building/chaining/run.sh +2 -0
  14. data/examples/building/chaining/src/main/java/Example.java +5 -0
  15. data/examples/building/chaining/srcs/HelloWorld.java +5 -0
  16. data/examples/building/compiler/buildfile +42 -0
  17. data/examples/building/compiler/groovyproject/src/main/groovy/HelloWorld.groovy +9 -0
  18. data/examples/building/compiler/javaproject/src/main/java/HelloWorld.java +5 -0
  19. data/examples/building/compiler/run.sh +10 -0
  20. data/examples/building/compiler/scalaproject/src/main/scala/HelloWorld.scala +5 -0
  21. data/examples/building/extending_tasks/buildfile +24 -0
  22. data/examples/building/extending_tasks/run.sh +4 -0
  23. data/examples/building/extending_tasks/src/main/java/HelloWorld.java +5 -0
  24. data/examples/building/jjtree/buildfile +10 -0
  25. data/examples/building/jjtree/run.sh +3 -0
  26. data/examples/building/jjtree/src/main/jjtree/com/acme/Example.java +7 -0
  27. data/examples/building/resources/buildfile +23 -0
  28. data/examples/building/resources/profiles.yaml +12 -0
  29. data/examples/building/resources/run.sh +6 -0
  30. data/examples/building/resources/src/main/property-style/ant.txt +1 -0
  31. data/examples/building/resources/src/main/property-style/erb.txt +1 -0
  32. data/examples/building/resources/src/main/property-style/maven.txt +1 -0
  33. data/examples/building/resources/src/main/property-style/regex.txt +1 -0
  34. data/examples/building/resources/src/main/property-style/ruby.txt +1 -0
  35. data/examples/building/resources/src/main/resources/filter.txt +1 -0
  36. data/examples/installing/buildfile +7 -0
  37. data/examples/installing/run.sh +16 -0
  38. data/examples/ivy4r/simple/ant-scripts/ivysettings.xml +9 -0
  39. data/examples/ivy4r/simple/buildfile +10 -0
  40. data/examples/ivy4r/simple/ivy.xml +6 -0
  41. data/examples/ivy4r/simple/run.sh +2 -0
  42. data/examples/ivy4r/simple/src/main/java/HelloWorld.java +8 -0
  43. data/examples/packaging/include_exclude/README +1 -0
  44. data/examples/packaging/include_exclude/buildfile +62 -0
  45. data/examples/packaging/include_exclude/run.sh +4 -0
  46. data/examples/packaging/include_exclude/src/main/java/HelloWorld.java +5 -0
  47. data/examples/packaging/include_exclude/src/main/resources/include/some_resource.txt +0 -0
  48. data/examples/packaging/include_exclude/src/main/resources/some.include +0 -0
  49. data/examples/packaging/include_exclude/src/main/resources/some_exclude.clu +0 -0
  50. data/examples/packaging/include_exclude/src/main/resources/some_exclude.ex +0 -0
  51. data/examples/packaging/include_exclude/src/main/webapp/WEB-INF/web.xml +0 -0
  52. data/examples/packaging/meta/ADDITIONAL +1 -0
  53. data/examples/packaging/meta/DISCLAIMER +1 -0
  54. data/examples/packaging/meta/NOTICE +1 -0
  55. data/examples/packaging/meta/buildfile +25 -0
  56. data/examples/packaging/meta/run.sh +2 -0
  57. data/examples/packaging/meta/src/main/MANIFEST.MF +7 -0
  58. data/examples/packaging/meta/src/main/java/HelloWorld.java +5 -0
  59. data/examples/packaging/meta/src/main/resources/some_resource.txt +0 -0
  60. data/examples/packaging/meta/src/main/webapp/WEB-INF/web.xml +0 -0
  61. data/examples/packaging/multiple/buildfile +39 -0
  62. data/examples/packaging/multiple/run.sh +6 -0
  63. data/examples/packaging/multiple/src/main/java/HelloWorld.java +5 -0
  64. data/examples/packaging/multiple/src/main/resources/some_resource.txt +0 -0
  65. data/examples/packaging/multiple/src/main/webapp/WEB-INF/web.xml +0 -0
  66. data/examples/projects/foo-bar/buildfile +24 -0
  67. data/examples/projects/foo-bar/run.sh +2 -0
  68. data/examples/projects/killer-app/buildfile +82 -0
  69. data/examples/projects/killer-app/run.sh +27 -0
  70. data/examples/projects/killer-app/teh-api/src/main/java/Example.java +5 -0
  71. data/examples/projects/killer-app/teh-api/src/test/java/ExampleTest.java +8 -0
  72. data/examples/projects/killer-app/teh-impl/src/main/java/Example.java +5 -0
  73. data/examples/projects/killer-app/teh-impl/src/main/resources/META-INF/persistence.xml +18 -0
  74. data/examples/projects/killer-app/teh-impl/src/test/java/ExampleTest.java +8 -0
  75. data/examples/projects/silly/buildfile +15 -0
  76. data/examples/projects/silly/run.sh +2 -0
  77. data/examples/projects/task/buildfile +12 -0
  78. data/examples/projects/task/run.sh +5 -0
  79. data/examples/testing/failing/buildfile +11 -0
  80. data/examples/testing/failing/run.sh +7 -0
  81. data/examples/testing/failing/src/main/java/Example.java +5 -0
  82. data/examples/testing/failing/src/test/java/FailingExampleTest.java +8 -0
  83. data/examples/testing/frameworks/buildfile +12 -0
  84. data/examples/testing/frameworks/junit/src/main/java/Example.java +5 -0
  85. data/examples/testing/frameworks/junit/src/test/java/ExampleTest.java +8 -0
  86. data/examples/testing/frameworks/run.sh +5 -0
  87. data/examples/testing/frameworks/testng/src/main/java/Example.java +5 -0
  88. data/examples/testing/frameworks/testng/src/test/java/ExampleTest.java +9 -0
  89. data/examples/testing/include_exclude/buildfile +9 -0
  90. data/examples/testing/include_exclude/run.sh +2 -0
  91. data/examples/testing/include_exclude/src/main/java/Example.java +5 -0
  92. data/examples/testing/include_exclude/src/test/java/ExampleTest.java +8 -0
  93. data/examples/testing/include_exclude/src/test/java/FailingExampleTest.java +8 -0
  94. data/examples/testing/include_exclude/src/test/java/de/phoet/IncludeTest.java +10 -0
  95. data/examples/testing/integration/buildfile +12 -0
  96. data/examples/testing/integration/client/src/main/java/Example.java +5 -0
  97. data/examples/testing/integration/client/src/test/java/ClientExampleTest.java +8 -0
  98. data/examples/testing/integration/run.sh +2 -0
  99. data/examples/testing/integration/server/src/main/java/Example.java +5 -0
  100. data/examples/testing/integration/server/src/test/java/ServerExampleTest.java +8 -0
  101. data/examples/testing/running/buildfile +13 -0
  102. data/examples/testing/running/client/src/main/java/Example.java +5 -0
  103. data/examples/testing/running/client/src/test/java/ClientExampleTest.java +8 -0
  104. data/examples/testing/running/run.sh +26 -0
  105. data/examples/testing/running/server/src/main/java/Example.java +5 -0
  106. data/examples/testing/running/server/src/test/java/ServerExampleTest.java +8 -0
  107. data/features/artifacts.feature +42 -0
  108. data/features/step_definitions/artifacts_steps.rb +19 -0
  109. data/features/support/env.rb +11 -0
  110. metadata +213 -0
@@ -0,0 +1,5 @@
1
+ public class HelloWorld {
2
+ public static void main(String[] args){
3
+ System.out.println("Hello World!");
4
+ }
5
+ }
@@ -0,0 +1,24 @@
1
+ # 1. define some dependencies ...
2
+ AXIOM = group('axiom-api', 'axiom-impl', 'axiom-dom', :under=>'org.apache.ws.commons.axiom', :version=>'1.2.4')
3
+
4
+ repositories.remote << "http://www.ibiblio.org/maven2/"
5
+
6
+ define 'foo-bar' do
7
+
8
+ # define the project-version
9
+ project.version = '1.0.0'
10
+
11
+ define 'bar' do
12
+ # 3. ... and reuse them via other project
13
+ # buildr will figure out the right order of projects
14
+ compile.with project('foo').compile.dependencies
15
+ end
16
+
17
+ define 'foo' do
18
+ # 2. ... and use them for compile classpath
19
+ compile.with AXIOM
20
+
21
+ # 4. this would trigger a circular dependency (Circular dependency detected)
22
+ # compile.with project('bar')
23
+ end
24
+ end
@@ -0,0 +1,2 @@
1
+ echo "compile foo-bar with subprojects"
2
+ buildr clean compile
@@ -0,0 +1,82 @@
1
+ require "buildr/openjpa"
2
+
3
+ VERSION_NUMBER = '1.0'
4
+
5
+ # define a single dependencies
6
+ AXIS2 = 'org.apache.axis2:axis2:jar:1.2'
7
+ # define a group of dependencies
8
+ AXIOM = group('axiom-api', 'axiom-impl', 'axiom-dom', :under=>'org.apache.ws.commons.axiom', :version=>'1.2.4')
9
+ # and mix them together
10
+ AXIS_OF_WS = [AXIOM, AXIS2]
11
+ OPENJPA = ['org.apache.openjpa:openjpa:jar:1.2.1', 'net.sourceforge.serp:serp:jar:1.12.0']
12
+ HIBERNATE = 'hibernate:hibernate-entitymanager:jar:3.1beta1'
13
+
14
+ # use ibiblio as the artifact repository
15
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
16
+
17
+ desc 'Code. Build. ??? Profit!'
18
+ define 'killer-app' do
19
+
20
+ # set up project specific information
21
+ project.version = VERSION_NUMBER
22
+ project.group = 'acme'
23
+ manifest['Copyright'] = 'Acme Inc (C) 2007'
24
+ compile.options.target = '1.5'
25
+
26
+ desc 'Abstract classes and interfaces'
27
+ define 'teh-api' do
28
+ # create a jar artifact
29
+ package :jar
30
+ end
31
+
32
+ desc 'All those implementation details'
33
+ define 'teh-impl' do
34
+ # add axis and open-jpa to compile classpath
35
+ compile.with AXIS_OF_WS, OPENJPA, HIBERNATE
36
+ # run bytecode enhancer after compilation
37
+ compile { open_jpa_enhance }
38
+ # create a jar
39
+ package :jar
40
+ end
41
+
42
+ desc 'What our users see'
43
+ define 'la-web' do
44
+ # add dependencies to compilation
45
+ compile.with 'org.apache.axis2:axis2:jar:1.2',
46
+ 'org.apache.derby:derby:jar:10.1.2.1',
47
+ #this can also be the created artifacts of projects
48
+ projects('teh-api', 'teh-impl')
49
+
50
+ # add the axis-dependencies to the test classpath
51
+ test.with AXIS_OF_WS
52
+ # create a war with the dependencies of side-projects
53
+ package(:war).with :libs=>projects('teh-api', 'teh-impl')
54
+ end
55
+
56
+ # create javadoc for all projects ...
57
+ javadoc projects
58
+ # ... and create a javadoc.zip
59
+ package :javadoc
60
+
61
+ # look into resolving paths
62
+ # Relative to the current project
63
+ puts path_to('src', 'main', 'java')
64
+
65
+ # the same using symbols
66
+ puts path_to(:src, :main, :java)
67
+
68
+ # Exactly the same thing
69
+ puts _('src/main/java')
70
+
71
+ # Relative to the teh-impl project
72
+ puts project('teh-impl')._('src/main/java')
73
+
74
+ # shortcut for resolving the path of src
75
+ puts file('src')
76
+ end
77
+
78
+ # have a look into the project-structure
79
+ puts projects.inspect
80
+ puts project('killer-app').projects.inspect
81
+ puts project('killer-app:teh-api').inspect
82
+ puts project('killer-app').project('teh-api').inspect
@@ -0,0 +1,27 @@
1
+ echo "build killer-app and all its sub-projects"
2
+ buildr clean build
3
+
4
+ echo "switch to and test only teh-impl"
5
+ cd teh-impl
6
+ buildr test
7
+
8
+ echo "switch to and package only la-web"
9
+ cd ../la-web
10
+ buildr package
11
+
12
+ cd ..
13
+
14
+ echo "build killer-app and all its sub-projects"
15
+ buildr killer-app:build
16
+
17
+ echo "test only teh-impl"
18
+ buildr killer-app:teh-impl:test
19
+
20
+ echo "package only la-web"
21
+ buildr killer-app:la-web:package
22
+
23
+ echo "list all projects"
24
+ buildr help:projects
25
+
26
+ echo "list all tasks"
27
+ buildr help:tasks
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class ExampleTest {
4
+ @Test
5
+ public void someTest() {
6
+ new Example().callMe();
7
+ }
8
+ }
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
5
+ version="1.0">
6
+
7
+ <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
8
+ <properties>
9
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa"/>
10
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
11
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
12
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
13
+ <property name="hibernate.connection.username" value="sa"/>
14
+ <property name="hibernate.connection.password" value=""/>
15
+ </properties>
16
+ </persistence-unit>
17
+
18
+ </persistence>
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class ExampleTest {
4
+ @Test
5
+ public void someTest() {
6
+ new Example().callMe();
7
+ }
8
+ }
@@ -0,0 +1,15 @@
1
+ define 'silly', :version=>'1.0' do
2
+ project.group = 'acme'
3
+
4
+ puts 'Running buildr'
5
+
6
+ # extending the build-task
7
+ build do
8
+ puts 'Building silly'
9
+ end
10
+
11
+ end
12
+
13
+ # print out project-settings
14
+ puts project('silly').version
15
+ puts project('silly').group
@@ -0,0 +1,2 @@
1
+ echo "just build the silly project"
2
+ buildr
@@ -0,0 +1,12 @@
1
+ define 'task' do
2
+ # define a custom task
3
+ task('do-this') do |task|
4
+ puts "you can define your own tasks like #{task}"
5
+ end
6
+ end
7
+
8
+ # define the custom task as a local task
9
+ # you can now call the do-this task via 'buildr do-this'
10
+ Project.local_task('do-this') do |name|
11
+ puts "executing the localtask on #{name}"
12
+ end
@@ -0,0 +1,5 @@
1
+ echo "run custom task defined in project"
2
+ buildr task:do-this
3
+
4
+ echo "run custom task defined as local-task"
5
+ buildr do-this
@@ -0,0 +1,11 @@
1
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
2
+
3
+ define 'failing', :version=>"1.0" do
4
+ package(:jar)
5
+ test.using :junit
6
+ test.using :fail_on_failure=>false
7
+ test do |test|
8
+ # extension of test task will only get called after a successful test-run
9
+ raise "#{test.failed_tests.size} tests failed"
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ echo "package and execute tests that should fail..."
2
+ echo "...failing tests EXPECTED:"
3
+ buildr clean package
4
+ echo "...end of failing tests"
5
+
6
+ echo "package and don't execute tests"
7
+ buildr clean package test=no
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class FailingExampleTest {
4
+ @Test
5
+ public void someFailingTest() {
6
+ throw new IllegalStateException("this should fail");
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
2
+
3
+ define 'framework', :version=>"1.0" do
4
+ define 'junit' do
5
+ package(:jar)
6
+ test.using :junit
7
+ end
8
+ define 'testng' do
9
+ package(:jar)
10
+ test.using :testng
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class ExampleTest {
4
+ @Test
5
+ public void someTest() {
6
+ new Example().callMe();
7
+ }
8
+ }
@@ -0,0 +1,5 @@
1
+ echo "build and test different frameworks"
2
+ buildr clean test
3
+
4
+ echo "package should executes tests as well"
5
+ buildr clean package
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,9 @@
1
+ import org.testng.annotations.Test;
2
+
3
+
4
+ public class ExampleTest {
5
+ @Test
6
+ public void someTest() {
7
+ new Example().callMe();
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
2
+
3
+ define 'include_exclude', :version=>"1.0" do
4
+ package(:jar)
5
+ test.using :junit
6
+ test.include 'de.phoet.*'
7
+ test.include '*'
8
+ test.exclude 'FailingExampleTest'
9
+ end
@@ -0,0 +1,2 @@
1
+ echo "build and test different frameworks"
2
+ buildr clean test
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class ExampleTest {
4
+ @Test
5
+ public void someTest() {
6
+ new Example().callMe();
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class FailingExampleTest {
4
+ @Test
5
+ public void someFailingTest() {
6
+ throw new IllegalStateException("this should fail");
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ package de.phoet;
2
+
3
+ import org.junit.Test;
4
+
5
+ public class IncludeTest {
6
+ @Test
7
+ public void someTest() {
8
+ System.out.println("some test");
9
+ }
10
+ }
@@ -0,0 +1,12 @@
1
+ repositories.remote << 'http://www.ibiblio.org/maven2/'
2
+
3
+ define 'integration_testing', :version=>"1.0" do
4
+ # TODO integration testing example
5
+ define 'client' do
6
+ package(:jar)
7
+ end
8
+ define 'server' do
9
+ test.with project('client')
10
+ package(:jar)
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ import org.junit.Test;
2
+
3
+ public class ClientExampleTest {
4
+ @Test
5
+ public void someTest() {
6
+ new Example().callMe();
7
+ }
8
+ }
@@ -0,0 +1,2 @@
1
+ echo "build and test"
2
+ buildr clean test
@@ -0,0 +1,5 @@
1
+ public class Example {
2
+ public void callMe(){
3
+ System.out.println("I got called!");
4
+ }
5
+ }