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

Text("Hoge", bundle: .module) fails to output static site #77

Open
2 tasks done
KC-2001MS opened this issue Feb 28, 2024 · 0 comments
Open
2 tasks done

Text("Hoge", bundle: .module) fails to output static site #77

KC-2001MS opened this issue Feb 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@KC-2001MS
Copy link

In the SwiftUI library, I have defined a structure that contains Text("Hoge", bundle: .module) in the body variable. In this case, the build fails when the static site is built with Makefile.
If Text("Hoge", bundle: .module) is replaced with Text("Hoge"), the build succeeds.
The following libraries are affected by this phenomenon.
https://github.com/KC-2001MS/OnboardingUI

Note: This error occurred in all releases, including the main repository and the latest version.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected behavior

The following command should output the static site of the project for the specified target in the specified path

DOCC_TARGET = hoge
DOCC_DIR = ./docs

.PHONY: docc
docc:
	swift package --allow-writing-to-directory $(DOCC_DIR) \
		generate-documentation --target $(DOCC_TARGET) \
		--disable-indexing \
		--transform-for-static-hosting \
		--hosting-base-path hoge \
		--output-path $(DOCC_DIR)

Actual behavior

Describe or copy/paste the behavior you observe.

swift package --allow-writing-to-directory ./docs \
		generate-documentation --target home \
		--disable-indexing \
		--transform-for-static-hosting \
		--hosting-base-path home \
		--output-path ./docs
warning: 'onboardingui': found 2 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/keisuke/Documents/オープンソース開発/OnboardingUI/Sources/OnboardingUI/Localizable.xcstrings
    /Users/keisuke/Documents/オープンソース開発/OnboardingUI/Sources/OnboardingUI/PrivacyInfo.xcprivacy
Building for debugging...
Build complete! (0.25s)
Generating documentation for 'OnboardingUI'...
warning: 'onboardingui': found 2 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/keisuke/Documents/オープンソース開発/OnboardingUI/Sources/OnboardingUI/Localizable.xcstrings
    /Users/keisuke/Documents/オープンソース開発/OnboardingUI/Sources/OnboardingUI/PrivacyInfo.xcprivacy
Building for debugging...
/Users/keisuke/Documents/オープンソース開発/OnboardingUI/Sources/OnboardingUI/UI/View/Parts/OnboardingButton.swift:52:39: error: type 'Bundle?' has no member 'module'
            Text("Continue", bundle: .module)
                                     ~^~~~~~
error: fatalError

error: unspecified("fatalError")
make: *** [docc] Error 1

This is the actual representation in the above repository.

Steps to Reproduce

  1. Download the following repository
  2. Check that line 52 of OnboardingButton.swift is Text("Continue", bundle: .module)
  3. Go to the folder of this repository in Terminal and execute make docc.
  4. rewrite line 52 as Text("Continue") and repeat the action in 3.
    Check for errors in 3 and 4, respectively.

Workaround

Temporarily rewrite Text("Hoge", bundle: .module) to Text("Hoge") when outputting a static site.

Swift-DocC Plugin Version Information

Swift-DocC plugin version: 1.3.0 1.2.0 1.1.0 1.0.0 main
Swift Compiler version: swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5).

PS

My apologies if I am using this incorrectly. I would appreciate it if you could point it out to me.

@KC-2001MS KC-2001MS added the bug Something isn't working label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant