0

im adding Periphery in Project.swift using tuist like this:

    .target(
      name: "\(TargetName.periphery)",
      destinations: .macOS,
      product: .framework,
      bundleId: "",
      sources: [],
      scripts: [
        .pre(
          script: "./Tools/periphery/run_periphery.sh",
          name: "Run Periphery",
          basedOnDependencyAnalysis: false
        )
      ],
      settings: .settings(base:
                            ["ASSETCATALOG_COMPILER_APPICON_NAME": "",
                             "DEFINES_MODULE": "NO"])
    )

And it works perfect. But when im building target Periphery (cmd+B) to run scripе I get an error: No such module "NameOfMyMainTarget" in my tests where im using @testable import "NameOfMyMainTarget" (If i build my main scheme so it was builded success)

If i remove these files with tests which contains -> @testable import "NameOfMyMainTarget" Periphery works good, but how i can build project with these files?

my part of run_periphery.sh script:

xcrun --sdk macosx "$PERIPHERY_BIN" scan --verbose \
  --project "$ROOT_DIR/NameOfMyMainTarget.xcworkspace" \
  --schemes NameOfMyMainTarget \
  --retain-public \
  --retain-unused-protocol-func-params \
  --clean-build \
  --format xcode \
  -- \
  build \
  -sdk iphonesimulator \
  -destination "platform=iOS Simulator,id=$SIMULATOR_UDID" \
  CODE_SIGNING_ALLOWED=NO \
  ENABLE_BITCODE="NO" \
  COMPILER_INDEX_STORE_ENABLE="YES" \
  INDEX_ENABLE_DATA_STORE="YES" \
  CODE_SIGN_IDENTITY="" \
  CODE_SIGNING_REQUIRED=NO \
  EXPANDED_CODE_SIGN_IDENTITY="" \
  EXPANDED_CODE_SIGN_IDENTITY_NAME="" \
  EXPANDED_PROVISIONING_PROFILE=""
New contributor
Alexander Germek is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

1 Answer 1

1

this will fix problem, add in run_periphery.sh before "periphery scan"

# Some variables set by Xcode breaks build.
# We want to run periphery in fresh env without variables set by Xcode.
# It can be achieved by using
#   env -i "$ROOT_DIR"/Tools/periphery/run_periphery.sh
# OR
#   by unsetting explicitly the variables that breaks the build
unset SWIFT_INSTALL_MODULE_FOR_DEPLOYMENT
unset TEST_FRAMEWORK_SEARCH_PATHS
unset TEST_LIBRARY_SEARCH_PATHS
New contributor
Alexander Germek is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.