Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locheck: add support for linux. #56

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ EXECUTABLE_NAME = locheck
REPO = https://github.com/Asana/locheck
VERSION = 0.9.11

UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S), Darwin)
BUILD_PATH_PREFIX := .build/apple/Products/Release
endif
ifeq ($(UNAME_S), Linux)
BUILD_PATH_PREFIX := .build/release
endif

PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)
BUILD_PATH = .build/apple/Products/Release/$(EXECUTABLE_NAME)
BUILD_PATH = $(BUILD_PATH_PREFIX)/$(EXECUTABLE_NAME)
CURRENT_PATH = $(PWD)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
GIT_STATUS := $(shell git status -s)
Expand Down
9 changes: 7 additions & 2 deletions Sources/LocheckCommand/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
//

import ArgumentParser
import Darwin
import Files
import Foundation
import LocheckLogic

#if os(Linux) || os(FreeBSD)
import func Glibc.exit
#else
import func Darwin.exit
#endif

let version = "0.9.11"

struct Locheck: ParsableCommand {
Expand Down Expand Up @@ -42,7 +47,7 @@ private func withProblemReporter(
block(problemReporter)
if problemReporter.hasError || (treatWarningsAsErrors && problemReporter.hasWarning) {
print("Errors found")
Darwin.exit(1)
exit(1)
}
print("Finished validating")
}
Expand Down
10 changes: 8 additions & 2 deletions Sources/LocheckLogic/ProblemReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
// Created by Steve Landey on 8/18/21.
//

import func Darwin.fputs
import var Darwin.stderr
import Foundation

#if os(Linux) || os(FreeBSD)
import func Glibc.fputs
import var Glibc.stderr
#else
import func Darwin.fputs
import var Darwin.stderr
#endif

private struct StderrOutputStream: TextOutputStream {
mutating func write(_ string: String) {
fputs(string, stderr)
Expand Down
Loading