Skip to content

Commit a4febaa

Browse files
comiuscopybara-github
authored andcommitted
Move compile StarlarkMethod back to CcModuleAPI
This way the documentation is again generated. Fixes: #20922 PiperOrigin-RevId: 612810046 Change-Id: I38f3ab01d1f4951eeb9045bbf214057824be6fd4
1 parent 0e6afb5 commit a4febaa

2 files changed

Lines changed: 328 additions & 289 deletions

File tree

src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java

Lines changed: 1 addition & 289 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@
7272
import com.google.devtools.build.lib.rules.cpp.CppActionConfigs.CppPlatform;
7373
import com.google.devtools.build.lib.rules.cpp.Link.LinkTargetType;
7474
import com.google.devtools.build.lib.rules.cpp.Link.LinkingMode;
75-
import com.google.devtools.build.lib.starlarkbuildapi.FileApi;
76-
import com.google.devtools.build.lib.starlarkbuildapi.cpp.CcCompilationContextApi;
7775
import com.google.devtools.build.lib.starlarkbuildapi.cpp.CcModuleApi;
78-
import com.google.devtools.build.lib.starlarkbuildapi.cpp.CppModuleMapApi;
7976
import com.google.devtools.build.lib.starlarkbuildapi.cpp.ExtraLinkTimeLibraryApi;
8077
import com.google.devtools.build.lib.util.FileTypeSet;
8178
import com.google.devtools.build.lib.util.Pair;
@@ -2102,292 +2099,7 @@ private static boolean checkObjectsBound(Object... objects) {
21022099
return false;
21032100
}
21042101

2105-
@StarlarkMethod(
2106-
name = "compile",
2107-
doc =
2108-
"Should be used for C++ compilation. Returns tuple of "
2109-
+ "(<code>CompilationContext</code>, <code>CcCompilationOutputs</code>).",
2110-
useStarlarkThread = true,
2111-
parameters = {
2112-
@Param(
2113-
name = "actions",
2114-
positional = false,
2115-
named = true,
2116-
doc = "<code>actions</code> object."),
2117-
@Param(
2118-
name = "feature_configuration",
2119-
doc = "<code>feature_configuration</code> to be queried.",
2120-
positional = false,
2121-
named = true),
2122-
@Param(
2123-
name = "cc_toolchain",
2124-
doc = "<code>CcToolchainInfo</code> provider to be used.",
2125-
positional = false,
2126-
named = true),
2127-
@Param(
2128-
name = "srcs",
2129-
doc = "The list of source files to be compiled.",
2130-
positional = false,
2131-
named = true,
2132-
defaultValue = "[]"),
2133-
@Param(
2134-
name = "public_hdrs",
2135-
doc =
2136-
"List of headers needed for compilation of srcs and may be included by dependent "
2137-
+ "rules transitively.",
2138-
positional = false,
2139-
named = true,
2140-
defaultValue = "[]"),
2141-
@Param(
2142-
name = "private_hdrs",
2143-
doc =
2144-
"List of headers needed for compilation of srcs and NOT to be included by"
2145-
+ " dependent rules.",
2146-
positional = false,
2147-
named = true,
2148-
defaultValue = "[]"),
2149-
@Param(
2150-
name = "textual_hdrs",
2151-
positional = false,
2152-
named = true,
2153-
allowedTypes = {
2154-
@ParamType(type = Sequence.class, generic1 = FileApi.class),
2155-
@ParamType(type = Depset.class)
2156-
},
2157-
documented = false,
2158-
defaultValue = "[]"),
2159-
@Param(
2160-
name = "additional_exported_hdrs",
2161-
positional = false,
2162-
named = true,
2163-
documented = false,
2164-
allowedTypes = {@ParamType(type = Sequence.class, generic1 = String.class)},
2165-
defaultValue = "unbound"),
2166-
@Param(
2167-
name = "includes",
2168-
doc =
2169-
"Search paths for header files referenced both by angle bracket and quotes. "
2170-
+ "Usually passed with -I. Propagated to dependents transitively.",
2171-
positional = false,
2172-
named = true,
2173-
defaultValue = "[]",
2174-
allowedTypes = {@ParamType(type = Sequence.class), @ParamType(type = Depset.class)}),
2175-
@Param(
2176-
name = "loose_includes",
2177-
documented = false,
2178-
positional = false,
2179-
named = true,
2180-
defaultValue = "unbound",
2181-
allowedTypes = {@ParamType(type = Sequence.class), @ParamType(type = NoneType.class)}),
2182-
@Param(
2183-
name = "quote_includes",
2184-
doc =
2185-
"Search paths for header files referenced by quotes, "
2186-
+ "e.g. #include \"foo/bar/header.h\". They can be either relative to the exec "
2187-
+ "root or absolute. Usually passed with -iquote. Propagated to dependents "
2188-
+ "transitively.",
2189-
positional = false,
2190-
named = true,
2191-
defaultValue = "[]"),
2192-
@Param(
2193-
name = "system_includes",
2194-
doc =
2195-
"Search paths for header files referenced by angle brackets, e.g. #include"
2196-
+ " &lt;foo/bar/header.h&gt;. They can be either relative to the exec root or"
2197-
+ " absolute. Usually passed with -isystem. Propagated to dependents "
2198-
+ "transitively.",
2199-
positional = false,
2200-
named = true,
2201-
defaultValue = "[]"),
2202-
@Param(
2203-
name = "framework_includes",
2204-
doc =
2205-
"Search paths for header files from Apple frameworks. They can be either relative "
2206-
+ "to the exec root or absolute. Usually passed with -F. Propagated to "
2207-
+ "dependents transitively.",
2208-
positional = false,
2209-
named = true,
2210-
defaultValue = "[]"),
2211-
@Param(
2212-
name = "defines",
2213-
doc =
2214-
"Set of defines needed to compile this target. Each define is a string. Propagated"
2215-
+ " to dependents transitively.",
2216-
positional = false,
2217-
named = true,
2218-
defaultValue = "[]"),
2219-
@Param(
2220-
name = "local_defines",
2221-
doc =
2222-
"Set of defines needed to compile this target. Each define is a string. Not"
2223-
+ " propagated to dependents transitively.",
2224-
positional = false,
2225-
named = true,
2226-
defaultValue = "[]"),
2227-
@Param(
2228-
name = "include_prefix",
2229-
doc =
2230-
"The prefix to add to the paths of the headers of this rule. When set, the "
2231-
+ "headers in the hdrs attribute of this rule are accessible at is the "
2232-
+ "value of this attribute prepended to their repository-relative path. "
2233-
+ "The prefix in the strip_include_prefix attribute is removed before this "
2234-
+ "prefix is added.",
2235-
positional = false,
2236-
named = true,
2237-
defaultValue = "''"),
2238-
@Param(
2239-
name = "strip_include_prefix",
2240-
doc =
2241-
"The prefix to strip from the paths of the headers of this rule. When set, the"
2242-
+ " headers in the hdrs attribute of this rule are accessible at their path"
2243-
+ " with this prefix cut off. If it's a relative path, it's taken as a"
2244-
+ " package-relative one. If it's an absolute one, it's understood as a"
2245-
+ " repository-relative path. The prefix in the include_prefix attribute is"
2246-
+ " added after this prefix is stripped.",
2247-
positional = false,
2248-
named = true,
2249-
defaultValue = "''"),
2250-
@Param(
2251-
name = "user_compile_flags",
2252-
doc = "Additional list of compilation options.",
2253-
positional = false,
2254-
named = true,
2255-
defaultValue = "[]"),
2256-
@Param(
2257-
name = "compilation_contexts",
2258-
doc = "Headers from dependencies used for compilation.",
2259-
positional = false,
2260-
named = true,
2261-
defaultValue = "[]"),
2262-
@Param(
2263-
name = "implementation_compilation_contexts",
2264-
documented = false,
2265-
positional = false,
2266-
defaultValue = "unbound",
2267-
allowedTypes = {
2268-
@ParamType(type = Sequence.class, generic1 = CcCompilationContextApi.class),
2269-
@ParamType(type = NoneType.class)
2270-
},
2271-
named = true),
2272-
@Param(
2273-
name = "name",
2274-
doc =
2275-
"This is used for naming the output artifacts of actions created by this "
2276-
+ "method. See also the `main_output` arg.",
2277-
positional = false,
2278-
named = true),
2279-
@Param(
2280-
name = "disallow_pic_outputs",
2281-
doc = "Whether PIC outputs should be created.",
2282-
positional = false,
2283-
named = true,
2284-
defaultValue = "False"),
2285-
@Param(
2286-
name = "disallow_nopic_outputs",
2287-
doc = "Whether NOPIC outputs should be created.",
2288-
positional = false,
2289-
named = true,
2290-
defaultValue = "False"),
2291-
@Param(
2292-
name = "additional_include_scanning_roots",
2293-
documented = false,
2294-
positional = false,
2295-
named = true,
2296-
defaultValue = "[]"),
2297-
@Param(
2298-
name = "additional_inputs",
2299-
doc = "List of additional files needed for compilation of srcs",
2300-
positional = false,
2301-
named = true,
2302-
defaultValue = "[]"),
2303-
@Param(
2304-
name = "module_map",
2305-
positional = false,
2306-
documented = false,
2307-
defaultValue = "unbound",
2308-
allowedTypes = {
2309-
@ParamType(type = CppModuleMapApi.class),
2310-
@ParamType(type = NoneType.class)
2311-
},
2312-
named = true),
2313-
@Param(
2314-
name = "additional_module_maps",
2315-
positional = false,
2316-
documented = false,
2317-
defaultValue = "unbound",
2318-
allowedTypes = {@ParamType(type = Sequence.class, generic1 = CppModuleMapApi.class)},
2319-
named = true),
2320-
@Param(
2321-
name = "propagate_module_map_to_compile_action",
2322-
positional = false,
2323-
named = true,
2324-
documented = false,
2325-
allowedTypes = {@ParamType(type = Boolean.class)},
2326-
defaultValue = "unbound"),
2327-
@Param(
2328-
name = "do_not_generate_module_map",
2329-
positional = false,
2330-
named = true,
2331-
documented = false,
2332-
allowedTypes = {@ParamType(type = Boolean.class)},
2333-
defaultValue = "unbound"),
2334-
@Param(
2335-
name = "code_coverage_enabled",
2336-
positional = false,
2337-
named = true,
2338-
documented = false,
2339-
allowedTypes = {@ParamType(type = Boolean.class)},
2340-
defaultValue = "unbound"),
2341-
@Param(
2342-
name = "hdrs_checking_mode",
2343-
positional = false,
2344-
named = true,
2345-
documented = false,
2346-
allowedTypes = {@ParamType(type = String.class), @ParamType(type = NoneType.class)},
2347-
defaultValue = "unbound"),
2348-
@Param(
2349-
name = "variables_extension",
2350-
positional = false,
2351-
named = true,
2352-
documented = false,
2353-
allowedTypes = {@ParamType(type = Dict.class)},
2354-
defaultValue = "unbound"),
2355-
@Param(
2356-
name = "language",
2357-
positional = false,
2358-
named = true,
2359-
documented = false,
2360-
allowedTypes = {@ParamType(type = String.class), @ParamType(type = NoneType.class)},
2361-
defaultValue = "unbound"),
2362-
@Param(
2363-
name = "purpose",
2364-
documented = false,
2365-
positional = false,
2366-
named = true,
2367-
allowedTypes = {@ParamType(type = String.class), @ParamType(type = NoneType.class)},
2368-
defaultValue = "unbound"),
2369-
@Param(
2370-
name = "copts_filter",
2371-
documented = false,
2372-
positional = false,
2373-
named = true,
2374-
allowedTypes = {@ParamType(type = String.class), @ParamType(type = NoneType.class)},
2375-
defaultValue = "unbound"),
2376-
@Param(
2377-
name = "separate_module_headers",
2378-
documented = false,
2379-
positional = false,
2380-
named = true,
2381-
allowedTypes = {@ParamType(type = Sequence.class)},
2382-
defaultValue = "unbound"),
2383-
@Param(
2384-
name = "non_compilation_additional_inputs",
2385-
positional = false,
2386-
named = true,
2387-
allowedTypes = {@ParamType(type = Sequence.class, generic1 = Artifact.class)},
2388-
documented = false,
2389-
defaultValue = "unbound"),
2390-
})
2102+
@Override
23912103
@SuppressWarnings("unchecked")
23922104
public Tuple compile(
23932105
StarlarkActionFactory starlarkActionFactoryApi,

0 commit comments

Comments
 (0)