-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Makefile
58 lines (50 loc) · 1.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SHELL = /bin/bash
REPODIR = $(shell pwd)
BUILDDIR = $(REPODIR)/.build
RELEASEBUILDDIR = $(BUILDDIR)/release
TEMPPRODUCTDIR = $(BUILDDIR)/_PRODUCT
PRODUCTDIR = $(RELEASEBUILDDIR)/_PRODUCT
.DEFAULT_GOAL = all
.PHONY: all
all: build
.PHONY: build
build:
@swift build \
-c release \
--disable-sandbox \
--build-path "$(BUILDDIR)" \
-Xswiftc \
-emit-module-interface \
-Xswiftc \
-enable-library-evolution \
-Xswiftc \
-swift-version \
-Xswiftc 5
@rm -rf "$(PRODUCTDIR)"
@rm -rf "$(TEMPPRODUCTDIR)"
@mkdir -p "$(TEMPPRODUCTDIR)"
@mkdir -p "$(TEMPPRODUCTDIR)/include/swiftinfo"
@# Module Stability - Replace *.swiftmodule with *.swiftinterface
@mv *.swiftinterface $(RELEASEBUILDDIR)
@rm $(RELEASEBUILDDIR)/*.swiftmodule
@# Workaround for types that have the same name as its module
@# https://forums.swift.org/t/frameworkname-is-not-a-member-type-of-frameworkname-errors-inside-swiftinterface/28962
@sed -i '' 's/XcodeProj\.//g' $(RELEASEBUILDDIR)/XcodeProj.swiftinterface
@cp -a "$(RELEASEBUILDDIR)/." "$(TEMPPRODUCTDIR)/include/swiftinfo"
@cp -a "$(TEMPPRODUCTDIR)/." "$(PRODUCTDIR)"
@rm -rf "$(TEMPPRODUCTDIR)"
@mkdir -p "$(PRODUCTDIR)/bin"
@rm -rf $(PRODUCTDIR)/include/swiftinfo/ModuleCache
@mv "$(PRODUCTDIR)/include/swiftinfo/swiftinfo" "$(PRODUCTDIR)/bin"
@cp -a "$(REPODIR)/Sources/Csourcekitd/." "$(PRODUCTDIR)/include/swiftinfo/Csourcekitd"
@rm -f "$(RELEASEBUILDDIR)/swiftinfo"
@ln -s "$(PRODUCTDIR)/bin/swiftinfo" "$(RELEASEBUILDDIR)/swiftinfo"
@cp "$(REPODIR)/LICENSE" "$(PRODUCTDIR)/LICENSE"
.PHONY: package
package:
rm -f "$(PRODUCTDIR)/swiftinfo.zip"
cd $(PRODUCTDIR) && zip -r ./swiftinfo.zip ./
echo "ZIP created at: $(PRODUCTDIR)/swiftinfo.zip"
.PHONY: clean
clean:
@rm -rf "$(BUILDDIR)"