Don't hold on to WritablePath
Since only a single rule can write to a given WritablePath, it is
unecessary to hold on to the WritablePath once the rule has been
created. Keeping a WritablePath causes complications, as it
prevents using the input Path as the output when no modifications to
the input file are necessary. The normal pattern should be to create
a WritablePath using PathForModuleOut, build the rule that writes to
the WritablePath, and then store the WritablePath as a Path for use
as an input to any future rules.
WithoutRel previously only existed on OutputPath, which required
keeping the output path of the module as an OutputPath for as long
as possible in order to call WithoutRel on it at the end of the module.
Add WithoutRel to Path, make it always return a Path type, and implement
it on all the types that implement Path by using a helper in basePath.
Replace long-lived WritablePaths with Paths.
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I40f28075ce151e4be80d6cfc7ec173dfa46f9bbf
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 7949244..2980bab 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -359,7 +359,7 @@
d.dexpreopt(ctx, libraryName, dexJarFile)
}
-func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJarFile android.WritablePath) {
+func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJarFile android.Path) {
global := dexpreopt.GetGlobalConfig(ctx)
// TODO(b/148690468): The check on d.installPath is to bail out in cases where