Skip to content

Commit

Permalink
Enhance module-fingerprint.swift to check the exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ungar committed Feb 27, 2021
1 parent a4d32f9 commit d5ef9a0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
public func fromC(parameter: Int = 0) {}

struct S {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public func fromC(parameter: Int = 0) {}

struct S {
public func member() {}
}
public func other() {}
31 changes: 25 additions & 6 deletions test/Incremental/CrossModule/module-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print B -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-CLEAN-B
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print A -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-CLEAN-A

// CHECK-CLEAN-C: fingerprint=6e60fd224d614a59568a348e0ac9b55a
// CHECK-CLEAN-B: fingerprint=bfa14052e1df9253b7bf7e0eb7cfc505
// CHECK-CLEAN-A: fingerprint=a939d89f07c766a4607c5fe1a1715cf5
// CHECK-CLEAN-C: fingerprint=7957733a8ee9bc44f726a516108786eb
// CHECK-CLEAN-B: fingerprint=17bb71bdc7972a93446d524f47044156
// CHECK-CLEAN-A: fingerprint=048332944f6e149f2e8bed309d47283d

//
// Now change C and ensure that B rebuilds but A does not
Expand All @@ -32,6 +32,25 @@
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print B -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-INCREMENTAL-B
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print A -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-INCREMENTAL-A

// CHECK-INCREMENTAL-C: fingerprint=3e68d59b74032e18401ec978cdb11cf3
// CHECK-INCREMENTAL-B: fingerprint=bfa14052e1df9253b7bf7e0eb7cfc505
// CHECK-INCREMENTAL-A: fingerprint=a939d89f07c766a4607c5fe1a1715cf5
// CHECK-INCREMENTAL-C: fingerprint=263f083edcaaf08536f657d10082dacc
// CHECK-INCREMENTAL-B: fingerprint=17bb71bdc7972a93446d524f47044156
// CHECK-INCREMENTAL-A: fingerprint=048332944f6e149f2e8bed309d47283d

//
// Now change a top-level type of C and ensure that C's fingerprint does not change
//

// RUN: cp %S/Inputs/module-fingerprint/C2.swift %t/C.swift

// RUN: cd %t && %target-swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/C.swiftmodule -enable-experimental-cross-module-incremental-build -module-name C -I %t -output-file-map %t/C.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle C.swift
// RUN: touch %t/C.swiftmodule
// RUN: cd %t && %target-swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/B.swiftmodule -enable-experimental-cross-module-incremental-build -module-name B -I %t -output-file-map %t/B.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle B.swift
// RUN: cd %t && %target-swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/A.swiftmodule -enable-experimental-cross-module-incremental-build -module-name A -I %t -output-file-map %t/A.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle A.swift

// RUN: %target-swift-ide-test -print-module-metadata -module-to-print C -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-INCREMENTAL2-C
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print B -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-INCREMENTAL2-B
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print A -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-INCREMENTAL2-A

// CHECK-INCREMENTAL2-C: fingerprint=263f083edcaaf08536f657d10082dacc
// CHECK-INCREMENTAL2-B: fingerprint=17bb71bdc7972a93446d524f47044156
// CHECK-INCREMENTAL2-A: fingerprint=048332944f6e149f2e8bed309d47283d

0 comments on commit d5ef9a0

Please sign in to comment.