@@ -562,35 +562,41 @@ describe("Plugins service", () => {
562
562
let appDestinationDirectoryPath = path . join ( projectFolder , "platforms" , "android" ) ;
563
563
fs . ensureDirectoryExists ( path . join ( appDestinationDirectoryPath , "app" ) ) . wait ( ) ;
564
564
565
+ // Mock projectData
566
+ let projectData = testInjector . resolve ( "projectData" ) ;
567
+ projectData . projectId = "com.example.android.basiccontactables" ;
568
+
569
+ let configurationFilePath = path . join ( appDestinationDirectoryPath , "src" , "main" , "AndroidManifest.xml" ) ;
570
+
571
+ let shelljs = require ( "shelljs" ) ;
572
+
565
573
// Mock platformsData
566
574
let platformsData = testInjector . resolve ( "platformsData" ) ;
567
575
platformsData . getPlatformData = ( platform : string ) => {
568
- let androidProjectService = testInjector . resolve ( "androidProjectService" ) ;
569
-
570
576
return {
571
577
appDestinationDirectoryPath : appDestinationDirectoryPath ,
572
578
frameworkPackageName : "tns-android" ,
573
579
configurationFileName : "AndroidManifest.xml" ,
574
- configurationFilePath : path . join ( appDestinationDirectoryPath , "src" , "main" , "AndroidManifest.xml" ) ,
580
+ configurationFilePath : configurationFilePath ,
575
581
relativeToFrameworkConfigurationFilePath : path . join ( "src" , "main" , "AndroidManifest.xml" ) ,
576
582
mergeXmlConfig : [ { "nodename" : "manifest" , "attrname" : "*" } ] ,
577
583
platformProjectService : {
578
584
preparePluginNativeCode : ( pluginData : IPluginData ) => future . fromResult ( ) ,
579
- interpolateConfigurationFile : ( ) => androidProjectService . interpolateConfigurationFile ( )
585
+ interpolateConfigurationFile : ( ) => {
586
+ return ( ( ) => {
587
+ shelljs . sed ( '-i' , / _ _ P A C K A G E _ _ / , projectData . projectId , configurationFilePath ) ;
588
+ shelljs . sed ( '-i' , / _ _ A P I L E V E L _ _ / , "23" , configurationFilePath ) ;
589
+ } ) . future < void > ( ) ( )
590
+ }
580
591
} ,
581
592
normalizedPlatformName : "Android"
582
593
} ;
583
594
} ;
584
595
585
- // Mock projectData
586
- let projectData = testInjector . resolve ( "projectData" ) ;
587
- projectData . projectId = "com.example.android.basiccontactables" ;
588
-
589
596
// Ensure the pluginDestinationPath folder exists
590
597
let pluginPlatformsDirPath = path . join ( projectFolder , "node_modules" , pluginName , "platforms" , "android" ) ;
591
598
fs . ensureDirectoryExists ( pluginPlatformsDirPath ) . wait ( ) ;
592
599
593
- let shelljs = require ( "shelljs" ) ;
594
600
shelljs . cp ( "-R" , path . join ( pluginFolderPath , "*" ) , path . join ( projectFolder , "node_modules" , pluginName ) ) ;
595
601
596
602
// Creates valid plugin's AndroidManifest.xml file
0 commit comments