Search in sources :

Example 1 with XcodeBinary

use of org.gradle.ide.xcode.internal.XcodeBinary in project gradle by gradle.

the class GenerateXcodeProjectFileTask method toToolAndLibraryPbxTarget.

private PBXTarget toToolAndLibraryPbxTarget(XcodeTarget xcodeTarget) {
    PBXLegacyTarget target = new PBXLegacyTarget(xcodeTarget.getName(), xcodeTarget.getProductType());
    target.setProductName(xcodeTarget.getProductName());
    target.setBuildToolPath(xcodeTarget.getGradleCommand());
    target.setBuildArgumentsString(buildGradleArgs(xcodeTarget));
    target.setGlobalID(xcodeTarget.getId());
    File outputFile = xcodeTarget.getDebugOutputFile().get().getAsFile();
    target.setProductReference(new PBXFileReference(outputFile.getName(), outputFile.getAbsolutePath(), PBXReference.SourceTree.ABSOLUTE));
    xcodeTarget.getBinaries().forEach(xcodeBinary -> {
        NSDictionary settings = target.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(xcodeBinary.getBuildConfigurationName()).getBuildSettings();
        File binaryOutputFile = xcodeBinary.getOutputFile().get().getAsFile();
        settings.put("CONFIGURATION_BUILD_DIR", new NSString(binaryOutputFile.getParentFile().getAbsolutePath()));
        settings.put("PRODUCT_NAME", target.getProductName());
        settings.put("SWIFT_VERSION", toXcodeSwiftVersion(xcodeTarget.getSwiftSourceCompatibility()));
        settings.put("ARCHS", toXcodeArchitecture(xcodeBinary.getArchitectureName()));
        settings.put("VALID_ARCHS", xcodeTarget.getBinaries().stream().map(XcodeBinary::getArchitectureName).map(GenerateXcodeProjectFileTask::toXcodeArchitecture).distinct().collect(Collectors.joining(" ")));
    });
    return target;
}
Also used : XcodeBinary(org.gradle.ide.xcode.internal.XcodeBinary) PBXLegacyTarget(org.gradle.ide.xcode.internal.xcodeproj.PBXLegacyTarget) NSDictionary(com.dd.plist.NSDictionary) XcodeProjectFile(org.gradle.ide.xcode.tasks.internal.XcodeProjectFile) PBXBuildFile(org.gradle.ide.xcode.internal.xcodeproj.PBXBuildFile) File(java.io.File) NSString(com.dd.plist.NSString) PBXFileReference(org.gradle.ide.xcode.internal.xcodeproj.PBXFileReference)

Aggregations

NSDictionary (com.dd.plist.NSDictionary)1 NSString (com.dd.plist.NSString)1 File (java.io.File)1 XcodeBinary (org.gradle.ide.xcode.internal.XcodeBinary)1 PBXBuildFile (org.gradle.ide.xcode.internal.xcodeproj.PBXBuildFile)1 PBXFileReference (org.gradle.ide.xcode.internal.xcodeproj.PBXFileReference)1 PBXLegacyTarget (org.gradle.ide.xcode.internal.xcodeproj.PBXLegacyTarget)1 XcodeProjectFile (org.gradle.ide.xcode.tasks.internal.XcodeProjectFile)1