File tree Expand file tree Collapse file tree 3 files changed +23
-38
lines changed
Expand file tree Collapse file tree 3 files changed +23
-38
lines changed Original file line number Diff line number Diff line change 1- cc_binary (
1+ filegroup (
2+ name = "httplib" ,
3+ srcs = glob (["httplib/httplib.h" ]),
4+ visibility = ["//visibility:public" ]
5+ )
6+
7+ filegroup (
28 name = "main" ,
3- srcs = [
4- "main.cc" ,
5- "httplib/httplib.h"
6- ],
7- linkopts = ["-lpthread" ],
9+ srcs = glob (["main.cc" ]),
10+ visibility = ["//visibility:public" ],
811)
Original file line number Diff line number Diff line change 1- def _impl (ctx ):
2- executable = ctx .actions .declare_file (ctx .attr .name )
3-
4- args = ctx .actions .args ()
5- args .add ("-o" , executable )
6- args .add_all (ctx .files .srcs )
7-
8- ctx .actions .run (
9- inputs = ctx .files .srcs ,
10- outputs = [executable ],
11- # This is for demo purposes. In a real Bazel rule you'd
12- # want to use cc_common.
13- executable = "/usr/bin/gcc" ,
14- arguments = [args ],
1+ def devserver (name , port ):
2+ native .cc_binary (
3+ name = name ,
4+ srcs = [
5+ Label ("@rules_devserver//devserver:main" ),
6+ Label ("@rules_devserver//devserver:httplib" )
7+ ],
8+ linkopts = ["-lpthread" ],
159 )
16-
17- return [
18- DefaultInfo (
19- executable = executable ,
20- files = depset ([executable ]),
21- ),
22- ]
23-
24- my_cc_binary = rule (
25- implementation = _impl ,
26- attrs = {
27- "srcs" : attr .label_list (
28- mandatory = True ,
29- allow_files = True ,
30- ),
31- },
32- executable = True ,
33- )
Original file line number Diff line number Diff line change 1+ load ("//devserver:defs.bzl" , "devserver" )
2+
3+ devserver (
4+ name = "serve" ,
5+ port = 8080 ,
6+ )
You can’t perform that action at this time.
0 commit comments