Update comments in genrule.go.
Test: Noop Change-Id: Ib341899ea0f04e059d5471ee6e5bff8ebba82583
This commit is contained in:
@@ -665,7 +665,7 @@ func (p DirectorySortedPaths) PathsInDirectory(dir string) Paths {
|
|||||||
return Paths(ret)
|
return Paths(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WritablePaths is a slice of WritablePaths, used for multiple outputs.
|
// WritablePaths is a slice of WritablePath, used for multiple outputs.
|
||||||
type WritablePaths []WritablePath
|
type WritablePaths []WritablePath
|
||||||
|
|
||||||
// Strings returns the string forms of the writable paths.
|
// Strings returns the string forms of the writable paths.
|
||||||
|
@@ -12,6 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
// A genrule module takes a list of source files ("srcs" property), an optional
|
||||||
|
// list of tools ("tools" property), and a command line ("cmd" property), to
|
||||||
|
// generate output files ("out" property).
|
||||||
|
|
||||||
package genrule
|
package genrule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -47,6 +51,8 @@ func RegisterGenruleBuildComponents(ctx android.RegistrationContext) {
|
|||||||
var (
|
var (
|
||||||
pctx = android.NewPackageContext("android/soong/genrule")
|
pctx = android.NewPackageContext("android/soong/genrule")
|
||||||
|
|
||||||
|
// Used by gensrcs when there is more than 1 shard to merge the outputs
|
||||||
|
// of each shard into a zip file.
|
||||||
gensrcsMerge = pctx.AndroidStaticRule("gensrcsMerge", blueprint.RuleParams{
|
gensrcsMerge = pctx.AndroidStaticRule("gensrcsMerge", blueprint.RuleParams{
|
||||||
Command: "${soongZip} -o ${tmpZip} @${tmpZip}.rsp && ${zipSync} -d ${genDir} ${tmpZip}",
|
Command: "${soongZip} -o ${tmpZip} @${tmpZip}.rsp && ${zipSync} -d ${genDir} ${tmpZip}",
|
||||||
CommandDeps: []string{"${soongZip}", "${zipSync}"},
|
CommandDeps: []string{"${soongZip}", "${zipSync}"},
|
||||||
@@ -115,6 +121,7 @@ type generatorProperties struct {
|
|||||||
// Properties for Bazel migration purposes.
|
// Properties for Bazel migration purposes.
|
||||||
bazel.Properties
|
bazel.Properties
|
||||||
}
|
}
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
@@ -127,6 +134,9 @@ type Module struct {
|
|||||||
|
|
||||||
properties generatorProperties
|
properties generatorProperties
|
||||||
|
|
||||||
|
// For the different tasks that genrule and gensrc generate. genrule will
|
||||||
|
// generate 1 task, and gensrc will generate 1 or more tasks based on the
|
||||||
|
// number of shards the input files are sharded into.
|
||||||
taskGenerator taskFunc
|
taskGenerator taskFunc
|
||||||
|
|
||||||
deps android.Paths
|
deps android.Paths
|
||||||
@@ -151,11 +161,12 @@ type generateTask struct {
|
|||||||
in android.Paths
|
in android.Paths
|
||||||
out android.WritablePaths
|
out android.WritablePaths
|
||||||
depFile android.WritablePath
|
depFile android.WritablePath
|
||||||
copyTo android.WritablePaths
|
copyTo android.WritablePaths // For gensrcs to set on gensrcsMerge rule.
|
||||||
genDir android.WritablePath
|
genDir android.WritablePath
|
||||||
extraTools android.Paths // dependencies on tools used by the generator
|
extraTools android.Paths // dependencies on tools used by the generator
|
||||||
|
|
||||||
cmd string
|
cmd string
|
||||||
|
// For gensrsc sharding.
|
||||||
shard int
|
shard int
|
||||||
shards int
|
shards int
|
||||||
}
|
}
|
||||||
@@ -324,6 +335,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
var outputFiles android.WritablePaths
|
var outputFiles android.WritablePaths
|
||||||
var zipArgs strings.Builder
|
var zipArgs strings.Builder
|
||||||
|
|
||||||
|
// Generate tasks, either from genrule or gensrcs.
|
||||||
for _, task := range g.taskGenerator(ctx, String(g.properties.Cmd), srcFiles) {
|
for _, task := range g.taskGenerator(ctx, String(g.properties.Cmd), srcFiles) {
|
||||||
if len(task.out) == 0 {
|
if len(task.out) == 0 {
|
||||||
ctx.ModuleErrorf("must have at least one output file")
|
ctx.ModuleErrorf("must have at least one output file")
|
||||||
|
Reference in New Issue
Block a user