@@ -60,28 +60,15 @@ public class BuildApk : AndroidTask
60
60
61
61
public ITaskItem [ ] BundleNativeLibraries { get ; set ; }
62
62
63
- public ITaskItem [ ] TypeMappings { get ; set ; }
64
-
65
- [ Required ]
66
- public ITaskItem [ ] DalvikClasses { get ; set ; }
67
-
68
63
[ Required ]
69
64
public string [ ] SupportedAbis { get ; set ; }
70
65
71
66
public bool EmbedAssemblies { get ; set ; }
72
67
73
68
public bool BundleAssemblies { get ; set ; }
74
69
75
- public ITaskItem [ ] JavaSourceFiles { get ; set ; }
76
-
77
- public ITaskItem [ ] JavaLibraries { get ; set ; }
78
-
79
70
public string [ ] DoNotPackageJavaLibraries { get ; set ; }
80
71
81
- public string [ ] ExcludeFiles { get ; set ; }
82
-
83
- public string [ ] IncludeFiles { get ; set ; }
84
-
85
72
public string Debug { get ; set ; }
86
73
87
74
public string AndroidSequencePointsMode { get ; set ; }
@@ -101,10 +88,6 @@ public class BuildApk : AndroidTask
101
88
102
89
public bool UseAssemblyStore { get ; set ; }
103
90
104
- public string ZipFlushFilesLimit { get ; set ; }
105
-
106
- public string ZipFlushSizeLimit { get ; set ; }
107
-
108
91
public int ZipAlignmentPages { get ; set ; } = AndroidZipAlign . DefaultZipAlignment64Bit ;
109
92
110
93
[ Required ]
@@ -134,39 +117,20 @@ bool _Debug {
134
117
135
118
SequencePointsMode sequencePointsMode = SequencePointsMode . None ;
136
119
137
- public ITaskItem [ ] LibraryProjectJars { get ; set ; }
138
120
HashSet < string > uncompressedFileExtensions ;
139
121
140
- // Do not use trailing / in the path
141
- public string RootPath { get ; set ; } = "" ;
142
-
143
- public string DalvikPath { get ; set ; } = "" ;
144
-
145
122
protected virtual CompressionMethod UncompressedMethod => CompressionMethod . Store ;
146
123
147
124
protected virtual void FixupArchive ( ZipArchiveFileListBuilder zip ) { }
148
125
149
126
List < string > existingEntries = new List < string > ( ) ;
150
127
151
- List < Regex > excludePatterns = new List < Regex > ( ) ;
152
-
153
- List < Regex > includePatterns = new List < Regex > ( ) ;
154
-
155
128
void ExecuteWithAbi ( DSOWrapperGenerator . Config dsoWrapperConfig , string [ ] supportedAbis , string apkInputPath , string apkOutputPath , bool debug , bool compress , IDictionary < AndroidTargetArch , Dictionary < string , CompressedAssemblyInfo > > compressedAssembliesInfo , string assemblyStoreApkName )
156
129
{
157
130
ArchiveFileList files = new ArchiveFileList ( ) ;
158
131
159
132
using ( var apk = new ZipArchiveFileListBuilder ( apkOutputPath , File . Exists ( apkOutputPath ) ? FileMode . Open : FileMode . Create ) ) {
160
133
161
- // Add classes.dx
162
- CompressionMethod dexCompressionMethod = GetCompressionMethod ( ".dex" ) ;
163
- foreach ( var dex in DalvikClasses ) {
164
- string apkName = dex . GetMetadata ( "ApkName" ) ;
165
- string dexPath = string . IsNullOrWhiteSpace ( apkName ) ? Path . GetFileName ( dex . ItemSpec ) : apkName ;
166
- AddFileToArchiveIfNewer ( apk , dex . ItemSpec , DalvikPath + dexPath , compressionMethod : dexCompressionMethod ) ;
167
- apk . Flush ( ) ;
168
- }
169
-
170
134
if ( EmbedAssemblies ) {
171
135
AddAssemblies ( dsoWrapperConfig , apk , debug , compress , compressedAssembliesInfo , assemblyStoreApkName ) ;
172
136
apk . Flush ( ) ;
@@ -178,12 +142,6 @@ void ExecuteWithAbi (DSOWrapperGenerator.Config dsoWrapperConfig, string [] supp
178
142
AddNativeLibraries ( files , supportedAbis ) ;
179
143
AddAdditionalNativeLibraries ( files , supportedAbis ) ;
180
144
181
- if ( TypeMappings != null ) {
182
- foreach ( ITaskItem typemap in TypeMappings ) {
183
- AddFileToArchiveIfNewer ( apk , typemap . ItemSpec , RootPath + Path . GetFileName ( typemap . ItemSpec ) , compressionMethod : UncompressedMethod ) ;
184
- }
185
- }
186
-
187
145
foreach ( var file in files ) {
188
146
var item = Path . Combine ( file . archivePath . Replace ( Path . DirectorySeparatorChar , '/' ) ) ;
189
147
existingEntries . Remove ( item ) ;
@@ -196,63 +154,6 @@ void ExecuteWithAbi (DSOWrapperGenerator.Config dsoWrapperConfig, string [] supp
196
154
apk . AddFileAndFlush ( file . filePath , item , compressionMethod : compressionMethod ) ;
197
155
}
198
156
199
- var jarFiles = ( JavaSourceFiles != null ) ? JavaSourceFiles . Where ( f => f . ItemSpec . EndsWith ( ".jar" , StringComparison . OrdinalIgnoreCase ) ) : null ;
200
- if ( jarFiles != null && JavaLibraries != null )
201
- jarFiles = jarFiles . Concat ( JavaLibraries ) ;
202
- else if ( JavaLibraries != null )
203
- jarFiles = JavaLibraries ;
204
-
205
- var libraryProjectJars = MonoAndroidHelper . ExpandFiles ( LibraryProjectJars )
206
- . Where ( jar => ! MonoAndroidHelper . IsEmbeddedReferenceJar ( jar ) ) ;
207
-
208
- var jarFilePaths = libraryProjectJars . Concat ( jarFiles != null ? jarFiles . Select ( j => j . ItemSpec ) : Enumerable . Empty < string > ( ) ) ;
209
- jarFilePaths = MonoAndroidHelper . DistinctFilesByContent ( jarFilePaths ) ;
210
-
211
- foreach ( var jarFile in jarFilePaths ) {
212
- using ( var stream = File . OpenRead ( jarFile ) )
213
- using ( var jar = ZipArchive . Open ( stream ) ) {
214
- foreach ( var jarItem in jar ) {
215
- if ( jarItem . IsDirectory )
216
- continue ;
217
- var name = jarItem . FullName ;
218
- if ( ! PackagingUtils . CheckEntryForPackaging ( name ) ) {
219
- continue ;
220
- }
221
- var path = RootPath + name ;
222
- existingEntries . Remove ( path ) ;
223
- if ( apk . SkipExistingEntry ( jarItem , path ) ) {
224
- Log . LogDebugMessage ( $ "Skipping { path } as the archive file is up to date.") ;
225
- continue ;
226
- }
227
- // check for ignored items
228
- bool exclude = false ;
229
- bool forceInclude = false ;
230
- foreach ( var include in includePatterns ) {
231
- if ( include . IsMatch ( path ) ) {
232
- forceInclude = true ;
233
- break ;
234
- }
235
- }
236
- if ( ! forceInclude ) {
237
- foreach ( var pattern in excludePatterns ) {
238
- if ( pattern . IsMatch ( path ) ) {
239
- Log . LogDebugMessage ( $ "Ignoring jar entry '{ name } ' from '{ Path . GetFileName ( jarFile ) } '. Filename matched the exclude pattern '{ pattern } '.") ;
240
- exclude = true ;
241
- break ;
242
- }
243
- }
244
- }
245
- if ( exclude )
246
- continue ;
247
- if ( string . Compare ( Path . GetFileName ( name ) , "AndroidManifest.xml" , StringComparison . OrdinalIgnoreCase ) == 0 ) {
248
- Log . LogDebugMessage ( "Ignoring jar entry {0} from {1}: the same file already exists in the apk" , name , Path . GetFileName ( jarFile ) ) ;
249
- continue ;
250
- }
251
-
252
- apk . AddJavaEntryAndFlush ( jarFile , jarItem . FullName , path ) ;
253
- }
254
- }
255
- }
256
157
FixupArchive ( apk ) ;
257
158
258
159
OutputApkFiles = apk . ApkFiles . ToArray ( ) ;
@@ -280,13 +181,6 @@ public override bool RunTask ()
280
181
281
182
existingEntries . Clear ( ) ;
282
183
283
- foreach ( var pattern in ExcludeFiles ?? Array . Empty < string > ( ) ) {
284
- excludePatterns . Add ( FileGlobToRegEx ( pattern , RegexOptions . IgnoreCase | RegexOptions . Compiled ) ) ;
285
- }
286
- foreach ( var pattern in IncludeFiles ?? Array . Empty < string > ( ) ) {
287
- includePatterns . Add ( FileGlobToRegEx ( pattern , RegexOptions . IgnoreCase | RegexOptions . Compiled ) ) ;
288
- }
289
-
290
184
bool debug = _Debug ;
291
185
bool compress = ! debug && EnableCompression ;
292
186
IDictionary < AndroidTargetArch , Dictionary < string , CompressedAssemblyInfo > > compressedAssembliesInfo = null ;
@@ -311,24 +205,6 @@ public override bool RunTask ()
311
205
return ! Log . HasLoggedErrors ;
312
206
}
313
207
314
- static Regex FileGlobToRegEx ( string fileGlob , RegexOptions options )
315
- {
316
- StringBuilder sb = new StringBuilder ( ) ;
317
- foreach ( char c in fileGlob ) {
318
- switch ( c ) {
319
- case '*' : sb . Append ( ".*" ) ;
320
- break ;
321
- case '?' : sb . Append ( "." ) ;
322
- break ;
323
- case '.' : sb . Append ( @"\." ) ;
324
- break ;
325
- default : sb . Append ( c ) ;
326
- break ;
327
- }
328
- }
329
- return new Regex ( sb . ToString ( ) , options ) ;
330
- }
331
-
332
208
void AddRuntimeConfigBlob ( DSOWrapperGenerator . Config dsoWrapperConfig , ZipArchiveFileListBuilder apk )
333
209
{
334
210
// We will place rc.bin in the `lib` directory next to the blob, to make startup slightly faster, as we will find the config file right after we encounter
0 commit comments