Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: build/go/rules.gni

Issue 871863005: Remove //build/go, this is not used in chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/go/go.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 declare_args() {
6 # By default, there is no go build tool, because go builds are not supported.
7 go_build_tool = ""
8 }
9
10 # Declare a go test binary target.
11 #
12 # The target generates a go test executable, linking against other C code,
13 # which is compiled into a static library and linked against Go.
14 #
15 # Only works on linux. |go_build_tool| must be set to the absolute path
16 # of the go build tool.
17 #
18 # Variables (all required)
19 # sources: list of .go files to compile
20 # static_library_sources: list of C sources needed for the static library
21 # deps: dependencies for the static library
22
23 template("go_test_binary") {
24 # Only available on linux for now.
25 assert(is_linux)
26 assert(defined(invoker.sources))
27 assert(go_build_tool != "")
28
29 static_library_name = target_name + "_static_library"
30
31 static_library(static_library_name) {
32 sources = invoker.static_library_sources
33 deps = invoker.deps
34 complete_static_lib = true
35 }
36
37 action(target_name) {
38 deps = [
39 ":$static_library_name",
40 ]
41 script = "//build/go/go.py"
42 outputs = [
43 "${target_out_dir}/${target_name}",
44 ]
45
46 # Since go test does not permit specifying an output directory or output
47 # binary name, we create a temporary build directory, and the python
48 # script will later identify the output, copy it to the target location,
49 # and clean up the temporary build directory.
50 build_dir = "${target_out_dir}/${target_name}_build"
51 args = [
52 "--",
53 "${go_build_tool}",
54 rebase_path(build_dir, root_build_dir),
55 rebase_path(target_out_dir, root_build_dir) + "/${target_name}",
56 rebase_path("//", root_build_dir),
57 "-I" + rebase_path("//"),
58 " -L" + rebase_path(target_out_dir) + " -l" + static_library_name +
59 " -lstdc++ -lpthread -lm -lglib-2.0",
60 "test",
61 "-c",
62 ] + rebase_path(invoker.sources, build_dir)
63 }
64 }
65
66 template("go_shared_library") {
67 # Only available on android for now.
68 assert(is_android)
69 assert(defined(invoker.sources))
70 assert(go_build_tool != "")
71
72 static_library_name = target_name + "_static_library"
73
74 static_library(static_library_name) {
75 complete_static_lib = true
76 deps = invoker.deps
77 }
78
79 action(target_name) {
80 deps = [
81 ":$static_library_name",
82 ]
83 script = "//build/go/go.py"
84 outputs = [
85 "${target_out_dir}/${target_name}",
86 ]
87
88 # Since go test does not permit specifying an output directory or output
89 # binary name, we create a temporary build directory, and the python
90 # script will later identify the output, copy it to the target location,
91 # and clean up the temporary build directory.
92 build_dir = "${target_out_dir}/${target_name}_build"
93 args = [
94 "--",
95 "CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ${go_build_tool}",
96 rebase_path(build_dir, root_build_dir),
97 rebase_path(target_out_dir, root_build_dir) + "/${target_name}",
98 rebase_path("//", root_build_dir),
99 "-I" + rebase_path("//"),
100 " -L" + rebase_path(target_out_dir) + " -l" + static_library_name +
101 "",
102 "build -ldflags=-shared",
103 ] + rebase_path(invoker.sources, build_dir)
104 }
105 }
OLDNEW
« no previous file with comments | « build/go/go.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698