Skip to content

Commit 75023bd

Browse files
dellis1972jonpryor
authored andcommitted
[java-runtime] Remove debug files from java_runtime.jar (#2870)
Commit 121b81a added the new `java_runtime.jar` and `java_runtime_fastdev.jar` files. The idea is that `java_runtime.jar` was the release version of the runtime, and would *not* contain files such as mono/android/ResourcePatcher.class mono/android/Seppuku.class mono/android/MonkeyPatcher.class which are for fast dev only. However we were including these files!! This was because of a couple of problems. 1. The `%(_RuntimeOutput.RemoveItems)` metadata was being treated like an ItemGroup when it is in fact a property. Wwe need to semi-colon `;`-separate the items to make sure they are ALL removed rather then it just being the last one listed. 2. Because the `Inputs` was changed to `@(_RuntimeOutput)` it means the target will run only ONCE. As a result both the `release.txt` and `fastdev.txt` files contained the SAME file list. What we should have been doing was using Target Batching: %(_RuntimeOutput.OutputJar) This makes sure the target runs for EACH output. This will result in the behaviour we want, i.e the files listed above NOT being in the release version of the jar. Finally, change the default value for `MonoPackageManager_Resources.ApiPackageName` from `""` (empty string) to `null`. This was done to allow startup to work; otherwise, [`MonoRuntimeProvider.attachInfo()` could fail][0] if it encounters a non-`null` value which *isn't* an installed package. We don't yet fully understand this failure scenario, but setting `ApiPackageName` to null allows things to work. [0]: https://github.com/xamarin/xamarin-android/blob/ae75aa627de475a5c276ccbc60e9e9f72425aab0/src/Xamarin.Android.Build.Tasks/Resources/MonoRuntimeProvider.Shared.java#L23-L39
1 parent ae75aa6 commit 75023bd

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/java-runtime/java-runtime.targets

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
<OutputDex>$(OutputPath)java_runtime.dex</OutputDex>
77
<IntermediateRuntimeOutputPath>$(IntermediateOutputPath)release</IntermediateRuntimeOutputPath>
88
<IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)release.txt</IntermediateRuntimeClassesTxt>
9-
<RemoveItems>java\mono\android\debug\MultiDexLoader.java</RemoveItems>
10-
<RemoveItems>java\mono\android\MonkeyPatcher.java</RemoveItems>
11-
<RemoveItems>java\mono\android\ResourcePatcher.java</RemoveItems>
12-
<RemoveItems>java\mono\android\Seppuku.java</RemoveItems>
9+
<RemoveItems>java\mono\android\debug\MultiDexLoader.java;java\mono\android\MonkeyPatcher.java;java\mono\android\ResourcePatcher.java;java\mono\android\Seppuku.java</RemoveItems>
1310
</_RuntimeOutput>
1411
<_RuntimeOutput Include="$(OutputPath)java_runtime_fastdev.jar">
1512
<OutputJar>$(OutputPath)java_runtime_fastdev.jar</OutputJar>
@@ -21,7 +18,7 @@
2118
</ItemGroup>
2219
<Target Name="Build"
2320
Inputs="@(AllRuntimeSource)"
24-
Outputs="@(_RuntimeOutput)"
21+
Outputs="%(_RuntimeOutput.OutputJar)"
2522
>
2623
<MakeDir Directories="%(_RuntimeOutput.IntermediateRuntimeOutputPath)" />
2724
<MakeDir Directories="$(OutputPath)" />

src/java-runtime/java/mono/android/MonoPackageManager.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,4 @@ public static String getApiPackageName ()
106106
return MonoPackageManager_Resources.ApiPackageName;
107107
}
108108
}
109-
class MonoPackageManager_Resources {
110-
public static final String[] Assemblies = new String[]{
111-
};
112-
public static final String[] Dependencies = new String[]{
113-
};
114-
public static final String ApiPackageName = "";
115-
}
116109

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package mono;
2+
3+
import java.lang.String;
4+
import java.util.Arrays;
5+
6+
7+
public class MonoPackageManager_Resources {
8+
public static final String[] Assemblies = new String[]{
9+
};
10+
public static final String[] Dependencies = new String[]{
11+
};
12+
public static final String ApiPackageName = null;
13+
}
14+

0 commit comments

Comments
 (0)