Skip to content

Commit fd6ba2d

Browse files
committed
AIRPlatform, AIRHelper: add -aab and -android-studio options for lime build air -android to create non-apk packages
Consolidate file extension selection into AIRHelper.build() too, since it depends on which target is selected now
1 parent 9f43e55 commit fd6ba2d

File tree

2 files changed

+80
-30
lines changed

2 files changed

+80
-30
lines changed

src/lime/tools/AIRHelper.hx

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,13 @@ import sys.FileSystem;
55

66
class AIRHelper
77
{
8-
public static function build(project:HXProject, workingDirectory:String, targetPlatform:Platform, targetPath:String, applicationXML:String,
8+
public static function build(project:HXProject, workingDirectory:String, targetPlatform:Platform, targetPathWithoutExtension:String, applicationXML:String,
99
files:Array<String>, fileDirectory:String = null):String
1010
{
11-
// var airTarget = "air";
12-
// var extension = ".air";
1311
var airTarget = "bundle";
14-
var extension = "";
1512

16-
switch (targetPlatform)
13+
switch(targetPlatform)
1714
{
18-
case MAC:
19-
20-
if (airTarget == "bundle")
21-
{
22-
extension = ".app";
23-
}
24-
2515
case IOS:
2616
if (project.targetFlags.exists("simulator"))
2717
{
@@ -75,19 +65,84 @@ class AIRHelper
7565
}
7666
}
7767

78-
// extension = ".ipa";
68+
case ANDROID:
69+
if (project.targetFlags.exists("aab"))
70+
{
71+
if (project.debug)
72+
{
73+
airTarget = "aab-debug";
74+
}
75+
else
76+
{
77+
airTarget = "aab";
78+
}
79+
}
80+
else if (project.targetFlags.exists("android-studio"))
81+
{
82+
if (project.debug)
83+
{
84+
airTarget = "android-studio-debug";
85+
}
86+
else
87+
{
88+
airTarget = "android-studio";
89+
}
90+
}
91+
else
92+
{
93+
if (project.debug)
94+
{
95+
airTarget = "apk-debug";
96+
}
97+
else
98+
{
99+
airTarget = "apk";
100+
}
101+
}
102+
103+
default:
104+
}
105+
106+
var extension = "";
107+
108+
switch (targetPlatform)
109+
{
110+
case WINDOWS:
111+
112+
if (airTarget == "air")
113+
{
114+
extension = ".air";
115+
}
116+
117+
case MAC:
118+
119+
if (airTarget == "bundle")
120+
{
121+
extension = ".app";
122+
}
123+
else if (airTarget == "air")
124+
{
125+
extension = ".air";
126+
}
79127

80128
case ANDROID:
81-
if (project.debug)
129+
130+
if (StringTools.startsWith(airTarget, "aab"))
82131
{
83-
airTarget = "apk-debug";
132+
extension = ".aab";
133+
}
134+
else if (StringTools.startsWith(airTarget, "android-studio"))
135+
{
136+
// no extension
84137
}
85138
else
86139
{
87-
airTarget = "apk";
140+
extension = ".apk";
88141
}
89142

90-
// extension = ".apk";
143+
case IOS:
144+
145+
extension = ".ipa";
91146

92147
default:
93148
}
@@ -188,7 +243,7 @@ class AIRHelper
188243
}
189244
}
190245

191-
args = args.concat([targetPath + extension, applicationXML]);
246+
args = args.concat([targetPathWithoutExtension + extension, applicationXML]);
192247

193248
if (targetPlatform == IOS && System.hostPlatform == MAC && project.targetFlags.exists("simulator"))
194249
{
@@ -236,7 +291,7 @@ class AIRHelper
236291

237292
System.runCommand(workingDirectory, project.defines.get("AIR_SDK") + "/bin/adt", args);
238293

239-
return targetPath + extension;
294+
return targetPathWithoutExtension + extension;
240295
}
241296

242297
public static function getExtDirs(project:HXProject):Array<String>

tools/platforms/AIRPlatform.hx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,9 @@ class AIRPlatform extends FlashPlatform
157157
files.push(splashScreen.path);
158158
}
159159

160-
var targetPath = switch (targetPlatform)
161-
{
162-
case ANDROID: "bin/" + project.app.file + ".apk";
163-
case IOS: "bin/" + project.app.file + ".ipa";
164-
default: "bin/" + project.app.file + ".air";
165-
}
160+
var targetPathWithoutExtension = "bin/" + project.app.file;
166161

167-
AIRHelper.build(project, targetDirectory, targetPlatform, targetPath, "application.xml", files, "bin");
162+
AIRHelper.build(project, targetDirectory, targetPlatform, targetPathWithoutExtension, "application.xml", files, "bin");
168163
}
169164
}
170165

@@ -196,19 +191,19 @@ class AIRPlatform extends FlashPlatform
196191
name += " (macOS)";
197192

198193
case IOS:
199-
name += " (iOS).ipa";
194+
name += " (iOS)";
200195

201196
case ANDROID:
202-
name += " (Android).apk";
197+
name += " (Android)";
203198

204199
default:
205200
}
206201

207-
var outputPath = "dist/" + name;
202+
var outputPathWithoutExtension = "dist/" + name;
208203

209204
System.mkdir(targetDirectory + "/dist");
210205

211-
outputPath = AIRHelper.build(project, targetDirectory, targetPlatform, outputPath, "application.xml", files, "bin");
206+
var outputPath = AIRHelper.build(project, targetDirectory, targetPlatform, outputPathWithoutExtension, "application.xml", files, "bin");
212207

213208
if (targetPlatformType == DESKTOP)
214209
{

0 commit comments

Comments
 (0)