@@ -234,8 +234,8 @@ public void R8WithoutJniObfuscationRetainsBroadRuntimeKeepRules (bool nativeAot)
234234
235235 IEnumerable < string > GetNativeRuntimeJniTypeNames ( )
236236 {
237- string sourceRoot = GetAssemblyMetadataValue ( "XamarinAndroidSourcePath ") ;
238- string headerPath = Path . Combine ( sourceRoot , "src" , "native" , "common" , "include" , "shared" , "runtime-jni-names.hh" ) ;
237+ string auditRoot = Path . Combine ( TestContext . CurrentContext . TestDirectory , "RuntimeJniAudit ") ;
238+ string headerPath = Path . Combine ( auditRoot , "runtime-jni-names.hh" ) ;
239239 string header = File . ReadAllText ( headerPath ) ;
240240 string [ ] names = Regex . Matches ( header , @"std::string_view \w+ \{ ""(?<value>[^""]+)"" \};" )
241241 . Cast < Match > ( )
@@ -245,7 +245,7 @@ IEnumerable<string> GetNativeRuntimeJniTypeNames ()
245245 . Where ( name => name . Contains ( '/' ) )
246246 . ToHashSet ( StringComparer . Ordinal ) ;
247247
248- string runtimeJavaPath = Path . Combine ( sourceRoot , "src" , "java-runtime" , "java" , "mono" , "android" , "Runtime.java" ) ;
248+ string runtimeJavaPath = Path . Combine ( auditRoot , "Runtime.java" ) ;
249249 string runtimeJava = File . ReadAllText ( runtimeJavaPath ) ;
250250 foreach ( string fieldName in names . Where ( name => name . StartsWith ( "mono_android_" , StringComparison . Ordinal ) || name . StartsWith ( "net_dot_jni_" , StringComparison . Ordinal ) ) ) {
251251 Match field = Regex . Match ( runtimeJava , $@ "static java\.lang\.Class { Regex . Escape ( fieldName ) } = (?<type>[\w.]+)\.class;") ;
@@ -254,8 +254,8 @@ IEnumerable<string> GetNativeRuntimeJniTypeNames ()
254254 }
255255
256256 foreach ( string directory in new [ ] {
257- Path . Combine ( sourceRoot , "src " , "native" , "clr ") ,
258- Path . Combine ( sourceRoot , "src " , "native" , "nativeaot ") ,
257+ Path . Combine ( auditRoot , "Native " , "CoreCLR " ) ,
258+ Path . Combine ( auditRoot , "Native " , "NativeAOT " ) ,
259259 } ) {
260260 foreach ( string file in Directory . EnumerateFiles ( directory , "*.cc" , SearchOption . AllDirectories ) ) {
261261 string source = File . ReadAllText ( file ) ;
@@ -266,7 +266,7 @@ IEnumerable<string> GetNativeRuntimeJniTypeNames ()
266266 }
267267 }
268268
269- string javaInteropPath = Path . Combine ( sourceRoot , "external" , "Java.Interop" , "src" , "Java.Interop" , "Java.Interop" ) ;
269+ string javaInteropPath = Path . Combine ( auditRoot , "Java.Interop" ) ;
270270 foreach ( string file in Directory . EnumerateFiles ( javaInteropPath , "*.cs" , SearchOption . TopDirectoryOnly ) ) {
271271 string source = File . ReadAllText ( file ) ;
272272 foreach ( Match match in Regex . Matches ( source , @"JniTypeName\s*=\s*""(?<name>net/dot/jni/(?:ManagedPeer|internal/JavaProxy(?:Object|Throwable)))""" ) ) {
0 commit comments