what's in the file of .swiftmodule?how to open it?

as title.

Best

Bob

Hi, Bob. A swiftmodule file contains serialized ASTs (and possibly SIL)—it's basically a binary file format equivalent to header files for a C framework or library. There's some more information available in Serialization.rst <https://github.com/apple/swift/blob/master/docs/Serialization.rst&gt; in the compiler docs.

You can use the swift-ide-test tool to dump the public interface for a module, but the command-line interface is less pretty than it should be:

swift-ide-test -print-module -source-filename=dummy.swift -module-to-print=MyApp

…plus any -I or -F paths necessary to find your module and all its dependencies. If you're on a Mac, you'll need to insert "xcrun -sdk macosx" or "xcrun -sdk iphoneos" at the start to find the system headers.

Hope that helps,
Jordan

P.S. This is something we should make easier to do outside of Xcode. In Xcode, you can "Jump to Definition" on an import to see the same public interface.

···

On Jan 11, 2016, at 17:57, qibo_cn--- via swift-users <swift-users@swift.org> wrote:

as title.

Best
Bob

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

8 Likes

Thanks very much for replying.My OS is Ubuntu 14.04, I build swift on it, but there is no swift-ide-test on install directory.Does this tool could use in Ubuntu 14.04?BrsBob

···

Subject: Re: [swift-users] what's in the file of .swiftmodule?how to open it?
From: jordan_rose@apple.com
Date: Tue, 12 Jan 2016 10:06:04 -0800
CC: swift-users@swift.org
To: qibo_cn@outlook.com

Hi, Bob. A swiftmodule file contains serialized ASTs (and possibly SIL)—it's basically a binary file format equivalent to header files for a C framework or library. There's some more information available in Serialization.rst in the compiler docs.
You can use the swift-ide-test tool to dump the public interface for a module, but the command-line interface is less pretty than it should be:
swift-ide-test -print-module -source-filename=dummy.swift -module-to-print=MyApp
…plus any -I or -F paths necessary to find your module and all its dependencies. If you're on a Mac, you'll need to insert "xcrun -sdk macosx" or "xcrun -sdk iphoneos" at the start to find the system headers.
Hope that helps,Jordan
P.S. This is something we should make easier to do outside of Xcode. In Xcode, you can "Jump to Definition" on an import to see the same public interface.

On Jan 11, 2016, at 17:57, qibo_cn--- via swift-users <swift-users@swift.org> wrote:as title.Best

Bob

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

I don't think swift-ide-test is installed by default, but it should still be in your build directory. It's part of the "tools" component if you want to customize your install components.

Jordan

···

On Jan 14, 2016, at 6:22, qibo <qibo_cn@outlook.com> wrote:

Thanks very much for replying.
My OS is Ubuntu 14.04, I build swift on it, but there is no swift-ide-test on install directory.
Does this tool could use in Ubuntu 14.04?
Brs
Bob

Subject: Re: [swift-users] what's in the file of .swiftmodule?how to open it?
From: jordan_rose@apple.com
Date: Tue, 12 Jan 2016 10:06:04 -0800
CC: swift-users@swift.org
To: qibo_cn@outlook.com

Hi, Bob. A swiftmodule file contains serialized ASTs (and possibly SIL)—it's basically a binary file format equivalent to header files for a C framework or library. There's some more information available in Serialization.rst <https://github.com/apple/swift/blob/master/docs/Serialization.rst&gt; in the compiler docs.

You can use the swift-ide-test tool to dump the public interface for a module, but the command-line interface is less pretty than it should be:

swift-ide-test -print-module -source-filename=dummy.swift -module-to-print=MyApp

…plus any -I or -F paths necessary to find your module and all its dependencies. If you're on a Mac, you'll need to insert "xcrun -sdk macosx" or "xcrun -sdk iphoneos" at the start to find the system headers.

Hope that helps,
Jordan

P.S. This is something we should make easier to do outside of Xcode. In Xcode, you can "Jump to Definition" on an import to see the same public interface.

On Jan 11, 2016, at 17:57, qibo_cn--- via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

as title.
Best
Bob
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

How can I build a tool like swift-ide-test from the source?

Building the compiler through the usual instructions will build it in BUILD_DIR/bin/swift-ide-test

Just for the record, the linked URL was updated from .rst to .md

4 Likes