apache / apache/cordova-node-xcode

pbxProject.prototype.addFramework: automatically create Frameworks Group if it does not exist

Đang mở
#28 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
217
Fork
102
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
6

Mô tả

**This is a feature proposal**

**Initial Situation**:

Your xcode project tree looks like this:
bildschirmfoto 2018-12-09 um 22 28 11

You have a Xcode project without a `Framworks` group and you want to add a new framework using `pbxProject.prototype.addFramework`.

**Current behaviour**:

The `Frameworks` group is created but not added to the `mainGroup` of the project which references all files (that are not part of a subgroup) and all groups (that are no subgroups).

If you open the updated xcode project with xcode you see the following:

bildschirmfoto 2018-12-09 um 22 15 28

This is because xcode cannot find a reference to the `Frameworks` group on the `mainGroup` and therefore "autofixes" the project by adding the library added with `pbxProject.prototype.addFramework` to a newly generated group `Recovered References`.

**Expected behaviour**:

The `Framework` group is created and also automatically added to the `mainGroup`.

When you open the project in xcode it should look like this:

bildschirmfoto 2018-12-09 um 22 23 26

**Current workaround:**

Add the `Frameworks` group to `mainGroup`manually:

```js
const project = xcode.project(projectPath);
project.parseSync();

project.addFramework(path.resolve(frameworksDirectory, 'GoogleInterchangeUtilities.framework'), {
customFramework: true,
embed: true,
link: true,
});

const mainProject = project.getPBXGroupByKey(project.getFirstProject().firstProject.mainGroup);
if (!mainProject.children.some(children => children.comment === 'Frameworks')) {
const [groupKey] = Object.entries(project.hash.project.objects['PBXGroup']).find(
([, group]) => group.name === 'Frameworks',
);
project.addToPbxGroup(groupKey, project.getFirstProject().firstProject.mainGroup);
}
```

If you are okay with this feature proposal I would love to implement it!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại pbxProject.prototype.addFramework và lần theo cách nhóm Frameworks và project mainGroup được xử lý. Sử dụng workaround của issue làm tham chiếu về hành vi. Được xem là hoàn tất khi một nhóm Frameworks bị thiếu vừa được tạo vừa được mainGroup tham chiếu, để Xcode không đặt framework vào Recovered References.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, javascript, nodejs
Lĩnh vực
mobile
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.