Merge "Create empty .a on Darwin when there is no obj file." am: 1e45ef6823
am: 5a3c5a3217
* commit '5a3c5a32171687c2b036ca3f0f478e38859a197f':
Create empty .a on Darwin when there is no obj file.
Change-Id: I1b3eee7a74d788f7ae9817ed700acf9a5eba8ff6
This commit is contained in:
@@ -88,7 +88,7 @@ var (
|
|||||||
darwinAppendAr = pctx.StaticRule("darwinAppendAr",
|
darwinAppendAr = pctx.StaticRule("darwinAppendAr",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: "cp -f ${inAr} ${out}.tmp && ${macArPath} $arFlags ${out}.tmp $in && mv ${out}.tmp ${out}",
|
Command: "cp -f ${inAr} ${out}.tmp && ${macArPath} $arFlags ${out}.tmp $in && mv ${out}.tmp ${out}",
|
||||||
CommandDeps: []string{"${macArPath}"},
|
CommandDeps: []string{"${macArPath}", "${inAr}"},
|
||||||
Description: "ar $out",
|
Description: "ar $out",
|
||||||
},
|
},
|
||||||
"arFlags", "inAr")
|
"arFlags", "inAr")
|
||||||
@@ -120,6 +120,12 @@ var (
|
|||||||
},
|
},
|
||||||
"args", "crossCompile")
|
"args", "crossCompile")
|
||||||
|
|
||||||
|
emptyFile = pctx.StaticRule("emptyFile",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: "rm -f $out && touch $out",
|
||||||
|
Description: "empty file $out",
|
||||||
|
})
|
||||||
|
|
||||||
copyGccLibPath = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh")
|
copyGccLibPath = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh")
|
||||||
|
|
||||||
copyGccLib = pctx.StaticRule("copyGccLib",
|
copyGccLib = pctx.StaticRule("copyGccLib",
|
||||||
@@ -261,6 +267,37 @@ func TransformDarwinObjToStaticLib(ctx common.AndroidModuleContext, objFiles com
|
|||||||
|
|
||||||
arFlags := "cqs"
|
arFlags := "cqs"
|
||||||
|
|
||||||
|
if len(objFiles) == 0 {
|
||||||
|
dummy := common.PathForModuleOut(ctx, "dummy" + objectExtension)
|
||||||
|
dummyAr := common.PathForModuleOut(ctx, "dummy" + staticLibraryExtension)
|
||||||
|
|
||||||
|
ctx.ModuleBuild(pctx, common.ModuleBuildParams{
|
||||||
|
Rule: emptyFile,
|
||||||
|
Output: dummy,
|
||||||
|
})
|
||||||
|
|
||||||
|
ctx.ModuleBuild(pctx, common.ModuleBuildParams{
|
||||||
|
Rule: darwinAr,
|
||||||
|
Output: dummyAr,
|
||||||
|
Input: dummy,
|
||||||
|
Args: map[string]string{
|
||||||
|
"arFlags": arFlags,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
ctx.ModuleBuild(pctx, common.ModuleBuildParams{
|
||||||
|
Rule: darwinAppendAr,
|
||||||
|
Output: outputPath,
|
||||||
|
Input: dummy,
|
||||||
|
Args: map[string]string{
|
||||||
|
"arFlags": "d",
|
||||||
|
"inAr": dummyAr.String(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// ARG_MAX on darwin is 262144, use half that to be safe
|
// ARG_MAX on darwin is 262144, use half that to be safe
|
||||||
objFilesLists, err := splitListForSize(objFiles.Strings(), 131072)
|
objFilesLists, err := splitListForSize(objFiles.Strings(), 131072)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -291,7 +328,6 @@ func TransformDarwinObjToStaticLib(ctx common.AndroidModuleContext, objFiles com
|
|||||||
Rule: darwinAppendAr,
|
Rule: darwinAppendAr,
|
||||||
Outputs: []string{out},
|
Outputs: []string{out},
|
||||||
Inputs: l,
|
Inputs: l,
|
||||||
Implicits: []string{in},
|
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"arFlags": arFlags,
|
"arFlags": arFlags,
|
||||||
"inAr": in,
|
"inAr": in,
|
||||||
|
Reference in New Issue
Block a user