Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Added application_region and application_language properties to xcode_workspace_config #2519

Merged
merged 4 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add application region and language arguments to projectV2
  • Loading branch information
Lucas Marçal committed Aug 8, 2020
commit c0caaa6a186dfc360295911115062d4b134406e5
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ interface AbstractXcodeWorkspaceConfigDescriptionArg extends BuildRuleArg {
Optional<ImmutableMap<SchemeActionType, ImmutableMap<String, String>>>
getEnvironmentVariables();

Optional<ImmutableMap<String, String>> getApplicationLanguage();
Optional<String> getApplicationLanguage();

Optional<ImmutableMap<String, String>> getApplicationRegion();
Optional<String> getApplicationRegion();

Optional<ImmutableMap<SchemeActionType, BuildTarget>> getExpandVariablesBasedOn();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,6 @@ public static Element serializeTestAction(Document doc, XCScheme.TestAction test
testableElem.appendChild(refElem);
}

if (testAction.getApplicationLanguage().isPresent()) {
testActionElem.setAttribute("language", testAction.getApplicationLanguage().get());
}

if (testAction.getApplicationRegion().isPresent()) {
testActionElem.setAttribute("region", testAction.getApplicationRegion().get());
}

if (testAction.getEnvironmentVariables().isPresent()) {
if (testAction.getExpandVariablesBasedOn().isPresent()) {
Element expandBasedOnElement =
Expand All @@ -493,6 +485,14 @@ public static Element serializeTestAction(Document doc, XCScheme.TestAction test
testActionElem.appendChild(environmentVariablesElement);
}

if (testAction.getApplicationLanguage().isPresent()) {
testActionElem.setAttribute("language", testAction.getApplicationLanguage().get());
}

if (testAction.getApplicationRegion().isPresent()) {
testActionElem.setAttribute("region", testAction.getApplicationRegion().get());
}

return testActionElem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,8 @@ private SchemeGenerator buildSchemeGenerator(
Optional<XCScheme.LaunchAction.WatchInterface> watchInterface = Optional.empty();
Optional<String> notificationPayloadFile = Optional.empty();
Optional<Boolean> wasCreatedForAppExtension = Optional.empty();
Optional<String> applicationLanguage = Optional.empty();
Optional<String> applicationRegion = Optional.empty();

if (schemeConfigArg.isPresent()) {
environmentVariables = schemeConfigArg.get().getEnvironmentVariables();
Expand All @@ -1280,6 +1282,8 @@ private SchemeGenerator buildSchemeGenerator(
watchInterface = schemeConfigArg.get().getWatchInterface();
notificationPayloadFile = schemeConfigArg.get().getNotificationPayloadFile();
wasCreatedForAppExtension = schemeConfigArg.get().getWasCreatedForAppExtension();
applicationLanguage = schemeConfigArg.get().getApplicationLanguage();
applicationRegion = schemeConfigArg.get().getApplicationRegion();
}

return new SchemeGenerator(
Expand All @@ -1301,6 +1305,8 @@ private SchemeGenerator buildSchemeGenerator(
additionalSchemeActions,
launchStyle,
watchInterface,
notificationPayloadFile);
notificationPayloadFile,
applicationLanguage,
applicationRegion);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class SchemeGenerator {
private Optional<
ImmutableMap<SchemeActionType, ImmutableMap<AdditionalActions, ImmutableList<String>>>>
additionalSchemeActions;
private final Optional<String> applicationLanguage;
private final Optional<String> applicationRegion;

public SchemeGenerator(
ProjectFilesystem projectFilesystem,
Expand All @@ -116,7 +118,9 @@ public SchemeGenerator(
additionalSchemeActions,
XCScheme.LaunchAction.LaunchStyle launchStyle,
Optional<XCScheme.LaunchAction.WatchInterface> watchInterface,
Optional<String> notificationPayloadFile) {
Optional<String> notificationPayloadFile,
Optional<String> applicationLanguage,
Optional<String> applicationRegion) {
this.projectFilesystem = projectFilesystem;
this.primaryTarget = primaryTarget;
this.watchInterface = watchInterface;
Expand All @@ -136,6 +140,8 @@ public SchemeGenerator(
this.expandVariablesBasedOn = expandVariablesBasedOn;
this.additionalSchemeActions = additionalSchemeActions;
this.notificationPayloadFile = notificationPayloadFile;
this.applicationLanguage = applicationLanguage;
this.applicationRegion = applicationRegion;

LOG.verbose(
"Generating scheme with build targets %s, test build targets %s, test bundle targets %s",
Expand Down Expand Up @@ -254,7 +260,9 @@ public Path writeScheme() throws IOException {
additionalCommandsForSchemeAction(
SchemeActionType.TEST,
AdditionalActions.POST_SCHEME_ACTIONS,
primaryBuildReference));
primaryBuildReference),
applicationLanguage,
applicationRegion);

for (PBXTarget target : orderedRunTestTargets) {
XCScheme.BuildableReference buildableReference =
Expand Down Expand Up @@ -290,7 +298,9 @@ public Path writeScheme() throws IOException {
SchemeActionType.LAUNCH,
AdditionalActions.POST_SCHEME_ACTIONS,
primaryBuildReference),
notificationPayloadFile));
notificationPayloadFile,
applicationLanguage,
applicationRegion));

profileAction =
Optional.of(
Expand Down Expand Up @@ -512,6 +522,14 @@ public static Element serializeTestAction(Document doc, XCScheme.TestAction test
testActionElem.appendChild(environmentVariablesElement);
}

if (testAction.getApplicationLanguage().isPresent()) {
testActionElem.setAttribute("language", testAction.getApplicationLanguage().get());
}

if (testAction.getApplicationRegion().isPresent()) {
testActionElem.setAttribute("region", testAction.getApplicationRegion().get());
}

return testActionElem;
}

Expand Down Expand Up @@ -588,6 +606,14 @@ public static Element serializeLaunchAction(Document doc, XCScheme.LaunchAction
launchActionElem.appendChild(environmentVariablesElement);
}

if (launchAction.getApplicationLanguage().isPresent()) {
launchActionElem.setAttribute("language", launchAction.getApplicationLanguage().get());
}

if (launchAction.getApplicationRegion().isPresent()) {
launchActionElem.setAttribute("region", launchAction.getApplicationRegion().get());
}

return launchActionElem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,8 @@ private SchemeGenerator buildSchemeGenerator(
Optional<XCScheme.LaunchAction.WatchInterface> watchInterface = Optional.empty();
Optional<String> notificationPayloadFile = Optional.empty();
Optional<Boolean> wasCreatedForAppExtension = Optional.empty();
Optional<String> applicationLanguage = Optional.empty();
Optional<String> applicationRegion = Optional.empty();

if (schemeConfigArg.isPresent()) {
environmentVariables = schemeConfigArg.get().getEnvironmentVariables();
Expand All @@ -956,6 +958,8 @@ private SchemeGenerator buildSchemeGenerator(
watchInterface = schemeConfigArg.get().getWatchInterface();
notificationPayloadFile = schemeConfigArg.get().getNotificationPayloadFile();
wasCreatedForAppExtension = schemeConfigArg.get().getWasCreatedForAppExtension();
applicationLanguage = schemeConfigArg.get().getApplicationLanguage();
applicationRegion = schemeConfigArg.get().getApplicationRegion();
}

return new SchemeGenerator(
Expand All @@ -977,6 +981,9 @@ private SchemeGenerator buildSchemeGenerator(
additionalSchemeActions,
launchStyle,
watchInterface,
notificationPayloadFile);
notificationPayloadFile,
applicationLanguage,
applicationRegion
);
}
}