Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 map fonts with unsupported weight and trait combo to existing 72 fonts. #536

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

billzhou0223
Copy link
Contributor

No description provided.

@billzhou0223 billzhou0223 requested a review from a team as a code owner March 22, 2023 02:20
@billzhou0223 billzhou0223 requested a review from shengxu7 March 22, 2023 02:20
@MarcoEidinger
Copy link
Member

@billzhou0223 the answer to your question" why we have to CI/build jobs" is that in Package.swift we specify // swift-tools-version:5.5 and that implies that our Swift package shall be compilable with Xcode 13. An SDK developer may use accidentally language features from a different Swift version (e.g. 5.7 because developer is using Xcode 14). To detect and easily compare I introduced two CI/build jobs. Or are you asking we do have CI/buidls for pull_request and for pull_request_target?

I see the following build errors

Testing failed:
	Command CompileSwift failed with a nonzero exit code
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'

@MarcoEidinger
Copy link
Member

Either we change swift-tools-version to 5.7 or you have to fix those erros

//font = font.width(.condensed)
font = font.width(Font.Width.condensed)

@billzhou0223
Copy link
Contributor Author

@billzhou0223 the answer to your question" why we have to CI/build jobs" is that in Package.swift we specify // swift-tools-version:5.5 and that implies that our Swift package shall be compilable with Xcode 13. An SDK developer may use accidentally language features from a different Swift version (e.g. 5.7 because developer is using Xcode 14). To detect and easily compare I introduced two CI/build jobs. Or are you asking we do have CI/buidls for pull_request and for pull_request_target?

I see the following build errors

Testing failed:
	Command CompileSwift failed with a nonzero exit code
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'
	Value of type 'Font' has no member 'width'
	Cannot infer contextual base in reference to member 'condensed'

I am talking about these two jobs. Looks like the error still persists.

image

@MarcoEidinger
Copy link
Member

I am talking about these two jobs. Looks like the error still persists.

Ignore the "pull_request_target" as this may take a different base commit and I wanted to remove that job anyway (originally I introduced it to allow code uploads to Sonar for pull requests coming from forks)

It is strange that the issue still persists for CI / build "pull_request". I see it uses your latest changes

Screenshot 2023-03-22 at 2 52 41 PM

But it complains about type 'Font' has no member 'Width' which would be true < iOS 16 but you guard with a conditional statement 🤔

@MarcoEidinger
Copy link
Member

Issue reproducible when using Xcode 14.0 locally on my machine.

Build works fine in CI when using Xcode 14.2 (https://github.com/TeamEidinger/cloud-sdk-ios-fiori-1/actions/runs/4494999119/jobs/7908154011)

I assume the function was introduced later (16.1?)

@billzhou0223
Copy link
Contributor Author

Issue reproducible when using Xcode 14.0 locally on my machine.

Build works fine in CI when using Xcode 14.2 (https://github.com/TeamEidinger/cloud-sdk-ios-fiori-1/actions/runs/4494999119/jobs/7908154011)

I assume the function was introduced later (16.1?)

Yeah it works for xcode 14.2. I tried to guard the code with both iOS 16.1 and 16.2 but neither worked.

@MarcoEidinger
Copy link
Member

Probably the best we can do is

#if swift(>=5.7.1)
  if #available(iOS 16.0, *) {
      font = font.width(Font.Width.condensed)
  }
#endif

https://forums.swift.org/t/using-apis-introduced-in-ios-minor-releases/63897/1

@MarcoEidinger
Copy link
Member

Alternatively, we can define // swift-tools-version: 5.7.1 as the minimum which requires every consumer to use Xcode 14.1 while the previous solution allows lower Xcode versions but they won't benefit from your change.

@billzhou0223
Copy link
Contributor Author

Probably the best we can do is

#if swift(>=5.7.1)
  if #available(iOS 16.0, *) {
      font = font.width(Font.Width.condensed)
  }
#endif

https://forums.swift.org/t/using-apis-introduced-in-ios-minor-releases/63897/1

I will take this approach. The impact should be minimal.

@billzhou0223 billzhou0223 merged commit 8f95c16 into SAP:main Mar 23, 2023
shengxu7 pushed a commit to shengxu7/cloud-sdk-ios-fiori that referenced this pull request Mar 23, 2023
…72 fonts. (SAP#536)

* fix: 🐛 map unsupported weight and trait combo to existing fonts

* chore: 🤖 Fix a minor compilation issue

* chore: 🤖 fix a compilation issue

* chore: 🤖 fix a compilation issue

* chore: 🤖 fix a compilation issue
shengxu7 pushed a commit that referenced this pull request Mar 24, 2023
…72 fonts. (#536)

* fix: 🐛 map unsupported weight and trait combo to existing fonts

* chore: 🤖 Fix a minor compilation issue

* chore: 🤖 fix a compilation issue

* chore: 🤖 fix a compilation issue

* chore: 🤖 fix a compilation issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants