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

XCUITest type added (similar to XCTest) #1937

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
OSXBundle = "com.apple.product-type.bundle",
OSXFramework = "com.apple.product-type.framework",
XCTest = "com.apple.product-type.bundle.unit-test",
XCUITest = "com.apple.product-type.bundle.ui-testing",
}
return types[iif(node.cfg.kind == "SharedLib" and node.cfg.sharedlibtype, node.cfg.sharedlibtype, node.cfg.kind)]
end
Expand All @@ -264,6 +265,7 @@
OSXBundle = "wrapper.cfbundle",
OSXFramework = "wrapper.framework",
XCTest = "wrapper.cfbundle",
XCUITest = "wrapper.cfbundle",
}
return types[iif(node.cfg.kind == "SharedLib" and node.cfg.sharedlibtype, node.cfg.sharedlibtype, node.cfg.kind)]
end
Expand Down Expand Up @@ -1269,6 +1271,7 @@
OSXBundle = "bundle",
OSXFramework = "framework",
XCTest = "xctest",
XCUITest = "xctest",
}
local ext = cfg.buildtarget.extension:sub(2)
if ext ~= exts[iif(cfg.kind == "SharedLib" and cfg.sharedlibtype, cfg.sharedlibtype, cfg.kind)] then
Expand Down
5 changes: 5 additions & 0 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@
"OSXBundle",
"OSXFramework",
"XCTest",
"XCUITest",
},
}

Expand Down Expand Up @@ -1920,6 +1921,10 @@
targetprefix ""
targetextension ".xctest"

filter { "system:darwin", "kind:SharedLib", "sharedlibtype:XCUITest" }
targetprefix ""
targetextension ".xctest"

-- Windows and friends.

filter { "system:Windows or language:C# or language:F#", "kind:ConsoleApp or WindowedApp" }
Expand Down
2 changes: 2 additions & 0 deletions src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@
return "-bundle"
elseif cfg.sharedlibtype == "XCTest" then
return "-bundle"
elseif cfg.sharedlibtype == "XCUITest" then
return "-bundle"
elseif cfg.sharedlibtype == "OSXFramework" then
return "-framework"
else
Expand Down
7 changes: 7 additions & 0 deletions tests/config/test_targetinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@
test.isequal("bin/Debug/MyProject.xctest/Contents/MacOS", path.getrelative(os.getcwd(), i.bundlepath))
end

function suite.bundlepathSet_onMacSharedLibXCUITest()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation to this test.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to where pls? Happy to do so.

Copy link
Member

@nickclark2016 nickclark2016 Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just look at other unit tests above and add the doc comment

kind "SharedLib"
sharedlibtype "XCUITest"
system "macosx"
i = prepare()
test.isequal("bin/Debug/MyProject.xctest/Contents/MacOS", path.getrelative(os.getcwd(), i.bundlepath))
end

--
-- Bundle path should be set for macOS/iOS framework.
Expand Down
8 changes: 8 additions & 0 deletions tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,14 @@
test.contains({ "-Wl,-x", "-bundle" }, gcc.getldflags(cfg))
end

function suite.ldflags_onMacOSXXCUITest()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation to this test.

system "MacOSX"
kind "SharedLib"
sharedlibtype "XCUITest"
prepare()
test.contains({ "-Wl,-x", "-bundle" }, gcc.getldflags(cfg))
end

function suite.ldflags_onMacOSXFramework()
system "MacOSX"
kind "SharedLib"
Expand Down
1 change: 1 addition & 0 deletions website/docs/sharedlibtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sharedlibtype "value"
* `OSXBundle` - needs documentation.
* `OSXFramework` - needs documentation.
* `XCTest` - needs documentation.
* `XCUITest`- needs documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're able to add documentation to describe this, do you mind doing so? That's basically a TODO for us when we updated our docs to get documentation added to fields.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great.

Copy link
Author

@duck4i duck4i Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll get to it after the holidays, wasn't sure if you're OK with doing this in same PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good point about same PR. It may make sense to just touch this line in this PR, then do the rest in a follow up. I don't have a huge preference either way, since the PR will stay small.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll get to it after the holidays, wasn't sure if you're OK with doing this in same PR.

Not sure when the holidays end for you. I'm trying to start prepping a new release build of Premake. Will this be ready by the weekend?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm back on 5th, so that week would be earliest. No rush on my side, we run custom fork until it gets merged. Thanks.


### Applies To ###

Expand Down