use of org.gradle.ide.xcode.internal.xcodeproj.GidGenerator in project gradle by gradle.
the class GenerateXcodeProjectFileTask method configure.
@Override
protected void configure(XcodeProjectFile projectFile) {
PBXProject project = new PBXProject(projectPath);
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getSources(), "Sources");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getHeaders(), "Headers");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getTests(), "Tests");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getRoot());
for (XcodeTarget xcodeTarget : xcodeProject.getTargets()) {
if (xcodeTarget.isBuildable()) {
project.getTargets().add(toGradlePbxTarget(xcodeTarget));
} else {
getLogger().warn("'" + xcodeTarget.getName() + "' component in project '" + projectPath + "' is not buildable.");
}
project.getTargets().add(toIndexPbxTarget(xcodeTarget));
if (!xcodeTarget.isUnitTest() && xcodeTarget.getDebugOutputFile().isPresent()) {
File debugOutputFile = xcodeTarget.getDebugOutputFile().get().getAsFile();
PBXFileReference fileReference = new PBXFileReference(debugOutputFile.getName(), debugOutputFile.getAbsolutePath(), PBXReference.SourceTree.ABSOLUTE);
fileReference.setExplicitFileType(Optional.of(xcodeTarget.getOutputFileType()));
project.getMainGroup().getOrCreateChildGroupByName(PRODUCTS_GROUP_NAME).getChildren().add(fileReference);
}
}
// Create build configuration at the project level from all target's build configuration
project.getTargets().stream().flatMap(it -> it.getBuildConfigurationList().getBuildConfigurationsByName().asMap().keySet().stream()).forEach(project.getBuildConfigurationList().getBuildConfigurationsByName()::getUnchecked);
XcodeprojSerializer serializer = new XcodeprojSerializer(gidGenerator, project);
final NSDictionary rootObject = serializer.toPlist();
projectFile.transformAction(new Action<NSDictionary>() {
@Override
public void execute(NSDictionary dict) {
dict.clear();
dict.putAll(rootObject);
}
});
}
Aggregations