Search in sources :

Example 1 with DefaultSwiftCompileSpec

use of org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec in project gradle by gradle.

the class SwiftCompile method createSpec.

private SwiftCompileSpec createSpec(BuildOperationLogger operationLogger, boolean isIncremental, Collection<File> changedFiles, Collection<File> removedFiles, NativePlatformInternal targetPlatform) {
    SwiftCompileSpec spec = new DefaultSwiftCompileSpec();
    spec.setModuleName(moduleName.getOrNull());
    spec.setModuleFile(moduleFile.get().getAsFile());
    for (File file : modules.getFiles()) {
        if (file.isFile()) {
            spec.include(file.getParentFile());
        } else {
            spec.include(file);
        }
    }
    spec.setTargetPlatform(targetPlatform);
    spec.setTempDir(getTemporaryDir());
    spec.setObjectFileDir(objectFileDir.get().getAsFile());
    spec.source(getSource());
    spec.setRemovedSourceFiles(removedFiles);
    spec.setChangedFiles(changedFiles);
    // Convert Swift-like macros to a Map like NativeCompileSpec expects
    Map<String, String> macros = new LinkedHashMap<>();
    for (String macro : getMacros().get()) {
        macros.put(macro, null);
    }
    spec.setMacros(macros);
    spec.args(getCompilerArgs().get());
    spec.setDebuggable(getDebuggable().get());
    spec.setOptimized(getOptimized().get());
    spec.setIncrementalCompile(isIncremental);
    spec.setOperationLogger(operationLogger);
    spec.setSourceCompatibility(sourceCompatibility.get());
    return spec;
}
Also used : DefaultSwiftCompileSpec(org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec) SwiftCompileSpec(org.gradle.nativeplatform.toolchain.internal.compilespec.SwiftCompileSpec) DefaultSwiftCompileSpec(org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec) OutputFile(org.gradle.api.tasks.OutputFile) File(java.io.File) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 OutputFile (org.gradle.api.tasks.OutputFile)1 DefaultSwiftCompileSpec (org.gradle.language.swift.tasks.internal.DefaultSwiftCompileSpec)1 SwiftCompileSpec (org.gradle.nativeplatform.toolchain.internal.compilespec.SwiftCompileSpec)1