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

Unified Diff: build/go/rules.gni

Issue 556813003: Add Go build support for GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: build/go/rules.gni
diff --git a/build/go/rules.gni b/build/go/rules.gni
new file mode 100644
index 0000000000000000000000000000000000000000..412e78ce1c606b0c3233a0f818bfc730a7dacfdc
--- /dev/null
+++ b/build/go/rules.gni
@@ -0,0 +1,34 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+declare_args() {
+ # By default, there is no go build tool, because go builds are not supported.
+ go_build_tool = ""
+}
+
+template("go_test_binary") {
+ # Only available on linux for now.
+ assert(is_linux)
+ assert(defined(invoker.sources))
+# assert(defined(invoker.go_base_module))
+ assert(go_build_tool != "")
+
+ if (go_build_tool != "") {
+ action(target_name) {
+ script = "//build/go/go.py"
qsr 2014/09/15 09:54:24 If you really cannot declare the target binary, th
brettw 2014/09/16 22:58:55 I don't understand what you're saying here.
tburkard 2014/09/17 12:06:45 That's what I'm doing, I am creating the _build di
+ outputs = [ "${target_out_dir}/${target_name}" ]
+ build_dir = "${target_out_dir}/${target_name}_build"
+ args = [
+ "${go_build_tool}",
brettw 2014/09/16 22:58:54 Can you comment about this rule what this go test
tburkard 2014/09/17 12:06:45 Explained why I am doing it this way in the commen
+ rebase_path(build_dir, root_build_dir),
+ rebase_path(target_out_dir, root_build_dir) + "/${target_name}",
+ rebase_path("//", root_build_dir),
+ "-I" + rebase_path("//", "//"),
+ "-L" + rebase_path("//out/Release/lib", "//") +
+ " -lmojo_system_impl -lbase",
+ "test", "-c",
+ ] + rebase_path(invoker.sources, build_dir)
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698