Use `Path` instead of string for file paths

This centralizes verification and common operations, like converting the
path to a source file to the path for a built object.

It also embeds the configuration knowledge into the path, so that we can
remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that
leads to paths like './path' instead of just 'path' like make is doing,
causing differences in compiled binaries.

Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
diff --git a/common/env.go b/common/env.go
index 8694c28..478fffc 100644
--- a/common/env.go
+++ b/common/env.go
@@ -15,8 +15,6 @@
 package common
 
 import (
-	"path/filepath"
-
 	"android/soong"
 	"android/soong/env"
 
@@ -43,12 +41,15 @@
 func (c *envSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
 	envDeps := ctx.Config().(Config).EnvDeps()
 
-	envFile := filepath.Join(ctx.Config().(Config).BuildDir(), ".soong.environment")
+	envFile := PathForOutput(ctx, ".soong.environment")
+	if ctx.Failed() {
+		return
+	}
 
-	err := env.WriteEnvFile(envFile, envDeps)
+	err := env.WriteEnvFile(envFile.String(), envDeps)
 	if err != nil {
 		ctx.Errorf(err.Error())
 	}
 
-	ctx.AddNinjaFileDeps(envFile)
+	ctx.AddNinjaFileDeps(envFile.String())
 }