@@ -88,6 +88,10 @@ def main():
88
88
parser .add_argument ('--swappy' ,
89
89
help = 'Add Swappy support' ,
90
90
action = 'store_true' )
91
+ parser .add_argument ('--activity-name' ,
92
+ help = 'Use custom activity name' )
93
+ parser .add_argument ('--activity-path' ,
94
+ help = 'Path to custom Android activity code' )
91
95
92
96
args = parser .parse_args ()
93
97
abis = ['arm64-v8a' ] if args .abis is None else args .abis
@@ -99,7 +103,7 @@ def main():
99
103
100
104
manifest = os .path .join (gradle_base , 'AndroidManifest.xml' )
101
105
build_gradle = os .path .join (gradle_base , 'build.gradle' )
102
- settings_gradle = os .path .join (gradle_base , 'settings.gradle' )
106
+ settings_gradle = os .path .join (gradle_base , 'settings_custom.gradle' if args . activity_name else ' settings.gradle' )
103
107
toplevel_gradle = os .path .join (gradle_base , 'toplevel.build.gradle' )
104
108
gradle_properties = os .path .join (gradle_base , 'gradle.properties' )
105
109
if (not os .path .isfile (manifest )) or \
@@ -122,10 +126,12 @@ def main():
122
126
123
127
# Write out AndroidManifest.xml
124
128
with open (manifest , 'r' ) as f :
129
+ activity_name = args .activity_name if args .activity_name else 'net.themaister.granite.GraniteActivity'
125
130
manifest_data = f .read ()
126
131
manifest_data = manifest_data \
127
132
.replace ('$$ICON$$' , args .activity_icon_drawable ) \
128
133
.replace ('$$NATIVE_TARGET$$' , args .native_target ) \
134
+ .replace ('$$ACTIVITY_NAME$$' , activity_name ) \
129
135
.replace ('$$VERSION_CODE$$' , args .version_code ) \
130
136
.replace ('$$VERSION_NAME$$' , args .version_name )
131
137
@@ -177,7 +183,8 @@ def main():
177
183
.replace ('$$PHYSICS$$' , 'ON' if args .physics else 'OFF' ) \
178
184
.replace ('$$SHADER_OPTIMIZE$$' , 'ON' if args .optimize else 'OFF' ) \
179
185
.replace ('$$FOSSILIZE$$' , 'ON' if args .fossilize else 'OFF' ) \
180
- .replace ('$$SWAPPY$$' , 'ON' if args .swappy else 'OFF' )
186
+ .replace ('$$SWAPPY$$' , 'ON' if args .swappy else 'OFF' ) \
187
+ .replace ('$$EXTRA_DEPENDENCIES$$' , "api project(':custom:android')" if args .activity_name else '' )
181
188
182
189
with open (target_build_gradle , 'w' ) as dump_file :
183
190
print (data , file = dump_file )
@@ -196,6 +203,10 @@ def main():
196
203
.replace ('$$APP$$' , granite_app ) \
197
204
.replace ('$$GRANITE_ANDROID_ACTIVITY_PATH$$' , granite_android_activity )
198
205
206
+ if args .activity_path :
207
+ android_activity = find_relative_path (output_settings_gradle , args .activity_path )
208
+ data = data .replace ('$$ANDROID_ACTIVITY_PATH$$' , android_activity )
209
+
199
210
with open (output_settings_gradle , 'w' ) as dump_file :
200
211
print (data , file = dump_file )
201
212
0 commit comments