File: rebuild-transitive-import.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (24 lines) | stat: -rw-r--r-- 1,570 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/Build)
// RUN: %empty-directory(%t/ModuleCache)

// 1. Create a module called InnerModule, and put its interface into the build dir.
// RUN: echo 'public func inInnerModule() {}' | %target-swift-frontend - -typecheck -emit-module-interface-path %t/Build/InnerModule.swiftinterface -enable-library-evolution -swift-version 5 -module-name InnerModule

// 2. Build the .swiftinterface to a .swiftmodule, which will have a dependency on the interface
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Build/InnerModule.swiftmodule %t/Build/InnerModule.swiftinterface

// 3. Touch the interface so the module becomes out of date.
// RUN: %{python} %S/../Inputs/make-old.py %t/Build/InnerModule.swiftinterface

// 4. Create a module called OuterModule that imports InnerModule, and put its interface into the build dir.
// RUN: echo 'import InnerModule' | %target-swift-frontend - -emit-module -o %t/Build/OuterModule.swiftmodule -module-name OuterModule -I %t/Build

// 5. Build this file, and expect that InnerModule is out of date
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache 2>&1 | %FileCheck %s

import OuterModule

// CHECK: rebuilding module 'InnerModule' from interface '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftinterface'
// CHECK: compiled module is out of date: '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftmodule'
// CHECK: dependency is out of date: '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftinterface'