From 89ce0e88d191f65e6d470cb856db568b7932b52e Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:48:47 +0900
Subject: [PATCH 1/6] Add scripts
---
scripts/xccov-to-sonarqube-generic.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 scripts/xccov-to-sonarqube-generic.sh
diff --git a/scripts/xccov-to-sonarqube-generic.sh b/scripts/xccov-to-sonarqube-generic.sh
new file mode 100644
index 0000000..7b4f258
--- /dev/null
+++ b/scripts/xccov-to-sonarqube-generic.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+function convert_file {
+ local xccovarchive_file="$1"
+ local file_name="$2"
+ echo " "
+ xcrun xccov view --file "$file_name" "$xccovarchive_file" | \
+ sed -n '
+ s/^ *\([0-9][0-9]*\): 0.*$/ /p;
+ s/^ *\([0-9][0-9]*\): [1-9].*$/ /p
+ '
+ echo ' '
+}
+
+function xccov_to_generic {
+ echo ''
+ for xccovarchive_file in "$@"; do
+ xcrun xccov view --file-list "$xccovarchive_file" | while read -r file_name; do
+ convert_file "$xccovarchive_file" "$file_name"
+ done
+ done
+ echo ''
+}
+
+xccov_to_generic "$@"
From 3cb0070bc55a54400288e08aa6d9d9ac5ddb8c0d Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:49:05 +0900
Subject: [PATCH 2/6] Fix sonar-project
---
sonar-project.properties | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sonar-project.properties b/sonar-project.properties
index 5c589b9..cf3fcd7 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1,7 +1,8 @@
sonar.projectKey=funzin_ViewGenerator
sonar.projectName=ViewGenerator
+sonar.organization=funzin
sonar.projectVersion=1.1.0
sonar.sources=.
sonar.host.url=https://sonarcloud.io
-sonar.inclusions=./ViewGeneratorCore/**/.swift,./ViewGenereatorApp/**/*.swift,./ViewGenerator/**/*.swift
+sonar.inclusions=ViewGeneratorCore/**/*.swift,ViewGenerator/**/*.swift,ViewGeneratorApp/**/*.swift
soner.language=swift
From 6881beee318dceaa491d956fd1b6eb8c20e0e49c Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:49:41 +0900
Subject: [PATCH 3/6] Fix sourceEditorExtension
---
ViewGenerator/Source/SourceEditorExtension.swift | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ViewGenerator/Source/SourceEditorExtension.swift b/ViewGenerator/Source/SourceEditorExtension.swift
index 4109e3d..d9b3951 100644
--- a/ViewGenerator/Source/SourceEditorExtension.swift
+++ b/ViewGenerator/Source/SourceEditorExtension.swift
@@ -9,4 +9,14 @@
import Foundation
import XcodeKit
-class SourceEditorExtension: NSObject, XCSourceEditorExtension {}
+class SourceEditorExtension: NSObject, XCSourceEditorExtension {
+
+ func extensionDidFinishLaunching() {
+ // If your extension needs to do any work at launch, implement this optional method.
+ }
+
+ var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: Any]] {
+ // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter.
+ return []
+ }
+}
From 49fe10d36f234cb0e7b0d94f28016457b9442c3a Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:49:52 +0900
Subject: [PATCH 4/6] Add .scannerwork
---
.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 3c5a351..8fe14bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,4 +117,4 @@ DerivedData/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
-
+.scannerwork
From 7d3aea0d114e0bea5ec4373d42c3598e50043230 Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:50:10 +0900
Subject: [PATCH 5/6] Add sonarCloud badge
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index b8e6250..4135af0 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,9 @@
+
+
+
## Overview
From c44b37891a35cb764993c057a2810e9adeae813e Mon Sep 17 00:00:00 2001
From: funzin
Date: Sun, 1 Sep 2019 23:50:23 +0900
Subject: [PATCH 6/6] Update travis yml
---
.travis.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 156f322..79dcca6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,13 +12,13 @@ before_install:
before_script:
- set -o pipefail
script:
- - sonar-scanner
- - xcodebuild test -workspace ViewGeneratorApp.xcworkspace -scheme ViewGeneratorCore -configuration Debug -destination 'platform=macOS' | xcpretty -c
+ - xcodebuild test -workspace ViewGeneratorApp.xcworkspace -scheme ViewGeneratorCore -configuration Debug -destination 'platform=macOS' -derivedDataPath Build/ | xcpretty -c
+ - find . -type d | grep -E ".xccovarchive" | xargs -I@ bash scripts/xccov-to-sonarqube-generic.sh @ > sonarqube-generic-coverage.xml
after_success:
- - bash <(curl -s https://codecov.io/bash)
+ - bash <(curl -s https://codecov.io/bash) -D Build/
+ - sonar-scanner
notifications:
email: false
-
dist: trusty
addons:
sonarcloud: