Skip to content

Commit a73e648

Browse files
committed
Migrate top level targets in the Rakefile to Buck
1 parent c3fe2dd commit a73e648

File tree

22 files changed

+325
-103
lines changed

22 files changed

+325
-103
lines changed

Rakefile

+42-66
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ require 'rake-tasks/crazy_fun'
1919
require 'rake-tasks/crazy_fun/mappings/export'
2020
require 'rake-tasks/crazy_fun/mappings/folder'
2121
require 'rake-tasks/crazy_fun/mappings/gcc'
22-
require 'rake-tasks/crazy_fun/mappings/java'
2322
require 'rake-tasks/crazy_fun/mappings/javascript'
2423
require 'rake-tasks/crazy_fun/mappings/mozilla'
2524
require 'rake-tasks/crazy_fun/mappings/python'
@@ -34,7 +33,6 @@ require 'rake-tasks/checks'
3433
require 'rake-tasks/dotnet'
3534
require 'rake-tasks/zip'
3635
require 'rake-tasks/c'
37-
require 'rake-tasks/java'
3836
require 'rake-tasks/selenium'
3937
require 'rake-tasks/se-ide'
4038
require 'rake-tasks/ie_code_generator'
@@ -77,7 +75,6 @@ crazy_fun = CrazyFun.new
7775
ExportMappings.new.add_all(crazy_fun)
7876
FolderMappings.new.add_all(crazy_fun)
7977
GccMappings.new.add_all(crazy_fun)
80-
JavaMappings.new.add_all(crazy_fun)
8178
JavascriptMappings.new.add_all(crazy_fun)
8279
MozillaMappings.new.add_all(crazy_fun)
8380
PythonMappings.new.add_all(crazy_fun)
@@ -86,6 +83,8 @@ RenameMappings.new.add_all(crazy_fun)
8683
RubyMappings.new.add_all(crazy_fun)
8784
VisualStudioMappings.new.add_all(crazy_fun)
8885

86+
# Allow old crazy fun targets to continue to exist
87+
8988
# Not every platform supports building every binary needed, so we sometimes
9089
# need to fall back to prebuilt binaries. The prebuilt binaries are stored in
9190
# a directory structure identical to that used in the "build" folder, but
@@ -105,7 +104,6 @@ require 'rake-tasks/buck'
105104

106105
# Java targets required for release. These should all have the correct maven_coords set.
107106
JAVA_RELEASE_TARGETS = [
108-
'//java/client/src/com/thoughtworks/selenium:leg-rc',
109107
'//java/client/src/org/openqa/selenium:core',
110108
'//java/client/src/org/openqa/selenium:selenium',
111109
'//java/client/src/org/openqa/selenium/chrome:chrome',
@@ -125,26 +123,25 @@ task :default => [:test]
125123

126124
task :all => [
127125
:"selenium-java",
128-
"//java/client/test/org/openqa/selenium/environment/webserver:webserver:uber"
126+
"//java/client/test/org/openqa/selenium/environment:webserver"
129127
]
130128
task :all_zip => [:'selenium-java_zip']
131129
task :tests => [
132-
"//java/client/test/org/openqa/selenium/htmlunit:test_basic",
133-
"//java/client/test/org/openqa/selenium/htmlunit:test_js",
134-
"//java/client/test/org/openqa/selenium/firefox:test_synthesized",
135-
"//java/client/test/org/openqa/selenium/ie:test",
136-
"//java/client/test/org/openqa/selenium/chrome:test",
137-
"//java/client/test/org/openqa/selenium/opera:test_blink",
138-
"//java/client/test/org/openqa/selenium/lift:test",
139-
"//java/client/test/org/openqa/selenium/support:SmallTests",
140-
"//java/client/test/org/openqa/selenium/support:LargeTests",
130+
"//java/client/test/org/openqa/selenium/htmlunit:htmlunit",
131+
"//java/client/test/org/openqa/selenium/htmlunit:htmlunit-no-js",
132+
"//java/client/test/org/openqa/selenium/firefox:test-synthesized",
133+
"//java/client/test/org/openqa/selenium/ie:ie",
134+
"//java/client/test/org/openqa/selenium/chrome:chrome",
135+
"//java/client/test/org/openqa/selenium/opera:opera",
136+
# "//java/client/test/org/openqa/selenium/lift:test",
137+
"//java/client/test/org/openqa/selenium/support:small-tests",
138+
"//java/client/test/org/openqa/selenium/support:large-tests",
141139
"//java/client/test/org/openqa/selenium/remote:common-tests",
142140
"//java/client/test/org/openqa/selenium/remote:client-tests",
143141
"//java/server/test/org/openqa/selenium/remote/server/log:test",
144142
"//java/server/test/org/openqa/selenium/remote/server:small-tests",
145143
]
146144
task :chrome => [ "//java/client/src/org/openqa/selenium/chrome" ]
147-
task :common_core => [ "//common:core" ]
148145
task :grid => [ "//java/server/src/org/openqa/grid/selenium" ]
149146
task :ie => [ "//java/client/src/org/openqa/selenium/ie" ]
150147
task :firefox => [
@@ -154,25 +151,23 @@ task :firefox => [
154151
"//cpp:imehandler64",
155152
"//java/client/src/org/openqa/selenium/firefox"
156153
]
157-
task :'debug-server' => "//java/client/test/org/openqa/selenium/environment/webserver:WebServer:run"
158-
task :remote => [:remote_common, :remote_server, :remote_client]
159-
task :remote_common => ["//java/client/src/org/openqa/selenium/remote:common"]
154+
task :'debug-server' => "//java/client/test/org/openqa/selenium/environment:webserver:run"
155+
task :remote => [:remote_server, :remote_client]
160156
task :remote_client => ["//java/client/src/org/openqa/selenium/remote"]
161157
task :remote_server => ["//java/server/src/org/openqa/selenium/remote/server"]
162158
task :safari => [
163159
"//java/client/src/org/openqa/selenium/safari",
164160
]
165-
task :server_lite => ["//java/server/src/org/openqa/selenium/server:server_lite"]
166161
task :selenium => [ "//java/client/src/org/openqa/selenium" ]
167162
task :support => [
168163
"//java/client/src/org/openqa/selenium/lift",
169164
"//java/client/src/org/openqa/selenium/support",
170165
]
171166

172167
desc 'Build the standalone server'
173-
task 'selenium-server-standalone' => '//java/server/src/org/openqa/grid/selenium:selenium:uber'
168+
task 'selenium-server-standalone' => '//java/server/src/org/openqa/grid/selenium:selenium'
174169

175-
task 'selenium-server-standalone-v3' => '//java/server/src/org/openqa/grid/selenium:selenium:uber'
170+
task 'selenium-server-standalone-v3' => '//java/server/src/org/openqa/grid/selenium:selenium'
176171

177172
task :ide => [ "//ide:selenium-ide-multi" ]
178173
task :ide_proxy_setup => [ "//javascript/selenium-atoms", "se_ide:setup_proxy" ]
@@ -185,62 +180,46 @@ task :test_javascript => [
185180
'//javascript/webdriver:es6_test:run',
186181
'//javascript/selenium-atoms:test:run',
187182
'//javascript/selenium-core:test:run']
188-
task :test_chrome => [ "//java/client/test/org/openqa/selenium/chrome:test:run" ]
183+
task :test_chrome => [ "//java/client/test/org/openqa/selenium/chrome:chrome:run" ]
189184
task :test_chrome_atoms => [
190185
'//javascript/atoms:test_chrome:run',
191186
'//javascript/chrome-driver:test:run',
192187
'//javascript/webdriver:test_chrome:run']
193188
task :test_htmlunit => [
194-
"//java/client/test/org/openqa/selenium/htmlunit:test_basic:run",
195-
"//java/client/test/org/openqa/selenium/htmlunit:test_js:run"
189+
"//java/client/test/org/openqa/selenium/htmlunit:htmlunit-no-js:run",
190+
"//java/client/test/org/openqa/selenium/htmlunit:htmlunit:run"
196191
]
197192
task :test_grid => [
198-
"//java/server/test/org/openqa/grid/common:test:run",
199-
"//java/server/test/org/openqa/grid:test:run",
200-
"//java/server/test/org/openqa/grid/e2e:test:run"
193+
"//java/server/test/org/openqa/grid/common:common:run",
194+
"//java/server/test/org/openqa/grid:grid:run",
195+
"//java/server/test/org/openqa/grid/e2e:e2e:run"
201196
]
202-
task :test_ie => [ "//java/client/test/org/openqa/selenium/ie:test:run" ]
197+
task :test_ie => [ "//java/client/test/org/openqa/selenium/ie:ie:run" ]
203198
task :test_jobbie => [ :test_ie ]
204-
task :test_firefox => [ "//java/client/test/org/openqa/selenium/firefox:test_synthesized:run" ]
205-
task :test_opera => [ "//java/client/test/org/openqa/selenium/opera:test_blink:run" ]
199+
task :test_firefox => [ "//java/client/test/org/openqa/selenium/firefox:test-synthesized:run" ]
200+
task :test_opera => [ "//java/client/test/org/openqa/selenium/opera:opera:run" ]
206201
task :test_remote_server => [ '//java/server/test/org/openqa/selenium/remote/server:small-tests:run' ]
207202
task :test_remote => [
208203
'//java/client/test/org/openqa/selenium/remote:common-tests:run',
209204
'//java/client/test/org/openqa/selenium/remote:client-tests:run',
210205
'//java/client/test/org/openqa/selenium/remote:remote-driver-tests:run',
211206
:test_remote_server
212207
]
213-
task :test_safari => [ "//java/client/test/org/openqa/selenium/safari:test:run" ]
214-
task :test_phantomjs => [ "//java/client/test/org/openqa/selenium/phantomjs:test:run" ]
208+
task :test_safari => [ "//java/client/test/org/openqa/selenium/safari:safari:run" ]
209+
task :test_phantomjs => [ "//java/client/test/org/openqa/selenium/phantomjs:phantomjs:run" ]
215210
task :test_support => [
216-
"//java/client/test/org/openqa/selenium/lift:test:run",
217-
"//java/client/test/org/openqa/selenium/support:SmallTests:run",
218-
"//java/client/test/org/openqa/selenium/support:LargeTests:run"
211+
"//java/client/test/org/openqa/selenium/lift:lift:run",
212+
"//java/client/test/org/openqa/selenium/support:small-tests:run",
213+
"//java/client/test/org/openqa/selenium/support:large-tests:run"
219214
]
220215

221216
# TODO(simon): test-core should go first, but it's changing the least for now.
222-
task :test_selenium => [ :'test-rc', :'test-v1-emulation', :'test-core']
217+
task :test_selenium => [ :'test-rc']
223218

224-
task :'test-v1-emulation' => [ '//java/client/test/com/thoughtworks/selenium:firefox-emulation-test:run' ]
225-
task :'test-rc' => ['//java/client/test/org/openqa/selenium:RcBrowserLauncherTests:run',
226-
'//java/server/test/org/openqa/selenium/server:RcServerUnitTests:run',
227-
'//java/server/test/org/openqa/selenium/server:RcServerLargeTests:run',
228-
'//java/client/test/com/thoughtworks/selenium:firefox-rc-test:run',
229-
'//java/client/test/com/thoughtworks/selenium:firefox-proxy-rc-test:run',
230-
'//java/client/test/com/thoughtworks/selenium:firefox-singlewindow-rc-test:run']
231-
task :'test-core' => [:'test-core-firefox']
219+
task :'test-rc' => ['//java/client/test/com/thoughtworks/selenium:firefox-rc-test:run']
232220

233221
if (windows?)
234-
task :'test-v1-emulation' => ['//java/client/test/com/thoughtworks/selenium:ie-emulation-test:run']
235-
task :'test-rc' => ['//java/client/test/com/thoughtworks/selenium:ie-rc-test:run',
236-
'//java/client/test/com/thoughtworks/selenium:ie-proxy-rc-test:run',
237-
'//java/client/test/com/thoughtworks/selenium:ie-singlewindow-rc-test:run']
238-
task :'test-core' => [:'test-core-ie']
239-
# TODO(santi): why are these disabled?
240-
#elsif (mac?)
241-
# task :'test-rc' => ['//java/client/test/com/thoughtworks/selenium:safari-rc-test:run',
242-
# '//java/client/test/com/thoughtworks/selenium:safari-proxy-rc-test:run']
243-
# task :'test-core' => [:'test-core-safari']
222+
task :'test-rc' => ['//java/client/test/com/thoughtworks/selenium:ie-rc-test:run']
244223
end
245224

246225
task :test_java_webdriver => [
@@ -260,7 +239,7 @@ end
260239

261240
task :test_java => [
262241
"//java/client/test/org/openqa/selenium/atoms:test:run",
263-
"//java/client/test/org/openqa/selenium:SmallTests:run",
242+
"//java/client/test/org/openqa/selenium:small-tests:run",
264243
:test_support,
265244
:test_java_webdriver,
266245
:test_selenium,
@@ -513,25 +492,22 @@ end
513492

514493
task :release => JAVA_RELEASE_TARGETS + [
515494
# Until we mananage to migrate to Buck entirely.
516-
'//java/server/src/org/openqa/grid/selenium:selenium:uber',
495+
'//java/server/src/org/openqa/grid/selenium:selenium',
517496
'//java/server/src/org/openqa/grid/selenium:selenium:zip',
518-
'//java/client/src/org/openqa/selenium:client-combined-v3:zip',
497+
'//java/client/src/org/openqa/selenium:client-combined:zip',
519498
] do |t|
520499
puts t.prerequisites.join(', ')
521500

522501
t.prerequisites.each do |p|
523-
# Nasty hack to work around buck publish not knowing how to build crazy fun targets
524-
if p.to_s.count(':') > 1
525-
next
526-
end
527-
# Buck::buck_cmd.call('publish', "--dry-run --to-maven-central #{p}")
528-
Buck::buck_cmd.call('build', "#{p}")
502+
if JAVA_RELEASE_TARGETS.include?(p)
503+
Buck::buck_cmd.call('publish', ['--dry-run', '--to-maven-central', p])
504+
end
529505
end
530506

531507
mkdir_p "build/dist"
532-
cp "build/java/server/src/org/openqa/grid/selenium/selenium-standalone.jar", "build/dist/selenium-server-standalone-#{version}.jar"
533-
cp "build/java/server/src/org/openqa/grid/selenium/selenium.zip", "build/dist/selenium-server-#{version}.zip"
534-
cp "build/java/client/src/org/openqa/selenium/client-combined-v3.zip", "build/dist/selenium-java-#{version}.zip"
508+
cp Rake::Task['//java/server/src/org/openqa/grid/selenium:selenium'].out, "build/dist/selenium-server-standalone-#{version}.jar"
509+
cp Rake::Task['//java/server/src/org/openqa/grid/selenium:selenium:zip'].out, "build/dist/selenium-server-#{version}.zip"
510+
cp Rake::Task['//java/client/src/org/openqa/selenium:client-combined:zip'].out, "build/dist/selenium-java-#{version}.zip"
535511
end
536512

537513
task :push_release => [:release] do

java/client/src/com/thoughtworks/selenium/BUCK

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ java_library(name = 'selenium',
3636
],
3737
visibility = [
3838
'//java/client/src/com/thoughtworks/selenium/...',
39+
'//java/client/test/com/thoughtworks/selenium/...',
3940
'//java/server/src/com/thoughtworks/selenium:leg-rc',
4041
]
4142
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
java_test(
3+
name = 'firefox-rc-test',
4+
srcs = [
5+
'WebDriverSeleniumTestSuite.java',
6+
],
7+
vm_args = [
8+
'-Dselenium.browser=ff',
9+
],
10+
deps = [
11+
':tests',
12+
'//third_party/java/junit:junit',
13+
],
14+
)
15+
16+
java_test(
17+
name = 'ie-rc-test',
18+
srcs = [
19+
'WebDriverSeleniumTestSuite.java',
20+
],
21+
vm_args = [
22+
'-Dselenium.browser=ie',
23+
],
24+
deps = [
25+
':tests',
26+
'//third_party/java/junit:junit',
27+
],
28+
)
29+
30+
java_library(
31+
name = 'tests',
32+
srcs = glob([
33+
'*.java',
34+
'condition/*.java',
35+
'corebased/*.java',
36+
'testing/*.java',
37+
]),
38+
resources = [
39+
'testHelpers.js',
40+
],
41+
deps = [
42+
'//java/client/src/com/thoughtworks/selenium:leg-rc',
43+
'//java/client/src/org/openqa/selenium:selenium',
44+
'//java/client/src/org/openqa/selenium/remote:remote',
45+
'//java/client/test/org/openqa/selenium:helpers',
46+
'//java/client/test/org/openqa/selenium/environment:environment',
47+
'//java/client/test/org/openqa/selenium/testing:helpers',
48+
'//java/client/test/org/openqa/selenium/testing/drivers:browser',
49+
'//java/client/test/org/openqa/selenium/testing/drivers:drivers',
50+
'//java/server/test/org/openqa/selenium:server-with-tests',
51+
'//third_party/java/guava:guava',
52+
'//third_party/java/jetty:jetty',
53+
'//third_party/java/junit:junit',
54+
'//third_party/java/mockito:mockito',
55+
'//third_party/java/servlet:servlet-api',
56+
],
57+
)

java/client/test/com/thoughtworks/selenium/testing/SeleniumTestEnvironment.java

+6-12
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919

2020
import com.google.common.collect.Lists;
2121

22-
import org.openqa.selenium.Build;
23-
import org.openqa.selenium.testing.DevMode;
22+
import org.openqa.selenium.BuckBuild;
2423
import org.openqa.selenium.environment.TestEnvironment;
2524
import org.openqa.selenium.environment.webserver.AppServer;
26-
import org.openqa.selenium.testing.InProject;
2725
import org.openqa.selenium.net.PortProber;
2826
import org.openqa.selenium.net.UrlChecker;
2927
import org.openqa.selenium.os.CommandLine;
3028

31-
import java.io.File;
3229
import java.net.URL;
30+
import java.nio.file.Path;
3331
import java.util.ArrayList;
3432
import java.util.Arrays;
3533
import java.util.concurrent.TimeUnit;
@@ -41,12 +39,8 @@ public class SeleniumTestEnvironment implements TestEnvironment {
4139

4240
public SeleniumTestEnvironment(int port, String... extraArgs) {
4341
try {
44-
if (DevMode.isInDevMode()) {
45-
new Build().of("//java/server/test/org/openqa/selenium:server-with-tests:uber").go();
46-
}
47-
48-
File seleniumJar = InProject.locate(
49-
"build/java/server/test/org/openqa/selenium/server-with-tests-standalone.jar");
42+
Path serverJar = new BuckBuild()
43+
.of("//java/server/test/org/openqa/selenium:server-with-tests").go();
5044

5145
ArrayList<Object> args = Lists.newArrayList();
5246
if (Boolean.getBoolean("webdriver.debug")) {
@@ -55,7 +49,7 @@ public SeleniumTestEnvironment(int port, String... extraArgs) {
5549
}
5650

5751
args.add("-jar");
58-
args.add(seleniumJar.getAbsolutePath());
52+
args.add(serverJar.toAbsolutePath().toString());
5953
args.add("-port");
6054
args.add(String.valueOf(port));
6155

@@ -75,7 +69,7 @@ public SeleniumTestEnvironment(int port, String... extraArgs) {
7569
PortProber.pollPort(port);
7670
seleniumServerUrl = "http://localhost:" + port;
7771

78-
URL status = new URL(seleniumServerUrl + "/wd/hub/status");
72+
URL status = new URL(seleniumServerUrl + "/tests");
7973
new UrlChecker().waitUntilAvailable(60, TimeUnit.SECONDS, status);
8074
} catch (Exception e) {
8175
throw new RuntimeException(e);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export_file(
2+
name = 'execute_script',
3+
out = 'execute_script.js',
4+
src = '//javascript/atoms/fragments:execute_script',
5+
)
6+
7+
export_file(
8+
name = 'atoms_inputs',
9+
out = 'atoms_inputs.js',
10+
src = '//javascript/webdriver/atoms:inputs',
11+
)
12+
13+
14+
java_test(name = 'test',
15+
srcs = [ 'AtomsRhinoTests.java' ],
16+
resources = [
17+
':execute_script',
18+
':atoms_inputs',
19+
],
20+
deps = [
21+
':tests',
22+
'//third_party/java/junit:junit',
23+
])
24+
25+
java_library(
26+
name = 'tests',
27+
srcs = glob(['*.java']),
28+
deps = [
29+
'//java/client/test/org/openqa/selenium/testing:helpers',
30+
'//java/client/test/org/openqa/selenium:helpers',
31+
'//third_party/java/htmlunit:htmlunit',
32+
'//third_party/java/junit:junit',
33+
'//third_party/java/guava:guava',
34+
'//third_party/java/gson:gson',
35+
],
36+
)

0 commit comments

Comments
 (0)