Skip to content

Commit fdcc98e

Browse files
authored
feat(extensions): allow seperate release/debug build configuration (#5741)
1 parent eb91801 commit fdcc98e

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

lib/services/ios-native-target-service.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { injector } from "../common/yok";
1313
export class IOSNativeTargetService implements IIOSNativeTargetService {
1414
constructor(
1515
protected $fs: IFileSystem,
16-
protected $pbxprojDomXcode: IPbxprojDomXcode
16+
protected $pbxprojDomXcode: IPbxprojDomXcode,
17+
protected $logger: ILogger
1718
) {}
1819

1920
public addTargetToProject(
@@ -141,19 +142,51 @@ export class IOSNativeTargetService implements IIOSNativeTargetService {
141142
targetUuid
142143
);
143144
}
145+
const properties: IXcodeTargetBuildConfigurationProperty[] = [];
144146

147+
// Set for both release and debug
145148
if (configurationJson.targetBuildConfigurationProperties) {
146-
const properties: IXcodeTargetBuildConfigurationProperty[] = [];
147149
_.forEach(
148150
configurationJson.targetBuildConfigurationProperties,
149151
(value, name: string) => properties.push({ value, name })
150152
);
151-
this.setXcodeTargetBuildConfigurationProperties(
152-
properties,
153-
targetName,
154-
project
153+
}
154+
155+
if (configurationJson.targetNamedBuildConfigurationProperties) {
156+
_.forEach(
157+
configurationJson.targetNamedBuildConfigurationProperties,
158+
(value, name: string) => {
159+
var buildName: BuildNames = null;
160+
switch (name) {
161+
case "debug": {
162+
buildName = BuildNames.debug;
163+
break;
164+
}
165+
case "release": {
166+
buildName = BuildNames.release;
167+
break;
168+
}
169+
default: {
170+
this.$logger.warn(
171+
"Ignoring targetNamedBuildConfigurationProperties: %s. Only 'release', 'debug' are allowed.",
172+
name
173+
);
174+
}
175+
}
176+
if (buildName) {
177+
_.forEach(value, (value, name: string) =>
178+
properties.push({ value, name, buildNames: [buildName] })
179+
);
180+
}
181+
}
155182
);
156183
}
184+
185+
this.setXcodeTargetBuildConfigurationProperties(
186+
properties,
187+
targetName,
188+
project
189+
);
157190
}
158191
}
159192
}

0 commit comments

Comments
 (0)