-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
56 lines (42 loc) · 1.53 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
UNAME = ${shell uname}
# set EXECUTABLE_DIRECTORY according to your specific environment
# run swift build and see where the output executable is created
ifeq ($(UNAME), Darwin)
PLATFORM = x86_64-apple-macosx
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
TEST_RESOURCES_DIRECTORY = ./.build/${PLATFORM}/debug/SwiftResourceHandlingExamplePackageTests.xctest/Contents/Resources
else ifeq ($(UNAME), Linux)
PLATFORM = x86_64-unknown-linux
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
TEST_RESOURCES_DIRECTORY = ${EXECUTABLE_DIRECTORY}
endif
RUN_RESOURCES_DIRECTORY = ${EXECUTABLE_DIRECTORY}
build: copyRunResources
swift build --target AutorestSwift
./scripts/swiftlint.sh > /dev/null
copyRunResources:
mkdir -p ${RUN_RESOURCES_DIRECTORY}
cp templates/* ${RUN_RESOURCES_DIRECTORY}
copyTestResources:
mkdir -p ${TEST_RESOURCES_DIRECTORY}
cp templates/* ${TEST_RESOURCES_DIRECTORY}
buildSwiftlint:
scripts/build-swift-lint.sh
copyTools:
pod install
cp ./Pods/SwiftFormat/CommandLineTool/swiftformat ${RUN_RESOURCES_DIRECTORY}
cp ./Pods/SwiftLint/swiftlint ${RUN_RESOURCES_DIRECTORY}
cp ./.swiftformat ${RUN_RESOURCES_DIRECTORY}
cp ./.swiftlint.yml ${RUN_RESOURCES_DIRECTORY}
install: build copyTools
run: ${EXECUTABLE_DIRECTORY}/AutorestSwift
test: copyTestResources
swift build --target AutorestSwiftTest
swift test
clean:
rm -rf .build
rm Package.resolved
cleanAll:
find . -name ".build" -type d -exec rm -rf {} \;
find . -name "Package.resolved" -exec rm -rf {} \;
.PHONY: run build test copyRunResources copyTestResources clean