/// <summary> /// Compile all methods to the target platform. /// </summary> void ITargetPackage.CompileToTarget(bool generateDebugInfo, MapFile mapFile) { compiledMethods.ForEach(x => x.CompileToTarget(this, generateDebugInfo, mapFile)); if (mapFile != null && generatedCodeClass != null) { // Only generate the type name; the methods are generated under their respective type. var typeEntry = new TypeEntry("(generated)", "(none)", generatedCodeClass.Fullname, -1); mapFile.Add(typeEntry); } }
/// <summary> /// Record the mapping from .NET to Dex /// </summary> public void RecordMapping(MapFile mapFile) { var dexName = (classDef != null) ? classDef.Fullname : null; var mapFileId = (classDef != null) ? classDef.MapFileId : 0; var entry = new TypeEntry(typeDef.ClassName, "<java>", dexName, mapFileId); if (fieldBuilders != null) { fieldBuilders.ForEach(x => x.RecordMapping(entry)); } if (methodBuilders != null) { methodBuilders.ForEach(x => x.RecordMapping(entry)); } mapFile.Add(entry); }
public override void RecordMapping(MapFile mapFile) { base.RecordMapping(mapFile); // create the mapping for all our instance type. foreach (var instance in delegateType.Instances) { // Create mapping var dexName = instance.InstanceDefinition.Fullname; var mapFileId = instance.InstanceDefinition.MapFileId; var scopeId = XType.ScopeId.Substring(XType.ScopeId.IndexOf(':') + 1); scopeId += ":delegate:" + instance.CalledMethod.DeclaringType.ScopeId + "|" + instance.CalledMethod.ScopeId; var entry = new TypeEntry(Type.FullName, Type.Scope.Name, dexName, mapFileId, scopeId); mapFile.Add(entry); } }
/// <summary> /// Merge the given set of map files into 1. /// </summary> private static MapFile MergeMapFiles(List <MapFile> mapFiles) { if (mapFiles.Count == 0) { return(new MapFile()); } if (mapFiles.Count == 1) { return(mapFiles[0]); } var result = new MapFile(); foreach (var entry in mapFiles.SelectMany(mapFile => mapFile.TypeEntries)) { result.Add(entry); } return(result); }
/// <summary> /// Record the mapping from .NET to Dex /// </summary> public virtual void RecordMapping(MapFile mapFile) { var entry = CreateMappingEntry(); mapFile.Add(entry); if (fieldBuilders != null) { fieldBuilders.ForEach(x => x.RecordMapping(entry)); } if (methodBuilders != null) { methodBuilders.ForEach(x => x.RecordMapping(entry, mapFile)); } // Create mapping of nested classes if (nestedBuilders != null) { nestedBuilders.ForEach(x => x.RecordMapping(mapFile)); } }
private void RecordScopeMapping(ReachableContext reachableContext) { foreach (var scope in reachableContext.ReachableTypes.GroupBy(g => g.Scope, g => g.Module.Assembly)) { var assm = scope.Distinct().ToList(); if (assm.Count > 1) { DLog.Warning(DContext.CompilerCodeGenerator, "More than one assembly for scope {0}", scope.Key.Name); // let's not risk a wrong mapping. continue; } var filename = assemblyToFilename(assm.First()); if (filename != null) { var scopeEntry = new ScopeEntry(scope.Key.Name, filename, File.GetLastWriteTimeUtc(filename), Hash.HashFileMD5(filename)); mapFile.Add(scopeEntry); } } }
/// <summary> /// Record the mapping from .NET to Dex /// </summary> public void RecordMapping(MapFile mapFile) { // Create mapping var dexName = (classDef != null) ? classDef.Fullname : null; var mapFileId = (classDef != null) ? classDef.MapFileId : 0; var entry = new TypeEntry(typeDef.FullName, typeDef.Scope.Name, dexName, mapFileId); if (fieldBuilders != null) { fieldBuilders.ForEach(x => x.RecordMapping(entry)); } if (methodBuilders != null) { methodBuilders.ForEach(x => x.RecordMapping(entry)); } mapFile.Add(entry); // Create mapping of nested classes if (nestedBuilders != null) { nestedBuilders.ForEach(x => x.RecordMapping(mapFile)); } }