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

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: got full gn build working 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..5f0cb044cc7be4e7e692e5826d16e8efe97a9087
--- /dev/null
+++ b/build/go/rules.gni
@@ -0,0 +1,49 @@
+# 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))
qsr 2014/09/22 11:11:25 You should remove this if this is not needed.
tburkard 2014/09/22 14:23:17 Done.
+ assert(go_build_tool != "")
+
+ static_library_name = target_name + "_static_library"
+
+ static_library(static_library_name) {
+ sources = invoker.additional_sources
+ deps = invoker.deps
+ complete_static_lib = true
+ }
+
+ action(target_name) {
+ deps = [
+ ":$static_library_name",
+ ]
+ script = "//build/go/go.py"
+ outputs = [ "${target_out_dir}/${target_name}" ]
+ # Since go test does not permit specifying an output directory or output
+ # binary name, we create a temporary build directory, and the python
+ # script will later identify the output, copy it to the target location,
+ # and clean up the temporary build directory.
+ build_dir = "${target_out_dir}/${target_name}_build"
+ args = [
+ "--",
+ "${go_build_tool}",
+ 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("//", "//"),
qsr 2014/09/22 11:11:25 Use rebase_path without second argument to directl
tburkard 2014/09/22 14:23:17 Done.
+ " -L" + rebase_path(root_build_dir +"/obj/mojo/go", "//") +
+ " -L" + rebase_path(root_build_dir + "/obj/third_party/libevent", "//") +
+ " -lsystem_test_static_library -lstdc++ -lpthread -lm -lglib-2.0 -levent",
+ "test", "-c",
+ ] + rebase_path(invoker.sources, build_dir)
+ }
+}
« no previous file with comments | « build/go/go.py ('k') | mojo/BUILD.gn » ('j') | mojo/go/system/impl/core_impl.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698