realityforge-buildr 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.md +3 -0
  6. data/Rakefile +50 -0
  7. data/addon/buildr/checkstyle-report.xsl +104 -0
  8. data/addon/buildr/checkstyle.rb +254 -0
  9. data/addon/buildr/git_auto_version.rb +36 -0
  10. data/addon/buildr/gpg.rb +90 -0
  11. data/addon/buildr/gwt.rb +413 -0
  12. data/addon/buildr/jacoco.rb +161 -0
  13. data/addon/buildr/pmd.rb +185 -0
  14. data/addon/buildr/single_intermediate_layout.rb +71 -0
  15. data/addon/buildr/spotbugs.rb +265 -0
  16. data/addon/buildr/top_level_generate_dir.rb +37 -0
  17. data/addon/buildr/wsgen.rb +192 -0
  18. data/bin/buildr +20 -0
  19. data/buildr.gemspec +61 -0
  20. data/lib/buildr.rb +86 -0
  21. data/lib/buildr/core/application.rb +705 -0
  22. data/lib/buildr/core/assets.rb +96 -0
  23. data/lib/buildr/core/build.rb +587 -0
  24. data/lib/buildr/core/common.rb +167 -0
  25. data/lib/buildr/core/compile.rb +599 -0
  26. data/lib/buildr/core/console.rb +124 -0
  27. data/lib/buildr/core/doc.rb +275 -0
  28. data/lib/buildr/core/environment.rb +128 -0
  29. data/lib/buildr/core/filter.rb +405 -0
  30. data/lib/buildr/core/help.rb +114 -0
  31. data/lib/buildr/core/progressbar.rb +161 -0
  32. data/lib/buildr/core/project.rb +994 -0
  33. data/lib/buildr/core/test.rb +776 -0
  34. data/lib/buildr/core/transports.rb +456 -0
  35. data/lib/buildr/core/util.rb +77 -0
  36. data/lib/buildr/ide/idea.rb +1664 -0
  37. data/lib/buildr/java/commands.rb +230 -0
  38. data/lib/buildr/java/compiler.rb +85 -0
  39. data/lib/buildr/java/custom_pom.rb +300 -0
  40. data/lib/buildr/java/doc.rb +62 -0
  41. data/lib/buildr/java/packaging.rb +393 -0
  42. data/lib/buildr/java/pom.rb +191 -0
  43. data/lib/buildr/java/test_result.rb +54 -0
  44. data/lib/buildr/java/tests.rb +111 -0
  45. data/lib/buildr/packaging/archive.rb +586 -0
  46. data/lib/buildr/packaging/artifact.rb +1113 -0
  47. data/lib/buildr/packaging/artifact_namespace.rb +1010 -0
  48. data/lib/buildr/packaging/artifact_search.rb +138 -0
  49. data/lib/buildr/packaging/package.rb +237 -0
  50. data/lib/buildr/packaging/version_requirement.rb +189 -0
  51. data/lib/buildr/packaging/zip.rb +189 -0
  52. data/lib/buildr/packaging/ziptask.rb +387 -0
  53. data/lib/buildr/version.rb +18 -0
  54. data/rakelib/release.rake +99 -0
  55. data/spec/addon/checkstyle_spec.rb +58 -0
  56. data/spec/core/application_spec.rb +576 -0
  57. data/spec/core/build_spec.rb +922 -0
  58. data/spec/core/common_spec.rb +670 -0
  59. data/spec/core/compile_spec.rb +656 -0
  60. data/spec/core/console_spec.rb +65 -0
  61. data/spec/core/doc_spec.rb +194 -0
  62. data/spec/core/extension_spec.rb +200 -0
  63. data/spec/core/project_spec.rb +736 -0
  64. data/spec/core/test_spec.rb +1131 -0
  65. data/spec/core/transport_spec.rb +452 -0
  66. data/spec/core/util_spec.rb +154 -0
  67. data/spec/ide/idea_spec.rb +1952 -0
  68. data/spec/java/commands_spec.rb +79 -0
  69. data/spec/java/compiler_spec.rb +274 -0
  70. data/spec/java/custom_pom_spec.rb +165 -0
  71. data/spec/java/doc_spec.rb +55 -0
  72. data/spec/java/packaging_spec.rb +786 -0
  73. data/spec/java/pom_spec.rb +162 -0
  74. data/spec/java/test_coverage_helper.rb +257 -0
  75. data/spec/java/tests_spec.rb +224 -0
  76. data/spec/packaging/archive_spec.rb +686 -0
  77. data/spec/packaging/artifact_namespace_spec.rb +757 -0
  78. data/spec/packaging/artifact_spec.rb +1351 -0
  79. data/spec/packaging/packaging_helper.rb +63 -0
  80. data/spec/packaging/packaging_spec.rb +690 -0
  81. data/spec/sandbox.rb +166 -0
  82. data/spec/spec_helpers.rb +420 -0
  83. data/spec/version_requirement_spec.rb +145 -0
  84. data/spec/xpath_matchers.rb +123 -0
  85. metadata +295 -0
@@ -0,0 +1,36 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+ module GitAutoVersion
18
+ module ProjectExtension
19
+ include Extension
20
+
21
+ before_define do |project|
22
+ unless project.version
23
+ version_suffix = ENV['BUILD_NUMBER'] ? "-#{ENV['BUILD_NUMBER']}" : ''
24
+ version_prefix = ENV['VERSION_PREFIX'] ? "#{ENV['VERSION_PREFIX']}-" : ''
25
+ git_version = `git describe --tags --always`.strip
26
+ git_version = git_version.gsub(/^v([0-9])/, '\1')
27
+ project.version = version_prefix + git_version + version_suffix
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ class Buildr::Project
35
+ include Buildr::GitAutoVersion::ProjectExtension
36
+ end
@@ -0,0 +1,90 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+
18
+ # Signs the packages using gpg and uploads signatures as part of the upload process.
19
+ #
20
+ # Require explicitly using <code>require "buildr/apg"</code>. This will result in all
21
+ # packages being signed. The user must specify the GPG_USER environment key to identify
22
+ # the key to use and may specify GPG_PASS if the key needs a password to access. e.g.
23
+ #
24
+ # $ GPG_USER=user@example.com GPG_PASSWD=secret buildr clean upload
25
+ #
26
+ module GPG
27
+ class << self
28
+
29
+ def sign_task(pkg)
30
+ raise "ENV['GPG_USER'] not specified" unless ENV['GPG_USER']
31
+ asc_filename = pkg.to_s + '.asc'
32
+ return if file(asc_filename).prerequisites.include?(pkg.to_s)
33
+ file(asc_filename => [pkg.to_s]) do
34
+ info "GPG signing #{pkg.to_spec}"
35
+
36
+ cmd = []
37
+ cmd << 'gpg'
38
+ cmd << '--local-user'
39
+ cmd << ENV['GPG_USER']
40
+ cmd << '--armor'
41
+ cmd << '--output'
42
+ cmd << pkg.to_s + '.asc'
43
+ if ENV['GPG_PASS']
44
+ cmd << '--passphrase'
45
+ cmd << ENV['GPG_PASS']
46
+ end
47
+ cmd << '--detach-sig'
48
+ cmd << '--batch'
49
+ cmd << '--yes'
50
+ cmd << pkg
51
+ trace(cmd.join(' '))
52
+ `#{cmd.join(' ')}`
53
+ raise "Unable to generate signature for #{pkg}" unless File.exist?(asc_filename)
54
+ end
55
+ end
56
+
57
+ def sign_and_upload(project, pkg)
58
+ project.task(:upload).enhance do
59
+ artifact = Buildr.artifact(pkg.to_spec_hash.merge(:type => "#{pkg.type}.asc"))
60
+ artifact.from(sign_task(pkg))
61
+ artifact.invoke
62
+ artifact.upload
63
+ end
64
+ end
65
+
66
+ def sign_and_upload_all_packages(project)
67
+ project.packages.each { |pkg| Buildr::GPG.sign_and_upload(project, pkg) }
68
+ project.packages.select {|pkg| pkg.respond_to?(:pom) }.map { |pkg| pkg.pom }.compact.uniq.each { |pom| Buildr::GPG.sign_and_upload(project, pom) }
69
+ end
70
+ end
71
+
72
+ module ProjectExtension
73
+ include Extension
74
+
75
+ attr_writer :gpg
76
+
77
+ def gpg?
78
+ @gpg.nil? ? true : !!@gpg
79
+ end
80
+
81
+ after_define do |project|
82
+ Buildr::GPG.sign_and_upload_all_packages(project) if project.gpg?
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ class Buildr::Project
89
+ include Buildr::GPG::ProjectExtension
90
+ end
@@ -0,0 +1,413 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+ module GWT
18
+ class << self
19
+
20
+ def version=(version)
21
+ @version = version
22
+ end
23
+
24
+ def version
25
+ @version || Buildr.settings.build['gwt'] || '2.8.2'
26
+ end
27
+
28
+ # The specs for requirements
29
+ def dependencies(version = nil)
30
+ validation_deps =
31
+ %w(javax.validation:validation-api:jar:1.0.0.GA javax.validation:validation-api:jar:sources:1.0.0.GA)
32
+ v = version || self.version
33
+ gwt_dev_jar = "com.google.gwt:gwt-dev:jar:#{v}"
34
+ if v <= '2.6.1'
35
+ [gwt_dev_jar] + validation_deps
36
+ elsif v == '2.7.0'
37
+ [
38
+ gwt_dev_jar,
39
+ 'org.ow2.asm:asm:jar:5.0.3'
40
+ ] + validation_deps
41
+ elsif v == '2.8.0'
42
+ %w(
43
+ com.google.jsinterop:jsinterop-annotations:jar:1.0.1
44
+ com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.1
45
+ org.w3c.css:sac:jar:1.3
46
+ com.google.gwt:gwt-dev:jar:2.8.0
47
+ com.google.gwt:gwt-user:jar:2.8.0
48
+ com.google.code.gson:gson:jar:2.6.2
49
+ org.ow2.asm:asm:jar:5.0.3
50
+ org.ow2.asm:asm-util:jar:5.0.3
51
+ org.ow2.asm:asm-tree:jar:5.0.3
52
+ org.ow2.asm:asm-commons:jar:5.0.3
53
+ colt:colt:jar:1.2.0
54
+ ant:ant:jar:1.6.5
55
+ commons-collections:commons-collections:jar:3.2.2
56
+ commons-io:commons-io:jar:2.4
57
+ com.ibm.icu:icu4j:jar:50.1.1
58
+ tapestry:tapestry:jar:4.0.2
59
+
60
+ javax.annotation:javax.annotation-api:jar:1.2
61
+ javax.servlet:javax.servlet-api:jar:3.1.0
62
+ org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106
63
+ org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106
64
+ org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106
65
+ org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106
66
+ org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106
67
+ org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106
68
+ org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106
69
+ org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106
70
+ org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106
71
+ org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106
72
+ org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106
73
+ org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106
74
+ org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106
75
+ org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0
76
+ ) + validation_deps
77
+ elsif v == '2.8.1'
78
+ %w(
79
+ com.google.jsinterop:jsinterop-annotations:jar:1.0.1
80
+ com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.1
81
+ org.w3c.css:sac:jar:1.3
82
+ com.google.gwt:gwt-dev:jar:2.8.1
83
+ com.google.gwt:gwt-user:jar:2.8.1
84
+ com.google.code.gson:gson:jar:2.6.2
85
+ org.ow2.asm:asm:jar:5.0.3
86
+ org.ow2.asm:asm-util:jar:5.0.3
87
+ org.ow2.asm:asm-tree:jar:5.0.3
88
+ org.ow2.asm:asm-commons:jar:5.0.3
89
+ colt:colt:jar:1.2.0
90
+ ant:ant:jar:1.6.5
91
+ commons-collections:commons-collections:jar:3.2.2
92
+ commons-io:commons-io:jar:2.4
93
+ com.ibm.icu:icu4j:jar:50.1.1
94
+ tapestry:tapestry:jar:4.0.2
95
+
96
+ javax.annotation:javax.annotation-api:jar:1.2
97
+ javax.servlet:javax.servlet-api:jar:3.1.0
98
+ org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106
99
+ org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106
100
+ org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106
101
+ org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106
102
+ org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106
103
+ org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106
104
+ org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106
105
+ org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106
106
+ org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106
107
+ org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106
108
+ org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106
109
+ org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106
110
+ org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106
111
+ org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0
112
+ ) + validation_deps
113
+ elsif v == '2.8.2'
114
+ %w(
115
+ com.google.jsinterop:jsinterop-annotations:jar:1.0.2
116
+ com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.2
117
+ org.w3c.css:sac:jar:1.3
118
+ com.google.gwt:gwt-dev:jar:2.8.2
119
+ com.google.gwt:gwt-user:jar:2.8.2
120
+ com.google.code.gson:gson:jar:2.6.2
121
+ org.ow2.asm:asm:jar:5.0.3
122
+ org.ow2.asm:asm-util:jar:5.0.3
123
+ org.ow2.asm:asm-tree:jar:5.0.3
124
+ org.ow2.asm:asm-commons:jar:5.0.3
125
+ colt:colt:jar:1.2.0
126
+ ant:ant:jar:1.6.5
127
+ commons-collections:commons-collections:jar:3.2.2
128
+ commons-io:commons-io:jar:2.4
129
+ com.ibm.icu:icu4j:jar:50.1.1
130
+ tapestry:tapestry:jar:4.0.2
131
+
132
+ javax.annotation:javax.annotation-api:jar:1.2
133
+ javax.servlet:javax.servlet-api:jar:3.1.0
134
+ org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106
135
+ org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106
136
+ org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106
137
+ org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106
138
+ org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106
139
+ org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106
140
+ org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106
141
+ org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106
142
+ org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106
143
+ org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106
144
+ org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106
145
+ org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106
146
+ org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106
147
+ org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0
148
+ ) + validation_deps
149
+ elsif v == '2.8.2-v20191108'
150
+ %w(
151
+ org.realityforge.com.google.jsinterop:jsinterop-annotations:jar:2.8.2-v20191108
152
+ org.realityforge.com.google.jsinterop:jsinterop-annotations:jar:sources:2.8.2-v20191108
153
+ org.w3c.css:sac:jar:1.3
154
+ org.realityforge.com.google.gwt:gwt-dev:jar:2.8.2-v20191108
155
+ org.realityforge.com.google.gwt:gwt-user:jar:2.8.2-v20191108
156
+ com.google.code.gson:gson:jar:2.6.2
157
+
158
+ org.ow2.asm:asm:jar:7.1
159
+ org.ow2.asm:asm-util:jar:7.1
160
+ org.ow2.asm:asm-tree:jar:7.1
161
+ org.ow2.asm:asm-commons:jar:7.1
162
+
163
+ colt:colt:jar:1.2.0
164
+ ant:ant:jar:1.6.5
165
+ commons-collections:commons-collections:jar:3.2.2
166
+ commons-io:commons-io:jar:2.4
167
+ com.ibm.icu:icu4j:jar:63.1
168
+ tapestry:tapestry:jar:4.0.2
169
+
170
+ javax.annotation:javax.annotation-api:jar:1.2
171
+ javax.servlet:javax.servlet-api:jar:3.1.0
172
+ org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106
173
+ org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106
174
+ org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106
175
+ org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106
176
+ org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106
177
+ org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106
178
+ org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106
179
+ org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106
180
+ org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106
181
+ org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106
182
+ org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106
183
+ org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106
184
+ org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106
185
+ org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0
186
+ ) + validation_deps
187
+ elsif v == '2.9.0'
188
+ %w(
189
+ com.google.jsinterop:jsinterop-annotations:jar:2.0.0
190
+ com.google.jsinterop:jsinterop-annotations:jar:sources:2.0.0
191
+ org.w3c.css:sac:jar:1.3
192
+
193
+ com.google.gwt:gwt-dev:jar:2.9.0
194
+ com.google.gwt:gwt-user:jar:2.9.0
195
+ com.google.code.gson:gson:jar:2.6.2
196
+
197
+ org.ow2.asm:asm:jar:7.1
198
+ org.ow2.asm:asm-util:jar:7.1
199
+ org.ow2.asm:asm-tree:jar:7.1
200
+ org.ow2.asm:asm-commons:jar:7.1
201
+
202
+ colt:colt:jar:1.2.0
203
+ ant:ant:jar:1.6.5
204
+ commons-collections:commons-collections:jar:3.2.2
205
+ commons-io:commons-io:jar:2.4
206
+ com.ibm.icu:icu4j:jar:63.1
207
+ tapestry:tapestry:jar:4.0.2
208
+
209
+ javax.annotation:javax.annotation-api:jar:1.2
210
+ javax.servlet:javax.servlet-api:jar:3.1.0
211
+ org.eclipse.jetty:jetty-annotations:jar:9.2.14.v20151106
212
+ org.eclipse.jetty:jetty-continuation:jar:9.2.14.v20151106
213
+ org.eclipse.jetty:jetty-http:jar:9.2.14.v20151106
214
+ org.eclipse.jetty:jetty-io:jar:9.2.14.v20151106
215
+ org.eclipse.jetty:jetty-jndi:jar:9.2.14.v20151106
216
+ org.eclipse.jetty:jetty-plus:jar:9.2.14.v20151106
217
+ org.eclipse.jetty:jetty-security:jar:9.2.14.v20151106
218
+ org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106
219
+ org.eclipse.jetty:jetty-servlet:jar:9.2.14.v20151106
220
+ org.eclipse.jetty:jetty-servlets:jar:9.2.14.v20151106
221
+ org.eclipse.jetty:jetty-util:jar:9.2.14.v20151106
222
+ org.eclipse.jetty:jetty-webapp:jar:9.2.14.v20151106
223
+ org.eclipse.jetty:jetty-xml:jar:9.2.14.v20151106
224
+ org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0
225
+ ) + validation_deps
226
+ else
227
+ raise "Unknown GWT version #{v}"
228
+ end
229
+ end
230
+
231
+ def gwtc_main(modules, source_artifacts, output_dir, unit_cache_dir, options = {})
232
+ base_dependencies = self.dependencies(options[:version])
233
+ cp = Buildr.artifacts(base_dependencies).each(&:invoke).map(&:to_s) + Buildr.artifacts(source_artifacts).each(&:invoke).map(&:to_s)
234
+ style = options[:style] || 'OBFUSCATED' # 'PRETTY', 'DETAILED'
235
+ log_level = options[:log_level] # ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
236
+ workers = options[:workers] || 2
237
+
238
+ args = []
239
+ if log_level
240
+ args << '-logLevel'
241
+ args << log_level
242
+ end
243
+ args << '-strict'
244
+ unless style == 'OBFUSCATED'
245
+ args << '-style'
246
+ args << style
247
+ end
248
+ args << '-localWorkers'
249
+ args << workers.to_s
250
+ args << '-war'
251
+ args << output_dir
252
+ if options[:compile_report_dir]
253
+ args << '-compileReport'
254
+ args << '-extra'
255
+ args << options[:compile_report_dir]
256
+ end
257
+
258
+ if options[:draft_compile]
259
+ args << '-draftCompile'
260
+ end
261
+ if options[:gwtc_args]
262
+ args += options[:gwtc_args]
263
+ end
264
+
265
+ if options[:enable_closure_compiler] && options[:version] == '2.7.0'
266
+ args << '-XenableClosureCompiler'
267
+ end
268
+
269
+ if options[:js_exports]
270
+ args << '-generateJsInteropExports'
271
+ end
272
+
273
+ args += modules
274
+
275
+ properties = options[:properties] ? options[:properties].dup : {}
276
+ properties['gwt.persistentunitcache'] = 'true'
277
+ properties['gwt.persistentunitcachedir'] = unit_cache_dir
278
+
279
+ Java::Commands.java 'com.google.gwt.dev.Compiler', *(args + [{:classpath => cp, :properties => properties, :java_args => options[:java_args], :pathing_jar => false}])
280
+ end
281
+
282
+ def superdev_dependencies(version = nil)
283
+ self.dependencies + ["com.google.gwt:gwt-codeserver:jar:#{version || self.version}"]
284
+ end
285
+
286
+ def gwt_superdev(module_name, source_artifacts, work_dir, options = {})
287
+
288
+ cp = Buildr.artifacts(self.superdev_dependencies(options[:version])).each(&:invoke).map(&:to_s) + Buildr.artifacts(source_artifacts).each(&:invoke).map(&:to_s)
289
+
290
+ args = []
291
+ args << '-port' << (options[:port] || 5050).to_s
292
+ args << '-workDir' << work_dir
293
+ (options[:src] || []).each do |src|
294
+ args << '-src' << src
295
+ end
296
+ args << module_name
297
+
298
+ properties = options[:properties] ? options[:properties].dup : {}
299
+
300
+ java_args = options[:java_args] ? options[:java_args].dup : {}
301
+
302
+ Java::Commands.java 'com.google.gwt.dev.codeserver.CodeServer', *(args + [{:classpath => cp, :properties => properties, :java_args => java_args, :pathing_jar => false}])
303
+ end
304
+
305
+ def gwt_css2gss(filenames, options = {})
306
+ cp = Buildr.artifacts(self.dependencies(options[:version])).each(&:invoke).map(&:to_s)
307
+ properties = options[:properties] ? options[:properties].dup : {}
308
+ java_args = options[:java_args] ? options[:java_args].dup : {}
309
+ Java::Commands.java 'com.google.gwt.resources.converter.Css2Gss', *([filenames] + [{ :classpath => cp, :properties => properties, :java_args => java_args, :pathing_jar => false }])
310
+ end
311
+ end
312
+
313
+ module ProjectExtension
314
+ include Extension
315
+
316
+ first_time do
317
+ desc 'Run C22 to GSS converter. Set css files via environment variable CSS_FILES'
318
+ task('css2gss') do
319
+ raise 'Please specify css files or directory via variable CSS_FILES' unless ENV['CSS_FILES']
320
+ Buildr::GWT.gwt_css2gss(ENV['CSS_FILES'].to_s.split(' '))
321
+ end
322
+ end
323
+
324
+ def gwt(module_names, options = {})
325
+ p = options[:target_project]
326
+ target_project = p.nil? ? project : p.is_a?(String) ? project(p) : p
327
+ output_key = options[:output_key] || project.id
328
+ output_dir = project._(:target, :generated, :gwt, output_key)
329
+ artifacts = ([project.compile.target] + project.compile.sources + project.resources.sources).flatten.compact.collect do |a|
330
+ a.is_a?(String) ? file(a) : a
331
+ end
332
+ dependencies = options[:dependencies] ? artifacts(options[:dependencies]) : (project.compile.dependencies + [project.compile.target]).flatten.compact.collect do |dep|
333
+ dep.is_a?(String) ? file(dep) : dep
334
+ end
335
+
336
+ unit_cache_dir = project._(:target, :gwt, :unit_cache_dir, output_key)
337
+
338
+ version = gwt_detect_version(dependencies) || Buildr::GWT.version
339
+
340
+ additional_gwt_deps = []
341
+ existing_deps = project.compile.dependencies.collect do |d|
342
+ a = artifact(d)
343
+ a.invoke if a.is_a?(Buildr::Artifact)
344
+ a.to_s
345
+ end
346
+ Buildr::GWT.dependencies(version).each do |d|
347
+ a = artifact(d)
348
+ a.invoke if a.respond_to?(:invoke)
349
+ unless options[:skip_merge_gwt_dependencies]
350
+ project.iml.main_dependencies << a unless !project.iml? || existing_deps.include?(a.to_s)
351
+ project.compile.dependencies << a unless existing_deps.include?(a.to_s)
352
+ end
353
+ additional_gwt_deps << a
354
+ end
355
+
356
+ task = project.file(output_dir) do
357
+ Buildr::GWT.gwtc_main(module_names,
358
+ (dependencies + artifacts + additional_gwt_deps).flatten.compact,
359
+ output_dir,
360
+ unit_cache_dir,
361
+ {:version => version}.merge(options))
362
+ end
363
+ task.enhance(dependencies)
364
+ task.enhance([project.compile])
365
+ target_project.assets.paths << task
366
+ task
367
+ end
368
+
369
+ def gwt_superdev_runner(module_name, options = {})
370
+
371
+ dependencies = []
372
+ if options[:dependencies]
373
+ dependencies = artifacts(options[:dependencies])
374
+ else
375
+ sources = [] + project.compile.sources + project.resources.sources
376
+ classes = [] + project.compile.dependencies + [project.compile.target]
377
+ dependencies = (classes + sources).collect do |dep|
378
+ dep.is_a?(String) ? file(dep) : dep
379
+ end
380
+ end
381
+
382
+ desc 'Run Superdev mode'
383
+ project.task('superdev') do
384
+ work_dir = project._(:target, :gwt, :superdev)
385
+ mkdir_p work_dir
386
+ Buildr::GWT.gwt_superdev(module_name,
387
+ dependencies,
388
+ work_dir,
389
+ {:version => gwt_detect_version(dependencies)}.merge(options))
390
+ end
391
+ end
392
+
393
+ protected
394
+
395
+ def gwt_detect_version(dependencies)
396
+ version = nil
397
+ dependencies.each do |dep|
398
+ if dep.respond_to?(:to_spec_hash)
399
+ hash = dep.to_spec_hash
400
+ if %w(org.realityforge.com.google.gwt com.google.gwt).include?(hash[:group]) && 'gwt-user' == hash[:id] && :jar == hash[:type]
401
+ version = hash[:version]
402
+ end
403
+ end
404
+ end
405
+ version
406
+ end
407
+ end
408
+ end
409
+ end
410
+
411
+ class Buildr::Project
412
+ include Buildr::GWT::ProjectExtension
413
+ end