@@ -49,6 +49,8 @@ package
49
49
public class ASConfigC
50
50
{
51
51
private static const ASCONFIG_JSON : String = "asconfig.json" ;
52
+ private static const FILE_EXTENSION_ANE : String = ".ane" ;
53
+ private static const FILE_NAME_UNPACKAGED_ANES : String = ".as3mxml-unpackaged-anes" ;
52
54
53
55
private static const MXMLC_JARS : Vector .< String > = new < String >
54
56
[
@@ -1060,7 +1062,71 @@ package
1060
1062
//the compilerOptions field is not defined, so there's nothing to copy
1061
1063
return ;
1062
1064
}
1063
- console. warn ("Skipping native extension unpackaging step. This option is currently unsupported by asconfigc. To debug with native extensions, you must unpackage them manually." );
1065
+
1066
+ if (CompilerOptions. LIBRARY_PATH in this . _compilerOptionsJSON )
1067
+ {
1068
+ var libraryPathJSON: Array = this . _compilerOptionsJSON [ CompilerOptions. LIBRARY_PATH ] as Array ;
1069
+ this . unpackANEs(libraryPathJSON);
1070
+ }
1071
+ if (CompilerOptions. EXTERNAL_LIBRARY_PATH in this . _compilerOptionsJSON )
1072
+ {
1073
+ var externalLibraryPathJSON: Array = this . _compilerOptionsJSON [ CompilerOptions. EXTERNAL_LIBRARY_PATH ] as Array ;
1074
+ this . unpackANEs(externalLibraryPathJSON);
1075
+ }
1076
+ }
1077
+
1078
+ private function unpackANEs (libraryPathJSON :Array ):void
1079
+ {
1080
+ var pathCount: int = libraryPathJSON. length ;
1081
+ for (var i: int = 0 ; i < pathCount; i++ )
1082
+ {
1083
+ var libraryPath: String = libraryPathJSON[ i] as String ;
1084
+ libraryPath = path. resolve(libraryPath);
1085
+ if (libraryPath. endsWith(FILE_EXTENSION_ANE ))
1086
+ {
1087
+ this . unpackANE(libraryPath);
1088
+ }
1089
+ else if (fs. statSync(libraryPath). isDirectory())
1090
+ {
1091
+ var files: Array = fs. readdirSync(libraryPath);
1092
+ var fileCount: int = files. length ;
1093
+ for (var j: int = 0 ; j < fileCount; j++ )
1094
+ {
1095
+ var file : String = files[ j];
1096
+ var fullPath: String = path. resolve(libraryPath, file );
1097
+ if (fullPath. endsWith(FILE_EXTENSION_ANE ))
1098
+ {
1099
+ this . unpackANE(fullPath);
1100
+ }
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+
1106
+ private function unpackANE (aneFilePath :String ):void
1107
+ {
1108
+ if (fs. statSync(aneFilePath). isDirectory())
1109
+ {
1110
+ //this is either an ANE that's already unpacked
1111
+ //...or something else entirely
1112
+ return ;
1113
+ }
1114
+
1115
+ var outputDir: String = findOutputDirectory(this . _mainFile , this . _outputPath , ! this . _outputIsJS );
1116
+ var unpackedAneDir: String = path. resolve(outputDir, FILE_NAME_UNPACKAGED_ANES );
1117
+ var currentAneDir: String = path. resolve(unpackedAneDir, path. basename(aneFilePath));
1118
+ mkdirp[ "sync" ] (currentAneDir);
1119
+
1120
+ try
1121
+ {
1122
+ var zipFile: admZip = new admZip(aneFilePath);
1123
+ zipFile. extractAllTo(currentAneDir, true );
1124
+ }
1125
+ catch (error : Error )
1126
+ {
1127
+ console. error ("Failed to copy Adobe AIR native extension from path: " + aneFilePath + "." );
1128
+ process. exit (1 );
1129
+ }
1064
1130
}
1065
1131
1066
1132
private function copyAIRFiles ():void
0 commit comments