Loading sdk/bp_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ func TestTransformRemoveProperty(t *testing.T) { contents := &generatedContents{} outputPropertySet(contents, set) helper.AssertTrimmedStringEquals("removing property failed", "name: \"name\",\\n", contents.content.String()) helper.AssertTrimmedStringEquals("removing property failed", "name: \"name\",\n", contents.content.String()) } func TestTransformRemovePropertySet(t *testing.T) { Loading @@ -72,5 +72,5 @@ func TestTransformRemovePropertySet(t *testing.T) { contents := &generatedContents{} outputPropertySet(contents, set) helper.AssertTrimmedStringEquals("removing property set failed", "name: \"name\",\\n", contents.content.String()) helper.AssertTrimmedStringEquals("removing property set failed", "name: \"name\",\n", contents.content.String()) } sdk/testing.go +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ type testSdkResult struct { // e.g. find the src/dest pairs from each cp command, the various zip files // generated, etc. func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo { androidBpContents := strings.NewReplacer("\\n", "\n").Replace(sdk.GetAndroidBpContentsForTests()) androidBpContents := sdk.GetAndroidBpContentsForTests() info := &snapshotBuildInfo{ r: r, Loading sdk/update.go +11 −6 Original line number Diff line number Diff line Loading @@ -87,18 +87,23 @@ func (gc *generatedContents) Dedent() { } func (gc *generatedContents) Printfln(format string, args ...interface{}) { // ninja consumes newline characters in rspfile_content. Prevent it by // escaping the backslash in the newline character. The extra backslash // is removed when the rspfile is written to the actual script file fmt.Fprintf(&(gc.content), strings.Repeat(" ", gc.indentLevel)+format+"\\n", args...) fmt.Fprintf(&(gc.content), strings.Repeat(" ", gc.indentLevel)+format+"\n", args...) } func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderContext, implicits android.Paths) { rb := android.NewRuleBuilder() // convert \\n to \n content := gf.content.String() // ninja consumes newline characters in rspfile_content. Prevent it by // escaping the backslash in the newline character. The extra backslash // is removed when the rspfile is written to the actual script file content = strings.ReplaceAll(content, "\n", "\\n") rb.Command(). Implicits(implicits). Text("echo").Text(proptools.ShellEscape(gf.content.String())). Text("echo").Text(proptools.ShellEscape(content)). // convert \\n to \n Text("| sed 's/\\\\n/\\n/g' >").Output(gf.path) rb.Command(). Text("chmod a+x").Output(gf.path) Loading Loading
sdk/bp_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ func TestTransformRemoveProperty(t *testing.T) { contents := &generatedContents{} outputPropertySet(contents, set) helper.AssertTrimmedStringEquals("removing property failed", "name: \"name\",\\n", contents.content.String()) helper.AssertTrimmedStringEquals("removing property failed", "name: \"name\",\n", contents.content.String()) } func TestTransformRemovePropertySet(t *testing.T) { Loading @@ -72,5 +72,5 @@ func TestTransformRemovePropertySet(t *testing.T) { contents := &generatedContents{} outputPropertySet(contents, set) helper.AssertTrimmedStringEquals("removing property set failed", "name: \"name\",\\n", contents.content.String()) helper.AssertTrimmedStringEquals("removing property set failed", "name: \"name\",\n", contents.content.String()) }
sdk/testing.go +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ type testSdkResult struct { // e.g. find the src/dest pairs from each cp command, the various zip files // generated, etc. func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo { androidBpContents := strings.NewReplacer("\\n", "\n").Replace(sdk.GetAndroidBpContentsForTests()) androidBpContents := sdk.GetAndroidBpContentsForTests() info := &snapshotBuildInfo{ r: r, Loading
sdk/update.go +11 −6 Original line number Diff line number Diff line Loading @@ -87,18 +87,23 @@ func (gc *generatedContents) Dedent() { } func (gc *generatedContents) Printfln(format string, args ...interface{}) { // ninja consumes newline characters in rspfile_content. Prevent it by // escaping the backslash in the newline character. The extra backslash // is removed when the rspfile is written to the actual script file fmt.Fprintf(&(gc.content), strings.Repeat(" ", gc.indentLevel)+format+"\\n", args...) fmt.Fprintf(&(gc.content), strings.Repeat(" ", gc.indentLevel)+format+"\n", args...) } func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderContext, implicits android.Paths) { rb := android.NewRuleBuilder() // convert \\n to \n content := gf.content.String() // ninja consumes newline characters in rspfile_content. Prevent it by // escaping the backslash in the newline character. The extra backslash // is removed when the rspfile is written to the actual script file content = strings.ReplaceAll(content, "\n", "\\n") rb.Command(). Implicits(implicits). Text("echo").Text(proptools.ShellEscape(gf.content.String())). Text("echo").Text(proptools.ShellEscape(content)). // convert \\n to \n Text("| sed 's/\\\\n/\\n/g' >").Output(gf.path) rb.Command(). Text("chmod a+x").Output(gf.path) Loading